[libvirt] [PATCH] fix numa-related (and kernel-dependent) test failures

Jim Meyering jim at meyering.net
Mon Dec 15 17:10:45 UTC 2008


Jim Meyering <jim at meyering.net> wrote:
> Following up on this thread,
>
>     http://thread.gmane.org/gmane.comp.emulators.libvirt/10402
>
> Here's a patch that appears to work for kernels before
> and after the CONFIG_NR_CPUS change.  I've tested it via
> a small stand-alone program on both kernels, but via libvirt
> only on rawhide.
>
> Dave, can you confirm the tests pass for you on the 2.6.27.x-based kernel?

Whoops.  That was the wrong patch.
Here's the patch I intended:

>From e7dce174d5bc7f4097125e9bbc14dc0fa2518355 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Mon, 15 Dec 2008 17:53:32 +0100
Subject: [PATCH] .

---
 src/qemu_conf.c |    4 ++--
 src/uml_conf.c  |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/qemu_conf.c b/src/qemu_conf.c
index 59171e7..312f646 100644
--- a/src/qemu_conf.c
+++ b/src/qemu_conf.c
@@ -323,8 +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_LEN / 8) < 0)
+        int mask_n_bytes = numa_all_cpus_ptr->size / 8;
+        if (numa_node_to_cpus(n, mask, mask_n_bytes) < 0)
             goto cleanup;

         for (ncpus = 0, i = 0 ; i < MAX_CPUS ; i++)
diff --git a/src/uml_conf.c b/src/uml_conf.c
index 3659c6b..00adf27 100644
--- a/src/uml_conf.c
+++ b/src/uml_conf.c
@@ -79,8 +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_LEN / 8) < 0)
+        int mask_n_bytes = numa_all_cpus_ptr->size / 8;
+        if (numa_node_to_cpus(n, mask, mask_n_bytes) < 0)
             goto cleanup;

         for (ncpus = 0, i = 0 ; i < MAX_CPUS ; i++)
--
1.6.1.rc2.316.geb2f0




More information about the libvir-list mailing list