From: vijay.kilari@gmail.com
To: xen-devel@lists.xen.org
Cc: sstabellini@kernel.org, wei.liu2@citrix.com,
George.Dunlap@eu.citrix.com, andrew.cooper3@citrix.com,
ian.jackson@eu.citrix.com, tim@xen.org, julien.grall@arm.com,
jbeulich@suse.com, Vijaya Kumar K <Vijaya.Kumar@cavium.com>
Subject: [RFC PATCH v2 02/25] x86: NUMA: Fix datatypes and attributes
Date: Tue, 28 Mar 2017 21:23:10 +0530 [thread overview]
Message-ID: <1490716413-19796-3-git-send-email-vijay.kilari@gmail.com> (raw)
In-Reply-To: <1490716413-19796-1-git-send-email-vijay.kilari@gmail.com>
From: Vijaya Kumar K <Vijaya.Kumar@cavium.com>
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@cavium.com>
---
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@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-03-28 15:53 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-28 15:53 [RFC PATCH v2 00/25] ARM: Add Xen NUMA support vijay.kilari
2017-03-28 15:53 ` [RFC PATCH v2 01/25] x86: NUMA: Clean up: Drop trailing spaces vijay.kilari
2017-03-28 16:44 ` Wei Liu
2017-05-31 10:20 ` Jan Beulich
2017-05-31 10:21 ` Jan Beulich
2017-03-28 15:53 ` vijay.kilari [this message]
2017-03-28 16:44 ` [RFC PATCH v2 02/25] x86: NUMA: Fix datatypes and attributes Wei Liu
2017-05-31 10:35 ` Jan Beulich
2017-03-28 15:53 ` [RFC PATCH v2 03/25] x86: NUMA: Rename and sanitize some common functions vijay.kilari
2017-06-30 14:05 ` Jan Beulich
2017-07-11 10:16 ` Vijay Kilari
2017-03-28 15:53 ` [RFC PATCH v2 04/25] x86: NUMA: Add accessors for acpi_numa, numa_off and numa_fake variables vijay.kilari
2017-04-20 15:59 ` Julien Grall
2017-04-25 6:54 ` Vijay Kilari
2017-04-25 12:04 ` Julien Grall
2017-04-25 12:20 ` Vijay Kilari
2017-04-25 12:28 ` Julien Grall
2017-04-25 14:54 ` Vijay Kilari
2017-04-25 15:14 ` Julien Grall
2017-04-25 15:43 ` Jan Beulich
2017-05-02 9:47 ` Vijay Kilari
2017-05-02 9:54 ` Jan Beulich
2017-05-08 17:38 ` Julien Grall
2017-06-30 14:07 ` Jan Beulich
2017-03-28 15:53 ` [RFC PATCH v2 05/25] x86: NUMA: Move generic dummy_numa_init to separate function vijay.kilari
2017-04-20 16:12 ` Julien Grall
2017-04-25 6:59 ` Vijay Kilari
2017-06-30 14:08 ` Jan Beulich
2017-03-28 15:53 ` [RFC PATCH v2 06/25] x86: NUMA: Add accessors for nodes[] and node_memblk_range[] structs vijay.kilari
2017-05-08 14:39 ` Julien Grall
2017-05-09 7:02 ` Vijay Kilari
2017-05-09 8:13 ` Julien Grall
2017-03-28 15:53 ` [RFC PATCH v2 07/25] x86: NUMA: Rename some generic functions vijay.kilari
2017-03-28 15:53 ` [RFC PATCH v2 08/25] x86: NUMA: Sanitize node distance vijay.kilari
2017-03-28 15:53 ` [RFC PATCH v2 09/25] ARM: NUMA: Add existing ARM numa code under CONFIG_NUMA vijay.kilari
2017-05-08 15:58 ` Julien Grall
2017-05-09 7:14 ` Vijay Kilari
2017-05-09 8:21 ` Julien Grall
2017-03-28 15:53 ` [RFC PATCH v2 10/25] x86: NUMA: Move numa code and make it generic vijay.kilari
2017-05-08 16:41 ` Julien Grall
2017-05-09 7:36 ` Vijay Kilari
2017-05-09 8:23 ` Julien Grall
2017-05-08 16:51 ` Julien Grall
2017-05-09 7:39 ` Vijay Kilari
2017-05-09 8:26 ` Julien Grall
2017-03-28 15:53 ` [RFC PATCH v2 11/25] x86: NUMA: Move common code from srat.c vijay.kilari
2017-05-08 17:06 ` Julien Grall
2017-05-10 9:00 ` Vijay Kilari
2017-03-28 15:53 ` [RFC PATCH v2 12/25] ARM: NUMA: Parse CPU NUMA information vijay.kilari
2017-05-08 17:31 ` Julien Grall
2017-05-10 5:24 ` Vijay Kilari
2017-05-10 8:52 ` Julien Grall
2017-03-28 15:53 ` [RFC PATCH v2 13/25] ARM: NUMA: Parse memory " vijay.kilari
2017-03-28 15:53 ` [RFC PATCH v2 14/25] ARM: NUMA: Parse NUMA distance information vijay.kilari
2017-03-28 15:53 ` [RFC PATCH v2 15/25] ARM: NUMA: Add CPU NUMA support vijay.kilari
2017-03-28 15:53 ` [RFC PATCH v2 16/25] ARM: NUMA: Add memory " vijay.kilari
2017-03-28 15:53 ` [RFC PATCH v2 17/25] ARM: NUMA: Add fallback on NUMA failure vijay.kilari
2017-03-28 15:53 ` [RFC PATCH v2 18/25] ARM: NUMA: Do not expose numa info to DOM0 vijay.kilari
2017-03-28 15:53 ` [RFC PATCH v2 19/25] ACPI: Refactor acpi SRAT and SLIT table handling code vijay.kilari
2017-03-28 15:53 ` [RFC PATCH v2 20/25] ARM: NUMA: Extract MPIDR from MADT table vijay.kilari
2017-03-28 15:53 ` [RFC PATCH v2 21/25] ACPI: Move arch specific SRAT parsing vijay.kilari
2017-03-28 15:53 ` [RFC PATCH v2 22/25] ARM: NUMA: Extract proximity from SRAT table vijay.kilari
2017-03-28 15:53 ` [RFC PATCH v2 23/25] ARM: NUMA: Initialize ACPI NUMA vijay.kilari
2017-03-28 15:53 ` [RFC PATCH v2 24/25] NUMA: Move CONFIG_NUMA to common Kconfig vijay.kilari
2017-05-31 10:04 ` Jan Beulich
2017-05-31 10:18 ` Julien Grall
2017-05-31 10:37 ` Jan Beulich
2017-06-15 7:52 ` Vijay Kilari
2017-06-15 9:00 ` Julien Grall
2017-03-28 15:53 ` [RFC PATCH v2 25/25] NUMA: Enable ACPI_NUMA config vijay.kilari
2017-05-31 10:05 ` Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1490716413-19796-3-git-send-email-vijay.kilari@gmail.com \
--to=vijay.kilari@gmail.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=Vijaya.Kumar@cavium.com \
--cc=andrew.cooper3@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=julien.grall@arm.com \
--cc=sstabellini@kernel.org \
--cc=tim@xen.org \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).