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

Jim Meyering jim at meyering.net
Mon Dec 15 17:03:56 UTC 2008


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?


>From b78a48c7a401ecdf37de95b0b01435578ad30e12 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Fri, 12 Dec 2008 16:22:34 +0100
Subject: [PATCH] fix numa-related (and kernel-dependent) test failures

This change is required on some kernels due to the way a change in
the kernel's CONFIG_NR_CPUS propagates through the numa library.
* src/qemu_conf.c (qemudCapsInitNUMA): Pass numa_all_cpus_ptr->size/8
as the buffer-length-in-bytes in the call to numa_node_to_cpus, since
that's what is required on second and subseqent calls.
* src/uml_conf.c (umlCapsInitNUMA): Likewise.
---
 src/qemu_conf.c |    2 +-
 src/uml_conf.c  |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/qemu_conf.c b/src/qemu_conf.c
index 59171e7..206fb0b 100644
--- a/src/qemu_conf.c
+++ b/src/qemu_conf.c
@@ -324,7 +324,7 @@ qemudCapsInitNUMA(virCapsPtr caps)

     for (n = 0 ; n <= numa_max_node() ; n++) {

-        if (numa_node_to_cpus(n, mask, MAX_CPUS_MASK_LEN / 8) < 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_conf.c b/src/uml_conf.c
index 3659c6b..7eb630d 100644
--- a/src/uml_conf.c
+++ b/src/uml_conf.c
@@ -80,7 +80,7 @@ umlCapsInitNUMA(virCapsPtr caps)

     for (n = 0 ; n <= numa_max_node() ; n++) {

-        if (numa_node_to_cpus(n, mask, MAX_CPUS_MASK_LEN / 8) < 0)
+        if (numa_node_to_cpus(n, mask, MAX_CPUS_MASK_LEN) < 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