From c23ff311fc9474bf6a1b82ce693b9fa488aa3ad6 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Fri, 28 Nov 2008 11:20:27 +0000 Subject: [PATCH] Fix libnuma use to build with v1 compatability code --- ChangeLog | 8 ++++++++ libvirt.spec.in | 2 ++ qemud/Makefile.am | 4 +++- src/qemu_conf.c | 10 ++++++---- src/qemu_driver.c | 1 + src/uml_conf.c | 10 ++++++---- src/uml_driver.c | 1 + 7 files changed, 27 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 20d0a379d6..a740d6da77 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Fri Nov 28 11:17:40 GMT 2008 Daniel P. Berrange + + * libvirt.spec.in: Add missing numa-ctl BuildRequires + * qemud/Makefile.am: Fix libvirtd_DEPENDANCIES to include all libs + * src/qemu_conf.c, src/qemu_driver.c, src/uml_conf.c, + src/uml_driver.c: Define NUMA_VERSION1_COMPATIBILITY and + fix size of array used to get node mapping + Fri Nov 28 08:40:00 CET 2008 Chris Lalancette * src/storage_backend.c: Wait up to 5 seconds for /dev/disk/by-{id,path} to exist in virStorageBackendStablePath diff --git a/libvirt.spec.in b/libvirt.spec.in index 4f9e1517e5..cddf5c8098 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -124,6 +124,8 @@ BuildRequires: lvm2 BuildRequires: iscsi-initiator-utils # For disk driver BuildRequires: parted-devel +# For QEMU/LXC numa info +BuildRequires: numactl-devel Obsoletes: libvir # Fedora build root suckage diff --git a/qemud/Makefile.am b/qemud/Makefile.am index 393c171137..15d3717e4e 100644 --- a/qemud/Makefile.am +++ b/qemud/Makefile.am @@ -87,7 +87,6 @@ libvirtd_LDFLAGS = \ $(COVERAGE_LDFLAGS) \ $(POLKIT_LIBS) -libvirtd_DEPENDENCIES = ../src/libvirt.la libvirtd_LDADD = \ ../gnulib/lib/libgnu.la @@ -129,6 +128,9 @@ libvirtd_CFLAGS += $(AVAHI_CFLAGS) libvirtd_LDADD += $(AVAHI_LIBS) endif +libvirtd_DEPENDENCIES = $(libvirtd_LDADD) + + default_xml_dest = libvirt/qemu/networks/default.xml install-data-local: install-init install-data-sasl install-data-polkit mkdir -p $(DESTDIR)$(sysconfdir)/libvirt/qemu/networks/autostart diff --git a/src/qemu_conf.c b/src/qemu_conf.c index c66cef9e39..e6c378f40f 100644 --- a/src/qemu_conf.c +++ b/src/qemu_conf.c @@ -37,6 +37,7 @@ #include #if HAVE_NUMACTL +#define NUMA_VERSION1_COMPATIBILITY 1 #include #endif @@ -300,11 +301,11 @@ qemudCapsInitGuest(virCapsPtr caps, #if HAVE_NUMACTL #define MAX_CPUS 4096 #define MAX_CPUS_MASK_SIZE (sizeof(unsigned long)) -#define MAX_CPUS_MASK_LEN (MAX_CPUS / MAX_CPUS_MASK_SIZE) -#define MAX_CPUS_MASK_BYTES (MAX_CPUS / 8) +#define MAX_CPUS_MASK_BITS (MAX_CPUS_MASK_SIZE * 8) +#define MAX_CPUS_MASK_LEN (MAX_CPUS / (MAX_CPUS_MASK_BITS)) #define MASK_CPU_ISSET(mask, cpu) \ - (((mask)[((cpu) / MAX_CPUS_MASK_SIZE)] >> ((cpu) % MAX_CPUS_MASK_SIZE)) & 1) + (((mask)[((cpu) / MAX_CPUS_MASK_BITS)] >> ((cpu) % MAX_CPUS_MASK_BITS)) & 1) static int qemudCapsInitNUMA(virCapsPtr caps) @@ -322,7 +323,8 @@ qemudCapsInitNUMA(virCapsPtr caps) goto cleanup; for (n = 0 ; n <= numa_max_node() ; n++) { - if (numa_node_to_cpus(n, mask, MAX_CPUS_MASK_BYTES) < 0) + + if (numa_node_to_cpus(n, mask, MAX_CPUS_MASK_LEN) < 0) goto cleanup; for (ncpus = 0, i = 0 ; i < MAX_CPUS ; i++) diff --git a/src/qemu_driver.c b/src/qemu_driver.c index 835e2bdebd..90c6b194be 100644 --- a/src/qemu_driver.c +++ b/src/qemu_driver.c @@ -45,6 +45,7 @@ #include #if HAVE_NUMACTL +#define NUMA_VERSION1_COMPATIBILITY 1 #include #endif diff --git a/src/uml_conf.c b/src/uml_conf.c index 674830d28a..7eb630dc77 100644 --- a/src/uml_conf.c +++ b/src/uml_conf.c @@ -37,6 +37,7 @@ #include #if HAVE_NUMACTL +#define NUMA_VERSION1_COMPATIBILITY 1 #include #endif @@ -56,11 +57,11 @@ #if HAVE_NUMACTL #define MAX_CPUS 4096 #define MAX_CPUS_MASK_SIZE (sizeof(unsigned long)) -#define MAX_CPUS_MASK_LEN (MAX_CPUS / MAX_CPUS_MASK_SIZE) -#define MAX_CPUS_MASK_BYTES (MAX_CPUS / 8) +#define MAX_CPUS_MASK_BITS (MAX_CPUS_MASK_SIZE * 8) +#define MAX_CPUS_MASK_LEN (MAX_CPUS / (MAX_CPUS_MASK_BITS)) #define MASK_CPU_ISSET(mask, cpu) \ - (((mask)[((cpu) / MAX_CPUS_MASK_SIZE)] >> ((cpu) % MAX_CPUS_MASK_SIZE)) & 1) + (((mask)[((cpu) / MAX_CPUS_MASK_BITS)] >> ((cpu) % MAX_CPUS_MASK_BITS)) & 1) static int umlCapsInitNUMA(virCapsPtr caps) @@ -78,7 +79,8 @@ umlCapsInitNUMA(virCapsPtr caps) goto cleanup; for (n = 0 ; n <= numa_max_node() ; n++) { - if (numa_node_to_cpus(n, mask, MAX_CPUS_MASK_BYTES) < 0) + + if (numa_node_to_cpus(n, mask, MAX_CPUS_MASK_LEN) < 0) goto cleanup; for (ncpus = 0, i = 0 ; i < MAX_CPUS ; i++) diff --git a/src/uml_driver.c b/src/uml_driver.c index d5530d9f85..337a8ea5bf 100644 --- a/src/uml_driver.c +++ b/src/uml_driver.c @@ -46,6 +46,7 @@ #include #if HAVE_NUMACTL +#define NUMA_VERSION1_COMPATIBILITY 1 #include #endif