[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen staging] xen/nodemask: Introduce a NODEMASK_PR() wrapper for printing



commit 810227b1090224a2b7a5ca910c417f385808e4c8
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Tue Jun 25 10:48:22 2019 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Wed Jul 31 14:19:07 2019 +0100

    xen/nodemask: Introduce a NODEMASK_PR() wrapper for printing
    
    Rework nodes_addr() into nodemask_bits() and change the indirection to match
    its cpumask_bits() counterpart, and update the caller.
    
    Use NODEMASK_PR() to fix up one opencoded access into nodemask.bits in
    dump_domains().
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/common/domctl.c        |  4 ++--
 xen/common/keyhandler.c    |  2 +-
 xen/include/xen/nodemask.h | 13 ++++++++++---
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index 3d937434af..b48e408583 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -123,14 +123,14 @@ int xenctl_bitmap_to_cpumask(cpumask_var_t *cpumask,
 static int nodemask_to_xenctl_bitmap(struct xenctl_bitmap *xenctl_nodemap,
                                      const nodemask_t *nodemask)
 {
-    return bitmap_to_xenctl_bitmap(xenctl_nodemap, nodes_addr(*nodemask),
+    return bitmap_to_xenctl_bitmap(xenctl_nodemap, nodemask_bits(nodemask),
                                    MAX_NUMNODES);
 }
 
 static int xenctl_bitmap_to_nodemask(nodemask_t *nodemask,
                                      const struct xenctl_bitmap 
*xenctl_nodemap)
 {
-    return xenctl_bitmap_to_bitmap(nodes_addr(*nodemask), xenctl_nodemap,
+    return xenctl_bitmap_to_bitmap(nodemask_bits(nodemask), xenctl_nodemap,
                                    MAX_NUMNODES);
 }
 
diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c
index a5e95e2fe9..57b360ee4b 100644
--- a/xen/common/keyhandler.c
+++ b/xen/common/keyhandler.c
@@ -293,7 +293,7 @@ static void dump_domains(unsigned char key)
         dump_pageframe_info(d);
 
         printk("NODE affinity for domain %d: [%*pbl]\n",
-               d->domain_id, MAX_NUMNODES, d->node_affinity.bits);
+               d->domain_id, NODEMASK_PR(&d->node_affinity));
 
         printk("VCPU information and callbacks for domain %u:\n",
                d->domain_id);
diff --git a/xen/include/xen/nodemask.h b/xen/include/xen/nodemask.h
index 7ab8b794c6..1dd6c7458e 100644
--- a/xen/include/xen/nodemask.h
+++ b/xen/include/xen/nodemask.h
@@ -39,7 +39,7 @@
  * nodemask_t nodemask_of_node(node)   Return nodemask with bit 'node' set
  * NODE_MASK_ALL                       Initializer - all bits set
  * NODE_MASK_NONE                      Initializer - no bits set
- * unsigned long *nodes_addr(mask)     Array of unsigned long's in mask
+ * unsigned long *nodemask_bits(mask)  Array of unsigned long's in mask
  *
  * for_each_node_mask(node, mask)      for-loop node over mask
  *
@@ -58,6 +58,15 @@
 #include <xen/numa.h>
 
 typedef struct { DECLARE_BITMAP(bits, MAX_NUMNODES); } nodemask_t;
+
+/*
+ * printf arguments for a nodemask.  Shorthand for using '%*pb[l]' when
+ * printing a nodemask.
+ */
+#define NODEMASK_PR(src) MAX_NUMNODES, nodemask_bits(src)
+
+#define nodemask_bits(src) ((src)->bits)
+
 extern nodemask_t _unused_nodemask_arg_;
 
 #define node_set(node, dst) __node_set((node), &(dst))
@@ -250,8 +259,6 @@ static inline int __cycle_node(int n, const nodemask_t 
*maskp, int nbits)
        [0 ... BITS_TO_LONGS(MAX_NUMNODES)-1] =  0UL                    \
 } })
 
-#define nodes_addr(src) ((src).bits)
-
 #if MAX_NUMNODES > 1
 #define for_each_node_mask(node, mask)                 \
        for ((node) = first_node(mask);                 \
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.