]> xenbits.xensource.com Git - people/sstabellini/xen-unstable.git/.git/commitdiff
xen/mask: Convert {cpu,node}mask_test() to be static inline
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 25 Jun 2019 09:48:22 +0000 (10:48 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 31 Jul 2019 13:18:45 +0000 (14:18 +0100)
The buggy version of GCC isn't supported by Xen, so reimplement the helpers
with type checking, using Xen's latest type expectations.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/srat.c
xen/common/page_alloc.c
xen/include/xen/cpumask.h
xen/include/xen/nodemask.h

index 47a42672208531eeef52f812d4207a9fbe5b99a0..506a56d66bd704dacea92c1ec2842161a1da21af 100644 (file)
@@ -495,7 +495,7 @@ int __init acpi_scan_nodes(u64 start, u64 end)
        for (i = 0; i < nr_cpu_ids; i++) {
                if (cpu_to_node[i] == NUMA_NO_NODE)
                        continue;
-               if (!node_isset(cpu_to_node[i], processor_nodes_parsed))
+               if (!nodemask_test(cpu_to_node[i], &processor_nodes_parsed))
                        numa_set_node(i, NUMA_NO_NODE);
        }
        numa_init_array();
index 4b16ef0d543487d45a2062dcbe2e3d3ade6aef5a..b29c070c3da4044c87e968cb366f44693774990a 100644 (file)
@@ -887,7 +887,7 @@ static struct page_info *get_free_buddy(unsigned int zone_lo,
             return NULL;
 
         /* Pick next node. */
-        if ( !node_isset(node, nodemask) )
+        if ( !nodemask_test(node, &nodemask) )
         {
             /* Very first node may be caller-specified and outside nodemask. */
             ASSERT(!nodemask_retry);
index 9448f5c6f8b1c3c9fcd4d0605a72db0d76fcf7f6..ae902275c83061683d76b8eba0ae613e4cb3674e 100644 (file)
@@ -14,7 +14,7 @@
  * void cpumask_clear_cpu(cpu, mask)   turn off bit 'cpu' in mask
  * void cpumask_setall(mask)           set all bits
  * void cpumask_clear(mask)            clear all bits
- * int cpumask_test_cpu(cpu, mask)     true iff bit 'cpu' set in mask
+ * bool cpumask_test_cpu(cpu, mask)    true iff bit 'cpu' set in mask
  * int cpumask_test_and_set_cpu(cpu, mask) test and set bit 'cpu' in mask
  * int cpumask_test_and_clear_cpu(cpu, mask) test and clear bit 'cpu' in mask
  *
  * for_each_possible_cpu(cpu)          for-loop cpu over cpu_possible_map
  * for_each_online_cpu(cpu)            for-loop cpu over cpu_online_map
  * for_each_present_cpu(cpu)           for-loop cpu over cpu_present_map
- *
- * Subtlety:
- * 1) The 'type-checked' form of cpumask_test_cpu() causes gcc (3.3.2, anyway)
- *    to generate slightly worse code.  Note for example the additional
- *    40 lines of assembly code compiling the "for each possible cpu"
- *    loops buried in the disk_stat_read() macros calls when compiling
- *    drivers/block/genhd.c (arch i386, CONFIG_SMP=y).  So use a simple
- *    one-line #define for cpumask_test_cpu(), instead of wrapping an inline
- *    inside a macro, the way we do the other calls.
  */
 
 #include <xen/bitmap.h>
@@ -117,9 +108,10 @@ static inline void cpumask_clear(cpumask_t *dstp)
        bitmap_zero(dstp->bits, nr_cpumask_bits);
 }
 
-/* No static inline type checking - see Subtlety (1) above. */
-#define cpumask_test_cpu(cpu, cpumask) \
-       test_bit(cpumask_check(cpu), (cpumask)->bits)
+static inline bool cpumask_test_cpu(unsigned int cpu, const cpumask_t *src)
+{
+    return test_bit(cpumask_check(cpu), src->bits);
+}
 
 static inline int cpumask_test_and_set_cpu(int cpu, volatile cpumask_t *addr)
 {
index c28dd3c768d8c5c7589451934090bbe0ba251d1e..7ab8b794c6018c8b9124ee0199d0ba5ec5df7766 100644 (file)
@@ -14,7 +14,7 @@
  * void node_clear(node, mask)         turn off bit 'node' in mask
  * void nodes_setall(mask)             set all bits
  * void nodes_clear(mask)              clear all bits
- * int node_isset(node, mask)          true iff bit 'node' set in mask
+ * bool nodemask_test(node, mask)      true iff bit 'node' set in mask
  * int node_test_and_set(node, mask)   test and set bit 'node' in mask
  *
  * void nodes_and(dst, src1, src2)     dst = src1 & src2  [intersection]
  *
  * int num_online_nodes()              Number of online Nodes
  *
- * int node_online(node)               Is some node online?
+ * bool node_online(node)              Is this node online?
  *
  * node_set_online(node)               set bit 'node' in node_online_map
  * node_set_offline(node)              clear bit 'node' in node_online_map
  *
  * for_each_online_node(node)          for-loop node over node_online_map
- *
- * Subtlety:
- * 1) The 'type-checked' form of node_isset() causes gcc (3.3.2, anyway)
- *    to generate slightly worse code.  So use a simple one-line #define
- *    for node_isset(), instead of wrapping an inline inside a macro, the
- *    way we do the other calls.
  */
 
 #include <xen/kernel.h>
@@ -90,8 +84,10 @@ static inline void __nodes_clear(nodemask_t *dstp, int nbits)
        bitmap_zero(dstp->bits, nbits);
 }
 
-/* No static inline type checking - see Subtlety (1) above. */
-#define node_isset(node, nodemask) test_bit((node), (nodemask).bits)
+static inline bool nodemask_test(unsigned int node, const nodemask_t *dst)
+{
+    return test_bit(node, dst->bits);
+}
 
 #define node_test_and_set(node, nodemask) \
                        __node_test_and_set((node), &(nodemask))
@@ -276,7 +272,7 @@ extern nodemask_t node_online_map;
 
 #if MAX_NUMNODES > 1
 #define num_online_nodes()     nodes_weight(node_online_map)
-#define node_online(node)      node_isset((node), node_online_map)
+#define node_online(node)      nodemask_test(node, &node_online_map)
 #else
 #define num_online_nodes()     1
 #define node_online(node)      ((node) == 0)