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

[Xen-devel] [RFC PATCH v2 02/25] x86: NUMA: Fix datatypes and attributes



From: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxx>

Change u{8,32,64} to uint{8,32,64}_t and bool_t to bool.
Fix attributes coding styles.
Also change memnodeshift to unsigned int.

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxx>
---
 xen/arch/x86/numa.c        | 40 +++++++++++++++++------------------
 xen/arch/x86/srat.c        | 52 +++++++++++++++++++++++-----------------------
 xen/include/asm-arm/numa.h |  2 +-
 xen/include/asm-x86/numa.h | 17 ++++++++-------
 4 files changed, 56 insertions(+), 55 deletions(-)

diff --git a/xen/arch/x86/numa.c b/xen/arch/x86/numa.c
index 8ee2302..8ed31cb 100644
--- a/xen/arch/x86/numa.c
+++ b/xen/arch/x86/numa.c
@@ -24,12 +24,12 @@ custom_param("numa", numa_setup);
 struct node_data node_data[MAX_NUMNODES];
 
 /* Mapping from pdx to node id */
-int memnode_shift;
+unsigned int memnode_shift;
 static typeof(*memnodemap) _memnodemap[64];
 unsigned long memnodemapsize;
-u8 *memnodemap;
+uint8_t *memnodemap;
 
-nodeid_t cpu_to_node[NR_CPUS] __read_mostly = {
+nodeid_t __read_mostly cpu_to_node[NR_CPUS] = {
     [0 ... NR_CPUS-1] = NUMA_NO_NODE
 };
 /*
@@ -38,11 +38,11 @@ nodeid_t cpu_to_node[NR_CPUS] __read_mostly = {
 nodeid_t apicid_to_node[MAX_LOCAL_APIC] = {
     [0 ... MAX_LOCAL_APIC-1] = NUMA_NO_NODE
 };
-cpumask_t node_to_cpumask[MAX_NUMNODES] __read_mostly;
+cpumask_t __read_mostly node_to_cpumask[MAX_NUMNODES];
 
 nodemask_t __read_mostly node_online_map = { { [0] = 1UL } };
 
-bool_t numa_off = 0;
+bool numa_off = 0;
 s8 acpi_numa = 0;
 
 int srat_disabled(void)
@@ -166,7 +166,7 @@ int __init compute_hash_shift(struct node *nodes, int 
numnodes,
     return shift;
 }
 /* initialize NODE_DATA given nodeid and start/end */
-void __init setup_node_bootmem(nodeid_t nodeid, u64 start, u64 end)
+void __init setup_node_bootmem(nodeid_t nodeid, paddr_t start, paddr_t end)
 {
     unsigned long start_pfn, end_pfn;
 
@@ -201,19 +201,19 @@ void __init numa_init_array(void)
 }
 
 #ifdef CONFIG_NUMA_EMU
-static int numa_fake __initdata = 0;
+static int __initdata numa_fake = 0;
 
 /* Numa emulation */
-static int __init numa_emulation(u64 start_pfn, u64 end_pfn)
+static int __init numa_emulation(uint64_t start_pfn, uint64_t end_pfn)
 {
     int i;
     struct node nodes[MAX_NUMNODES];
-    u64 sz = ((end_pfn - start_pfn) << PAGE_SHIFT) / numa_fake;
+    uint64_t sz = ((end_pfn - start_pfn) << PAGE_SHIFT) / numa_fake;
 
     /* Kludge needed for the hash function */
     if ( hweight64(sz) > 1 )
     {
-        u64 x = 1;
+        uint64_t x = 1;
         while ( (x << 1) < sz )
             x <<= 1;
         if ( x < sz / 2 )
@@ -260,8 +260,8 @@ void __init numa_initmem_init(unsigned long start_pfn, 
unsigned long end_pfn)
 #endif
 
 #ifdef CONFIG_ACPI_NUMA
-    if ( !numa_off && !acpi_scan_nodes((u64)start_pfn << PAGE_SHIFT,
-         (u64)end_pfn << PAGE_SHIFT) )
+    if ( !numa_off && !acpi_scan_nodes((uint64_t)start_pfn << PAGE_SHIFT,
+         (uint64_t)end_pfn << PAGE_SHIFT) )
         return;
 #endif
 
@@ -269,8 +269,8 @@ void __init numa_initmem_init(unsigned long start_pfn, 
unsigned long end_pfn)
            numa_off ? "NUMA turned off" : "No NUMA configuration found");
 
     printk(KERN_INFO "Faking a node at %016"PRIx64"-%016"PRIx64"\n",
-           (u64)start_pfn << PAGE_SHIFT,
-           (u64)end_pfn << PAGE_SHIFT);
+           (uint64_t)start_pfn << PAGE_SHIFT,
+           (uint64_t)end_pfn << PAGE_SHIFT);
     /* setup dummy node covering all memory */
     memnode_shift = BITS_PER_LONG - 1;
     memnodemap = _memnodemap;
@@ -279,8 +279,8 @@ void __init numa_initmem_init(unsigned long start_pfn, 
unsigned long end_pfn)
     for ( i = 0; i < nr_cpu_ids; i++ )
         numa_set_node(i, 0);
     cpumask_copy(&node_to_cpumask[0], cpumask_of(0));
-    setup_node_bootmem(0, (u64)start_pfn << PAGE_SHIFT,
-                    (u64)end_pfn << PAGE_SHIFT);
+    setup_node_bootmem(0, (paddr_t)start_pfn << PAGE_SHIFT,
+                    (paddr_t)end_pfn << PAGE_SHIFT);
 }
 
 void numa_add_cpu(int cpu)
@@ -294,7 +294,7 @@ void numa_set_node(int cpu, nodeid_t node)
 }
 
 /* [numa=off] */
-static __init int numa_setup(char *opt)
+static int __init numa_setup(char *opt)
 {
     if ( !strncmp(opt,"off",3) )
         numa_off = 1;
@@ -339,7 +339,7 @@ void __init init_cpu_to_node(void)
 
     for ( i = 0; i < nr_cpu_ids; i++ )
     {
-        u32 apicid = x86_cpu_to_apicid[i];
+        uint32_t apicid = x86_cpu_to_apicid[i];
         if ( apicid == BAD_APICID )
             continue;
         node = apicid < MAX_LOCAL_APIC ? apicid_to_node[apicid] : NUMA_NO_NODE;
@@ -380,7 +380,7 @@ static void dump_numa(unsigned char key)
     const struct vnuma_info *vnuma;
 
     printk("'%c' pressed -> dumping numa info (now-0x%X:%08X)\n", key,
-           (u32)(now >> 32), (u32)now);
+           (uint32_t)(now >> 32), (uint32_t)now);
 
     for_each_online_node ( i )
     {
@@ -507,7 +507,7 @@ static void dump_numa(unsigned char key)
     rcu_read_unlock(&domlist_read_lock);
 }
 
-static __init int register_numa_trigger(void)
+static int __init register_numa_trigger(void)
 {
     register_keyhandler('u', dump_numa, "dump NUMA info", 1);
     return 0;
diff --git a/xen/arch/x86/srat.c b/xen/arch/x86/srat.c
index d270b75..800a7c3 100644
--- a/xen/arch/x86/srat.c
+++ b/xen/arch/x86/srat.c
@@ -23,12 +23,12 @@
 
 static struct acpi_table_slit *__read_mostly acpi_slit;
 
-static nodemask_t memory_nodes_parsed __initdata;
-static nodemask_t processor_nodes_parsed __initdata;
-static struct node nodes[MAX_NUMNODES] __initdata;
+static nodemask_t __initdata memory_nodes_parsed;
+static nodemask_t __initdata processor_nodes_parsed;
+static struct node __initdata nodes[MAX_NUMNODES];
 
 struct pxm2node {
-       unsigned pxm;
+       unsigned int pxm;
        nodeid_t node;
 };
 static struct pxm2node __read_mostly pxm2node[MAX_NUMNODES] =
@@ -41,15 +41,15 @@ static struct node node_memblk_range[NR_NODE_MEMBLKS];
 static nodeid_t memblk_nodeid[NR_NODE_MEMBLKS];
 static __initdata DECLARE_BITMAP(memblk_hotplug, NR_NODE_MEMBLKS);
 
-static inline bool_t node_found(unsigned idx, unsigned pxm)
+static inline bool node_found(unsigned idx, unsigned pxm)
 {
        return ((pxm2node[idx].pxm == pxm) &&
                (pxm2node[idx].node != NUMA_NO_NODE));
 }
 
-nodeid_t pxm_to_node(unsigned pxm)
+nodeid_t pxm_to_node(unsigned int pxm)
 {
-       unsigned i;
+       unsigned int i;
 
        if ((pxm < ARRAY_SIZE(pxm2node)) && node_found(pxm, pxm))
                return pxm2node[pxm].node;
@@ -64,9 +64,9 @@ nodeid_t pxm_to_node(unsigned pxm)
 nodeid_t setup_node(unsigned pxm)
 {
        nodeid_t node;
-       unsigned idx;
-       static bool_t warned;
-       static unsigned nodes_found;
+       unsigned int idx;
+       static bool warned;
+       static unsigned int nodes_found;
 
        BUILD_BUG_ON(MAX_NUMNODES >= NUMA_NO_NODE);
 
@@ -103,7 +103,7 @@ nodeid_t setup_node(unsigned pxm)
        return node;
 }
 
-int valid_numa_range(u64 start, u64 end, nodeid_t node)
+int valid_numa_range(paddr_t start, paddr_t end, nodeid_t node)
 {
        int i;
 
@@ -118,7 +118,7 @@ int valid_numa_range(u64 start, u64 end, nodeid_t node)
        return 0;
 }
 
-static __init int conflicting_memblks(u64 start, u64 end)
+static int __init conflicting_memblks(paddr_t start, paddr_t end)
 {
        int i;
 
@@ -134,7 +134,7 @@ static __init int conflicting_memblks(u64 start, u64 end)
        return -1;
 }
 
-static __init void cutoff_node(int i, u64 start, u64 end)
+static void __init cutoff_node(int i, paddr_t start, paddr_t end)
 {
        struct node *nd = &nodes[i];
        if (nd->start < start) {
@@ -149,7 +149,7 @@ static __init void cutoff_node(int i, u64 start, u64 end)
        }
 }
 
-static __init void bad_srat(void)
+static void __init bad_srat(void)
 {
        int i;
        printk(KERN_ERR "SRAT: SRAT not used.\n");
@@ -167,13 +167,13 @@ static __init void bad_srat(void)
  * distance than the others.
  * Do some quick checks here and only use the SLIT if it passes.
  */
-static __init int slit_valid(struct acpi_table_slit *slit)
+static int __init slit_valid(struct acpi_table_slit *slit)
 {
        int i, j;
        int d = slit->locality_count;
        for (i = 0; i < d; i++) {
                for (j = 0; j < d; j++)  {
-                       u8 val = slit->entry[d*i + j];
+                       uint8_t val = slit->entry[d*i + j];
                        if (i == j) {
                                if (val != 10)
                                        return 0;
@@ -274,7 +274,7 @@ acpi_numa_processor_affinity_init(const struct 
acpi_srat_cpu_affinity *pa)
 void __init
 acpi_numa_memory_affinity_init(const struct acpi_srat_mem_affinity *ma)
 {
-       u64 start, end;
+       uint64_t start, end;
        unsigned pxm;
        nodeid_t node;
        int i;
@@ -311,8 +311,8 @@ acpi_numa_memory_affinity_init(const struct 
acpi_srat_mem_affinity *ma)
        if (i < 0)
                /* everything fine */;
        else if (memblk_nodeid[i] == node) {
-               bool_t mismatch = !(ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE) !=
-                                 !test_bit(i, memblk_hotplug);
+               bool mismatch = !(ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE) !=
+                               !test_bit(i, memblk_hotplug);
 
                printk("%sSRAT: PXM %u (%"PRIx64"-%"PRIx64") overlaps with 
itself (%"PRIx64"-%"PRIx64")\n",
                       mismatch ? KERN_ERR : KERN_WARNING, pxm, start, end,
@@ -401,7 +401,7 @@ static int __init nodes_cover_memory(void)
 
 void __init acpi_numa_arch_fixup(void) {}
 
-static u64 __initdata srat_region_mask;
+static uint64_t __initdata srat_region_mask;
 
 static int __init srat_parse_region(struct acpi_subtable_header *header,
                                    const unsigned long end)
@@ -428,9 +428,9 @@ static int __init srat_parse_region(struct 
acpi_subtable_header *header,
        return 0;
 }
 
-void __init srat_parse_regions(u64 addr)
+void __init srat_parse_regions(uint64_t addr)
 {
-       u64 mask;
+       uint64_t mask;
        unsigned int i;
 
        if (acpi_disabled || acpi_numa < 0 ||
@@ -453,7 +453,7 @@ void __init srat_parse_regions(u64 addr)
 }
 
 /* Use the information discovered above to actually set up the nodes. */
-int __init acpi_scan_nodes(u64 start, u64 end)
+int __init acpi_scan_nodes(uint64_t start, uint64_t end)
 {
        int i;
        nodemask_t all_nodes_parsed;
@@ -485,7 +485,7 @@ int __init acpi_scan_nodes(u64 start, u64 end)
        /* Finally register nodes */
        for_each_node_mask(i, all_nodes_parsed)
        {
-               u64 size = nodes[i].end - nodes[i].start;
+               uint64_t size = nodes[i].end - nodes[i].start;
                if ( size == 0 )
                        printk(KERN_WARNING "SRAT: Node %u has no memory. "
                               "BIOS Bug or mis-configured hardware?\n", i);
@@ -514,10 +514,10 @@ static unsigned node_to_pxm(nodeid_t n)
        return 0;
 }
 
-u8 __node_distance(nodeid_t a, nodeid_t b)
+uint8_t __node_distance(nodeid_t a, nodeid_t b)
 {
        unsigned index;
-       u8 slit_val;
+       uint8_t slit_val;
 
        if (!acpi_slit)
                return a == b ? 10 : 20;
diff --git a/xen/include/asm-arm/numa.h b/xen/include/asm-arm/numa.h
index a2c1a34..53f99af 100644
--- a/xen/include/asm-arm/numa.h
+++ b/xen/include/asm-arm/numa.h
@@ -1,7 +1,7 @@
 #ifndef __ARCH_ARM_NUMA_H
 #define __ARCH_ARM_NUMA_H
 
-typedef u8 nodeid_t;
+typedef uint8_t nodeid_t;
 
 /* Fake one node for now. See also node_online_map. */
 #define cpu_to_node(cpu) 0
diff --git a/xen/include/asm-x86/numa.h b/xen/include/asm-x86/numa.h
index da8a459..748cdfd 100644
--- a/xen/include/asm-x86/numa.h
+++ b/xen/include/asm-x86/numa.h
@@ -5,7 +5,7 @@
 
 #define NODES_SHIFT 6
 
-typedef u8 nodeid_t;
+typedef uint8_t nodeid_t;
 
 extern int srat_rev;
 
@@ -18,7 +18,8 @@ extern cpumask_t     node_to_cpumask[];
 #define node_to_cpumask(node)    (node_to_cpumask[node])
 
 struct node {
-    u64 start,end;
+    paddr_t start;
+    paddr_t end;
 };
 
 extern int compute_hash_shift(struct node *nodes, int numnodes,
@@ -37,13 +38,13 @@ extern void numa_set_node(int cpu, nodeid_t node);
 extern nodeid_t setup_node(unsigned int pxm);
 extern void srat_detect_node(int cpu);
 
-extern void setup_node_bootmem(nodeid_t nodeid, u64 start, u64 end);
+extern void setup_node_bootmem(nodeid_t nodeid, paddr_t start, paddr_t end);
 extern nodeid_t apicid_to_node[];
 extern void init_cpu_to_node(void);
 
 /* Simple perfect hash to map pdx to node numbers */
-extern int memnode_shift;
-extern u8 *memnodemap;
+extern unsigned int memnode_shift;
+extern uint8_t *memnodemap;
 
 struct node_data {
     unsigned long node_start_pfn;
@@ -64,10 +65,10 @@ static inline __attribute__((pure)) nodeid_t 
phys_to_nid(paddr_t addr)
 #define node_end_pfn(nid)       (NODE_DATA(nid)->node_start_pfn + \
                                  NODE_DATA(nid)->node_spanned_pages)
 
-extern int valid_numa_range(u64 start, u64 end, nodeid_t node);
+extern int valid_numa_range(paddr_t start, paddr_t end, nodeid_t node);
 
-void srat_parse_regions(u64 addr);
-extern u8 __node_distance(nodeid_t a, nodeid_t b);
+void srat_parse_regions(uint64_t addr);
+extern uint8_t __node_distance(nodeid_t a, nodeid_t b);
 unsigned int arch_get_dma_bitsize(void);
 
 #endif
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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