Skip to contentSkip to conversation

NUMA fixes, 2017-05-30

GIT PULL Applied Eduardo Habkost 2 participants 4 messages May 30, 2017 – Jun 1, 2017

lore
Share & tools
lore
#0 lore raw

The following changes since commit 0748b3526e8cb78b9cd64208426bfc3d54a72b04:

Merge remote-tracking branch 'kwolf/tags/for-upstream' into staging (2017-05-30 14:15:15 +0100)

are available in the git repository at:

git://github.com/ehabkost/qemu.git tags/numa-pull-request

for you to fetch changes up to f892291eee376505cfec8b6cade7ccf952a6d3e0:

numa: Fix format string for "Invalid node" message (2017-05-30 16:09:58 -0300)

----------------------------------------------------------------
NUMA fixes, 2017-05-30

----------------------------------------------------------------

Eduardo Habkost (1):
numa: Fix format string for "Invalid node" message

Marc-André Lureau (1):
numa-test: fix query-cpus leaks

 numa.c            |  3 +--
 tests/numa-test.c | 14 +++++++++-----
 2 files changed, 10 insertions(+), 7 deletions(-)
Signature · 1 line
2.11.0.259.g40922b1
#1 lore raw

[Qemu-devel] [PULL 1/2] numa-test: fix query-cpus leaks

From: Marc-André Lureau <[email protected]>

Fix test leaks introduced in commit 2941020a476.

(and small extra space removed)

Spotted by ASAN.

Message-Id: <[email protected]>

---
 tests/numa-test.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
tests/numa-test.c +9 -5
index c3475d6d5e..3f636840b1 100644
@@ -92,7 +92,7 @@ static QList *get_cpus(QDict **resp)
     *resp = qmp("{ 'execute': 'query-cpus' }");
     g_assert(*resp);
     g_assert(qdict_haskey(*resp, "return"));
-    return  qdict_get_qlist(*resp, "return");
+    return qdict_get_qlist(*resp, "return");
 }
 
 static void test_query_cpus(const void *data)
@@ -100,7 +100,7 @@ static void test_query_cpus(const void *data)
     char *cli;
     QDict *resp;
     QList *cpus;
-    const QObject *e;
+    QObject *e;
 
     cli = make_cli(data, "-smp 8 -numa node,cpus=0-3 -numa node,cpus=4-7");
     qtest_start(cli);
@@ -124,6 +124,7 @@ static void test_query_cpus(const void *data)
         } else {
             g_assert_cmpint(node, ==, 1);
         }
+        qobject_decref(e);
     }
 
     QDECREF(resp);
@@ -136,7 +137,7 @@ static void pc_numa_cpu(const void *data)
     char *cli;
     QDict *resp;
     QList *cpus;
-    const QObject *e;
+    QObject *e;
 
     cli = make_cli(data, "-cpu pentium -smp 8,sockets=2,cores=2,threads=2 "
         "-numa node,nodeid=0 -numa node,nodeid=1 "
@@ -176,6 +177,7 @@ static void pc_numa_cpu(const void *data)
         } else {
             g_assert(false);
         }
+        qobject_decref(e);
     }
 
     QDECREF(resp);
@@ -188,7 +190,7 @@ static void spapr_numa_cpu(const void *data)
     char *cli;
     QDict *resp;
     QList *cpus;
-    const QObject *e;
+    QObject *e;
 
     cli = make_cli(data, "-smp 4,cores=4 "
         "-numa node,nodeid=0 -numa node,nodeid=1 "
@@ -220,6 +222,7 @@ static void spapr_numa_cpu(const void *data)
         } else {
             g_assert(false);
         }
+        qobject_decref(e);
     }
 
     QDECREF(resp);
@@ -232,7 +235,7 @@ static void aarch64_numa_cpu(const void *data)
     char *cli;
     QDict *resp;
     QList *cpus;
-    const QObject *e;
+    QObject *e;
 
     cli = make_cli(data, "-smp 2 "
         "-numa node,nodeid=0 -numa node,nodeid=1 "
@@ -262,6 +265,7 @@ static void aarch64_numa_cpu(const void *data)
         } else {
             g_assert(false);
         }
+        qobject_decref(e);
     }
 
     QDECREF(resp);
Signature · 1 line
2.11.0.259.g40922b1
#2 lore raw

[Qemu-devel] [PULL 2/2] numa: Fix format string for "Invalid node" message

In reply to Eduardo Habkost

Some compilers complain about the PRIu16 format string with the MAX(src, dst) and MAX_NODES arguments. Example output from Apple LLVM version 7.3.0 (clang-703.0.31):

numa.c:236:20: warning: format specifies type 'unsigned short' but the argument has type 'int' [-Wformat]

                     MAX(src, dst), MAX_NODES);
  ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
  include/qapi/error.h:163:35: note: expanded from macro 'error_setg'
                          (fmt), ## __VA_ARGS__)
                                    ^~~~~~~~~~~
  glib/2.52.2/include/glib-2.0/glib/gmacros.h:288:20: note: expanded from macro 'MAX'
  #define MAX(a, b)  (((a) > (b)) ? (a) : (b))
                     ^~~~~~~~~~~~~~~~~~~~~~~~~
  numa.c:236:35: warning: format specifies type 'unsigned short' but the argument has type 'int' [-Wformat]
                     MAX(src, dst), MAX_NODES);
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
  include/qapi/error.h:163:35: note: expanded from macro 'error_setg'
                          (fmt), ## __VA_ARGS__)
                                    ^~~~~~~~~~~
  include/sysemu/sysemu.h:165:19: note: expanded from macro 'MAX_NODES'
  #define MAX_NODES 128
                    ^~~

MAX(src, dst) promotes the src and dst arguments to int, and MAX_NODES is an int. Use %d to silence those warnings.

Message-Id: <[email protected]>

---
 numa.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
numa.c +1 -2
index ca731455e9..be50c62aa9 100644
@@ -231,8 +231,7 @@ static void parse_numa_distance(NumaDistOptions *dist, Error **errp)
 
     if (src >= MAX_NODES || dst >= MAX_NODES) {
         error_setg(errp,
-                   "Invalid node %" PRIu16
-                   ", max possible could be %" PRIu16,
+                   "Invalid node %d, max possible could be %d",
                    MAX(src, dst), MAX_NODES);
         return;
     }
Signature · 1 line
2.11.0.259.g40922b1
#3 lore raw
In reply to Eduardo Habkost
Quoted 20 lines · Eduardo Habkost

The following changes since commit 0748b3526e8cb78b9cd64208426bfc3d54a72b04:

Merge remote-tracking branch 'kwolf/tags/for-upstream' into staging (2017-05-30 14:15:15 +0100)

are available in the git repository at:

git://github.com/ehabkost/qemu.git tags/numa-pull-request

for you to fetch changes up to f892291eee376505cfec8b6cade7ccf952a6d3e0:

numa: Fix format string for "Invalid node" message (2017-05-30 16:09:58 -0300)

----------------------------------------------------------------
NUMA fixes, 2017-05-30

----------------------------------------------------------------

Eduardo Habkost (1):
numa: Fix format string for "Invalid node" message

Quoted 6 lines

Marc-André Lureau (1):
numa-test: fix query-cpus leaks

 numa.c            |  3 +--
 tests/numa-test.c | 14 +++++++++-----
 2 files changed, 10 insertions(+), 7 deletions(-)

Applied, thanks.

-- PMM