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@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
Andrew Cooper committed 2019-07-31 14:19:07 +01:00
1 parent c1e80a0163
commit 810227b109
3 files changed
+13 -6

No files matched your search

+2 -2
View File
@@ -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);
}
+1 -1
View File
@@ -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);
+10 -3
View File
@@ -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); \
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.