[libvirt] PATCH: Make UML/LXC drivers robust with bad NUMA data

commit e2052c24f39c71b3b8e92a983287f72176d73c77 Author: Daniel P. Berrange <berrange@redhat.com> Date: Thu Aug 13 11:56:31 2009 +0100 Make LXC / UML drivers robust against NUMA topology brokenness Some kernel versions expose broken NUMA topology for some machines. This causes the LXC/UML drivers to fail to start. QEMU driver was already fixed for this problem * src/lxc_conf.c: Log and ignore failure to populate NUMA info * src/uml_conf.c: Log and ignore failure to populate NUMA info diff --git a/src/lxc_conf.c b/src/lxc_conf.c index d06a024..fef60ba 100644 --- a/src/lxc_conf.c +++ b/src/lxc_conf.c @@ -30,6 +30,8 @@ #include "lxc_conf.h" #include "nodeinfo.h" #include "virterror_internal.h" +#include "logging.h" + #define VIR_FROM_THIS VIR_FROM_LXC @@ -46,8 +48,14 @@ virCapsPtr lxcCapsInit(void) 0, 0)) == NULL) goto no_memory; - if (nodeCapsInitNUMA(caps) < 0) - goto no_memory; + /* Some machines have problematic NUMA toplogy causing + * unexpected failures. We don't want to break the QEMU + * driver in this scenario, so log errors & carry on + */ + if (nodeCapsInitNUMA(caps) < 0) { + virCapabilitiesFreeNUMAInfo(caps); + VIR_WARN0("Failed to query host NUMA topology, disabling NUMA capabilities"); + } /* XXX shouldn't 'borrow' KVM's prefix */ virCapabilitiesSetMacPrefix(caps, (unsigned char []){ 0x52, 0x54, 0x00 }); diff --git a/src/uml_conf.c b/src/uml_conf.c index 48e05a8..4f756d4 100644 --- a/src/uml_conf.c +++ b/src/uml_conf.c @@ -45,6 +45,7 @@ #include "nodeinfo.h" #include "verify.h" #include "bridge.h" +#include "logging.h" #define VIR_FROM_THIS VIR_FROM_UML @@ -63,8 +64,14 @@ virCapsPtr umlCapsInit(void) { 0, 0)) == NULL) goto no_memory; - if (nodeCapsInitNUMA(caps) < 0) - goto no_memory; + /* Some machines have problematic NUMA toplogy causing + * unexpected failures. We don't want to break the QEMU + * driver in this scenario, so log errors & carry on + */ + if (nodeCapsInitNUMA(caps) < 0) { + virCapabilitiesFreeNUMAInfo(caps); + VIR_WARN0("Failed to query host NUMA topology, disabling NUMA capabilities"); + } if ((guest = virCapabilitiesAddGuest(caps, "uml", -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Thu, Aug 13, 2009 at 11:58:16AM +0100, Daniel P. Berrange wrote:
commit e2052c24f39c71b3b8e92a983287f72176d73c77 Author: Daniel P. Berrange <berrange@redhat.com> Date: Thu Aug 13 11:56:31 2009 +0100
Make LXC / UML drivers robust against NUMA topology brokenness
Some kernel versions expose broken NUMA topology for some machines. This causes the LXC/UML drivers to fail to start. QEMU driver was already fixed for this problem
* src/lxc_conf.c: Log and ignore failure to populate NUMA info * src/uml_conf.c: Log and ignore failure to populate NUMA info
+ /* Some machines have problematic NUMA toplogy causing + * unexpected failures. We don't want to break the QEMU + * driver in this scenario, so log errors & carry on + */ + if (nodeCapsInitNUMA(caps) < 0) { + virCapabilitiesFreeNUMAInfo(caps);
Hum, right now this doesn't reset caps.nnumaCell
+ VIR_WARN0("Failed to query host NUMA topology, disabling NUMA capabilities"); + }
/* XXX shouldn't 'borrow' KVM's prefix */ virCapabilitiesSetMacPrefix(caps, (unsigned char []){ 0x52, 0x54, 0x00 }); diff --git a/src/uml_conf.c b/src/uml_conf.c index 48e05a8..4f756d4 100644 --- a/src/uml_conf.c +++ b/src/uml_conf.c @@ -45,6 +45,7 @@ #include "nodeinfo.h" #include "verify.h" #include "bridge.h" +#include "logging.h"
#define VIR_FROM_THIS VIR_FROM_UML
@@ -63,8 +64,14 @@ virCapsPtr umlCapsInit(void) { 0, 0)) == NULL) goto no_memory;
- if (nodeCapsInitNUMA(caps) < 0) - goto no_memory; + /* Some machines have problematic NUMA toplogy causing + * unexpected failures. We don't want to break the QEMU + * driver in this scenario, so log errors & carry on + */ + if (nodeCapsInitNUMA(caps) < 0) { + virCapabilitiesFreeNUMAInfo(caps); + VIR_WARN0("Failed to query host NUMA topology, disabling NUMA capabilities"); + }
if ((guest = virCapabilitiesAddGuest(caps, "uml",
Patch looks fine but IMHO we should add caps->host.nnumaCell = 0; in virCapabilitiesFreeNUMAInfo() to be 100% sure once done, ACK Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On Thu, Aug 13, 2009 at 01:08:01PM +0200, Daniel Veillard wrote:
On Thu, Aug 13, 2009 at 11:58:16AM +0100, Daniel P. Berrange wrote:
commit e2052c24f39c71b3b8e92a983287f72176d73c77 Author: Daniel P. Berrange <berrange@redhat.com> Date: Thu Aug 13 11:56:31 2009 +0100
Make LXC / UML drivers robust against NUMA topology brokenness
Some kernel versions expose broken NUMA topology for some machines. This causes the LXC/UML drivers to fail to start. QEMU driver was already fixed for this problem
* src/lxc_conf.c: Log and ignore failure to populate NUMA info * src/uml_conf.c: Log and ignore failure to populate NUMA info
+ /* Some machines have problematic NUMA toplogy causing + * unexpected failures. We don't want to break the QEMU + * driver in this scenario, so log errors & carry on + */ + if (nodeCapsInitNUMA(caps) < 0) { + virCapabilitiesFreeNUMAInfo(caps);
Hum, right now this doesn't reset caps.nnumaCell
+ VIR_WARN0("Failed to query host NUMA topology, disabling NUMA capabilities"); + }
/* XXX shouldn't 'borrow' KVM's prefix */ virCapabilitiesSetMacPrefix(caps, (unsigned char []){ 0x52, 0x54, 0x00 }); diff --git a/src/uml_conf.c b/src/uml_conf.c index 48e05a8..4f756d4 100644 --- a/src/uml_conf.c +++ b/src/uml_conf.c @@ -45,6 +45,7 @@ #include "nodeinfo.h" #include "verify.h" #include "bridge.h" +#include "logging.h"
#define VIR_FROM_THIS VIR_FROM_UML
@@ -63,8 +64,14 @@ virCapsPtr umlCapsInit(void) { 0, 0)) == NULL) goto no_memory;
- if (nodeCapsInitNUMA(caps) < 0) - goto no_memory; + /* Some machines have problematic NUMA toplogy causing + * unexpected failures. We don't want to break the QEMU + * driver in this scenario, so log errors & carry on + */ + if (nodeCapsInitNUMA(caps) < 0) { + virCapabilitiesFreeNUMAInfo(caps); + VIR_WARN0("Failed to query host NUMA topology, disabling NUMA capabilities"); + }
if ((guest = virCapabilitiesAddGuest(caps, "uml",
Patch looks fine but IMHO we should add caps->host.nnumaCell = 0; in virCapabilitiesFreeNUMAInfo() to be 100% sure
Yes, I've pushed it with that addition. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
participants (2)
-
Daniel P. Berrange
-
Daniel Veillard