From: vijay.kilari@gmail.com
To: xen-devel@lists.xen.org
Cc: kevin.tian@intel.com, sstabellini@kernel.org,
wei.liu2@citrix.com, George.Dunlap@eu.citrix.com,
andrew.cooper3@citrix.com, dario.faggioli@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 v3 02/24] x86: NUMA: Clean up: Fix coding styles and drop unused code
Date: Tue, 18 Jul 2017 17:11:24 +0530 [thread overview]
Message-ID: <1500378106-2620-3-git-send-email-vijay.kilari@gmail.com> (raw)
In-Reply-To: <1500378106-2620-1-git-send-email-vijay.kilari@gmail.com>
From: Vijaya Kumar K <Vijaya.Kumar@cavium.com>
Fix coding style, trailing spaces, tabs in NUMA code.
Also drop unused macros and functions.
There is no functional change.
Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@cavium.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
---
v3: - Change commit message
- Changed VIRTUAL_BUG_ON to ASSERT
- Dropped useless inner paranthesis for some macros
---
xen/arch/x86/numa.c | 55 +++++++++++++++++++++------------------------
xen/arch/x86/srat.c | 2 +-
xen/include/asm-x86/numa.h | 56 +++++++++++++++++++++++-----------------------
xen/include/xen/numa.h | 3 ---
4 files changed, 54 insertions(+), 62 deletions(-)
diff --git a/xen/arch/x86/numa.c b/xen/arch/x86/numa.c
index d45196fa..444d7ad 100644
--- a/xen/arch/x86/numa.c
+++ b/xen/arch/x86/numa.c
@@ -1,8 +1,8 @@
-/*
+/*
* Generic VM initialization for x86-64 NUMA setups.
* Copyright 2002,2003 Andi Kleen, SuSE Labs.
* Adapted for Xen: Ryan Harper <ryanh@us.ibm.com>
- */
+ */
#include <xen/mm.h>
#include <xen/string.h>
@@ -21,13 +21,6 @@
static int numa_setup(char *s);
custom_param("numa", numa_setup);
-#ifndef Dprintk
-#define Dprintk(x...)
-#endif
-
-/* from proto.h */
-#define round_up(x,y) ((((x)+(y))-1) & (~((y)-1)))
-
struct node_data node_data[MAX_NUMNODES];
/* Mapping from pdx to node id */
@@ -144,8 +137,9 @@ static int __init extract_lsb_from_nodes(const struct node *nodes,
if ( nodes_used <= 1 )
i = BITS_PER_LONG - 1;
else
- i = find_first_bit(&bitfield, sizeof(unsigned long)*8);
+ i = find_first_bit(&bitfield, sizeof(unsigned long) * 8);
memnodemapsize = (memtop >> i) + 1;
+
return i;
}
@@ -173,7 +167,7 @@ int __init compute_hash_shift(struct node *nodes, int numnodes,
}
/* initialize NODE_DATA given nodeid and start/end */
void __init setup_node_bootmem(nodeid_t nodeid, u64 start, u64 end)
-{
+{
unsigned long start_pfn, end_pfn;
start_pfn = start >> PAGE_SHIFT;
@@ -183,7 +177,7 @@ void __init setup_node_bootmem(nodeid_t nodeid, u64 start, u64 end)
NODE_DATA(nodeid)->node_spanned_pages = end_pfn - start_pfn;
node_set_online(nodeid);
-}
+}
void __init numa_init_array(void)
{
@@ -214,7 +208,7 @@ static int __init numa_emulation(u64 start_pfn, u64 end_pfn)
{
int i;
struct node nodes[MAX_NUMNODES];
- u64 sz = ((end_pfn - start_pfn)<<PAGE_SHIFT) / numa_fake;
+ u64 sz = ((end_pfn - start_pfn) << PAGE_SHIFT) / numa_fake;
/* Kludge needed for the hash function */
if ( hweight64(sz) > 1 )
@@ -222,21 +216,22 @@ static int __init numa_emulation(u64 start_pfn, u64 end_pfn)
u64 x = 1;
while ( (x << 1) < sz )
x <<= 1;
- if ( x < sz/2 )
- printk(KERN_ERR "Numa emulation unbalanced. Complain to maintainer\n");
+ if ( x < sz / 2 )
+ printk(KERN_ERR
+ "Numa emulation unbalanced. Complain to maintainer\n");
sz = x;
}
memset(&nodes,0,sizeof(nodes));
for ( i = 0; i < numa_fake; i++ )
{
- nodes[i].start = (start_pfn<<PAGE_SHIFT) + i*sz;
+ nodes[i].start = (start_pfn << PAGE_SHIFT) + i * sz;
if ( i == numa_fake - 1 )
- sz = (end_pfn<<PAGE_SHIFT) - nodes[i].start;
+ sz = (end_pfn << PAGE_SHIFT) - nodes[i].start;
nodes[i].end = nodes[i].start + sz;
- printk(KERN_INFO "Faking node %d at %"PRIx64"-%"PRIx64" (%"PRIu64"MB)\n",
- i,
- nodes[i].start, nodes[i].end,
+ printk(KERN_INFO
+ "Faking node %d at %"PRIx64"-%"PRIx64" (%"PRIu64"MB)\n",
+ i, nodes[i].start, nodes[i].end,
(nodes[i].end - nodes[i].start) >> 20);
node_set_online(i);
}
@@ -256,7 +251,7 @@ static int __init numa_emulation(u64 start_pfn, u64 end_pfn)
#endif
void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
-{
+{
int i;
#ifdef CONFIG_NUMA_EMU
@@ -291,7 +286,7 @@ void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
void numa_add_cpu(int cpu)
{
cpumask_set_cpu(cpu, &node_to_cpumask[cpu_to_node(cpu)]);
-}
+}
void numa_set_node(int cpu, nodeid_t node)
{
@@ -299,23 +294,23 @@ void numa_set_node(int cpu, nodeid_t node)
}
/* [numa=off] */
-static __init int numa_setup(char *opt)
-{
- if ( !strncmp(opt,"off",3) )
+static __init int numa_setup(char *opt)
+{
+ if ( !strncmp(opt, "off", 3) )
numa_off = true;
- if ( !strncmp(opt,"on",2) )
+ if ( !strncmp(opt, "on", 2) )
numa_off = false;
#ifdef CONFIG_NUMA_EMU
if ( !strncmp(opt, "fake=", 5) )
{
numa_off = false;
- numa_fake = simple_strtoul(opt+5,NULL,0);
+ numa_fake = simple_strtoul(opt + 5, NULL, 0);
if ( numa_fake >= MAX_NUMNODES )
numa_fake = MAX_NUMNODES;
}
#endif
#ifdef CONFIG_ACPI_NUMA
- if ( !strncmp(opt,"noacpi",6) )
+ if ( !strncmp(opt,"noacpi", 6) )
{
numa_off = false;
acpi_numa = -1;
@@ -323,7 +318,7 @@ static __init int numa_setup(char *opt)
#endif
return 1;
-}
+}
/*
* Setup early cpu_to_node.
@@ -385,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);
+ (u32)(now >> 32), (u32)now);
for_each_online_node ( i )
{
diff --git a/xen/arch/x86/srat.c b/xen/arch/x86/srat.c
index cd1283e..ec08112 100644
--- a/xen/arch/x86/srat.c
+++ b/xen/arch/x86/srat.c
@@ -7,7 +7,7 @@
* Called from acpi_numa_init while reading the SRAT and SLIT tables.
* Assumes all memory regions belonging to a single proximity domain
* are in one chunk. Holes between them will be included in the node.
- *
+ *
* Adapted for Xen: Ryan Harper <ryanh@us.ibm.com>
*/
diff --git a/xen/include/asm-x86/numa.h b/xen/include/asm-x86/numa.h
index 3cf26c2..c0de57b 100644
--- a/xen/include/asm-x86/numa.h
+++ b/xen/include/asm-x86/numa.h
@@ -1,8 +1,11 @@
-#ifndef _ASM_X8664_NUMA_H
+#ifndef _ASM_X8664_NUMA_H
#define _ASM_X8664_NUMA_H 1
#include <xen/cpumask.h>
+#define MAX_NUMNODES NR_NODES
+#define NR_NODE_MEMBLKS (MAX_NUMNODES * 2)
+
typedef u8 nodeid_t;
extern int srat_rev;
@@ -10,21 +13,21 @@ extern int srat_rev;
extern nodeid_t cpu_to_node[NR_CPUS];
extern cpumask_t node_to_cpumask[];
-#define cpu_to_node(cpu) (cpu_to_node[cpu])
-#define parent_node(node) (node)
+#define cpu_to_node(cpu) (cpu_to_node[cpu])
+#define parent_node(node) (node)
#define node_to_first_cpu(node) (__ffs(node_to_cpumask[node]))
#define node_to_cpumask(node) (node_to_cpumask[node])
-struct node {
- u64 start,end;
+struct node {
+ u64 start;
+ u64 end;
};
extern int compute_hash_shift(struct node *nodes, int numnodes,
- nodeid_t *nodeids);
+ nodeid_t *nodeids);
extern nodeid_t pxm_to_node(unsigned int pxm);
#define ZONE_ALIGN (1UL << (MAX_ORDER+PAGE_SHIFT))
-#define VIRTUAL_BUG_ON(x)
extern void numa_add_cpu(int cpu);
extern void numa_init_array(void);
@@ -40,13 +43,8 @@ extern void setup_node_bootmem(nodeid_t nodeid, u64 start, u64 end);
extern nodeid_t apicid_to_node[];
extern void init_cpu_to_node(void);
-static inline void clear_node_cpumask(int cpu)
-{
- cpumask_clear_cpu(cpu, &node_to_cpumask[cpu_to_node(cpu)]);
-}
-
/* Simple perfect hash to map pdx to node numbers */
-extern int memnode_shift;
+extern int memnode_shift;
extern unsigned long memnodemapsize;
extern u8 *memnodemap;
@@ -57,21 +55,23 @@ struct node_data {
extern struct node_data node_data[];
-static inline __attribute__((pure)) nodeid_t phys_to_nid(paddr_t addr)
-{
- nodeid_t nid;
- VIRTUAL_BUG_ON((paddr_to_pdx(addr) >> memnode_shift) >= memnodemapsize);
- nid = memnodemap[paddr_to_pdx(addr) >> memnode_shift];
- VIRTUAL_BUG_ON(nid >= MAX_NUMNODES || !node_data[nid]);
- return nid;
-}
-
-#define NODE_DATA(nid) (&(node_data[nid]))
-
-#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
-#define node_spanned_pages(nid) (NODE_DATA(nid)->node_spanned_pages)
-#define node_end_pfn(nid) (NODE_DATA(nid)->node_start_pfn + \
- NODE_DATA(nid)->node_spanned_pages)
+static inline __attribute_pure__ nodeid_t phys_to_nid(paddr_t addr)
+{
+ nodeid_t nid;
+
+ ASSERT((paddr_to_pdx(addr) >> memnode_shift) < memnodemapsize);
+ nid = memnodemap[paddr_to_pdx(addr) >> memnode_shift];
+ ASSERT(nid <= MAX_NUMNODES || !node_data[nid].node_start_pfn);
+
+ return nid;
+}
+
+#define NODE_DATA(nid) (&(node_data[nid]))
+
+#define node_start_pfn(nid) NODE_DATA(nid)->node_start_pfn
+#define node_spanned_pages(nid) NODE_DATA(nid)->node_spanned_pages
+#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);
diff --git a/xen/include/xen/numa.h b/xen/include/xen/numa.h
index 6bba29e..3bb4afc 100644
--- a/xen/include/xen/numa.h
+++ b/xen/include/xen/numa.h
@@ -6,9 +6,6 @@
#define NUMA_NO_NODE 0xFF
#define NUMA_NO_DISTANCE 0xFF
-#define MAX_NUMNODES NR_NODES
-#define NR_NODE_MEMBLKS (MAX_NUMNODES * 2)
-
#define vcpu_to_node(v) (cpu_to_node((v)->processor))
#define domain_to_node(d) \
--
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-07-18 11:41 UTC|newest]
Thread overview: 109+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-18 11:41 [RFC PATCH v3 00/24] ARM: Add Xen NUMA support vijay.kilari
2017-07-18 11:41 ` [RFC PATCH v3 01/24] NUMA: Make number of NUMA nodes configurable vijay.kilari
2017-07-18 15:29 ` Wei Liu
2017-07-18 17:52 ` Julien Grall
2017-07-19 8:17 ` Wei Liu
2017-07-19 15:48 ` Julien Grall
2017-07-28 10:11 ` Jan Beulich
2017-07-18 17:55 ` Julien Grall
2017-07-19 7:00 ` Vijay Kilari
2017-07-19 15:55 ` Julien Grall
2017-07-20 7:30 ` Vijay Kilari
2017-07-20 10:57 ` Julien Grall
2017-07-18 11:41 ` vijay.kilari [this message]
2017-07-19 16:23 ` [RFC PATCH v3 02/24] x86: NUMA: Clean up: Fix coding styles and drop unused code Julien Grall
2017-07-19 16:27 ` Wei Liu
2017-07-19 16:34 ` Julien Grall
2017-07-20 7:00 ` Vijay Kilari
2017-07-20 11:00 ` Julien Grall
2017-07-20 12:05 ` Vijay Kilari
2017-07-20 12:09 ` Julien Grall
2017-07-20 12:29 ` Vijay Kilari
2017-07-20 12:33 ` Julien Grall
2017-07-18 11:41 ` [RFC PATCH v3 03/24] x86: NUMA: Fix datatypes and attributes vijay.kilari
2017-07-18 15:29 ` Wei Liu
2017-07-18 11:41 ` [RFC PATCH v3 04/24] x86: NUMA: Rename and sanitize memnode shift code vijay.kilari
2017-07-18 15:29 ` Wei Liu
2017-07-19 17:12 ` Julien Grall
2017-07-20 6:56 ` Vijay Kilari
2017-07-18 11:41 ` [RFC PATCH v3 05/24] x86: NUMA: Add accessors for nodes[] and node_memblk_range[] structs vijay.kilari
2017-07-18 15:29 ` Wei Liu
2017-07-19 6:40 ` Vijay Kilari
2017-07-19 17:18 ` Julien Grall
2017-07-20 7:41 ` Vijay Kilari
2017-07-20 11:03 ` Julien Grall
2017-07-18 11:41 ` [RFC PATCH v3 06/24] x86: NUMA: Rename some generic functions vijay.kilari
2017-07-19 17:23 ` Julien Grall
2017-07-18 11:41 ` [RFC PATCH v3 07/24] ARM: NUMA: Add existing ARM numa code under CONFIG_NUMA vijay.kilari
2017-07-18 18:06 ` Julien Grall
2017-07-20 9:31 ` Vijay Kilari
2017-07-20 11:10 ` Julien Grall
2017-07-18 11:41 ` [RFC PATCH v3 08/24] NUMA: x86: Move numa code and make it generic vijay.kilari
2017-07-18 15:29 ` Wei Liu
2017-07-18 18:16 ` Julien Grall
2017-07-19 6:47 ` Vijay Kilari
2017-07-19 17:41 ` Julien Grall
2017-07-20 8:55 ` Vijay Kilari
2017-07-20 11:14 ` Julien Grall
2017-07-24 20:28 ` Stefano Stabellini
2017-07-18 11:41 ` [RFC PATCH v3 09/24] NUMA: x86: Move common code from srat.c vijay.kilari
2017-07-20 11:17 ` Julien Grall
2017-07-20 11:43 ` Vijay Kilari
2017-07-24 20:35 ` Stefano Stabellini
2017-07-18 11:41 ` [RFC PATCH v3 10/24] NUMA: Allow numa initialization with DT vijay.kilari
2017-07-19 17:58 ` Julien Grall
2017-07-20 10:28 ` Vijay Kilari
2017-07-20 11:20 ` Julien Grall
2017-07-18 11:41 ` [RFC PATCH v3 11/24] ARM: fdt: Export and introduce new fdt functions vijay.kilari
2017-07-18 15:29 ` Wei Liu
2017-07-18 16:29 ` Julien Grall
2017-07-18 11:41 ` [RFC PATCH v3 12/24] ARM: NUMA: DT: Parse CPU NUMA information vijay.kilari
2017-07-19 18:26 ` Julien Grall
2017-07-20 9:20 ` Vijay Kilari
2017-07-18 11:41 ` [RFC PATCH v3 13/24] ARM: NUMA: DT: Parse memory " vijay.kilari
2017-07-19 18:39 ` Julien Grall
2017-07-20 10:37 ` Vijay Kilari
2017-07-20 11:24 ` Julien Grall
2017-07-20 11:26 ` Julien Grall
2017-07-21 11:10 ` Vijay Kilari
2017-07-21 12:35 ` Julien Grall
2017-07-18 11:41 ` [RFC PATCH v3 14/24] ARM: NUMA: DT: Parse NUMA distance information vijay.kilari
2017-07-20 13:02 ` Julien Grall
2017-07-18 11:41 ` [RFC PATCH v3 15/24] ARM: NUMA: DT: Add CPU NUMA support vijay.kilari
2017-07-24 11:24 ` Julien Grall
2017-07-25 6:47 ` Vijay Kilari
2017-07-25 18:38 ` Julien Grall
2017-07-25 18:48 ` Stefano Stabellini
2017-07-25 18:51 ` Julien Grall
2017-07-25 19:06 ` Stefano Stabellini
2017-07-26 17:18 ` Julien Grall
2017-07-26 17:21 ` Stefano Stabellini
2017-07-18 11:41 ` [RFC PATCH v3 16/24] ARM: NUMA: Add memory " vijay.kilari
2017-07-24 12:43 ` Julien Grall
2017-07-18 11:41 ` [RFC PATCH v3 17/24] ARM: NUMA: DT: Do not expose numa info to DOM0 vijay.kilari
2017-07-24 20:48 ` Stefano Stabellini
2017-07-26 17:22 ` Julien Grall
2017-07-18 11:41 ` [RFC PATCH v3 18/24] ACPI: Refactor acpi SRAT and SLIT table handling code vijay.kilari
2017-07-18 15:36 ` Wei Liu
2017-07-19 6:33 ` Vijay Kilari
2017-07-18 11:41 ` [RFC PATCH v3 19/24] ARM: NUMA: Extract MPIDR from MADT table vijay.kilari
2017-07-24 22:17 ` Stefano Stabellini
2017-07-26 18:12 ` Julien Grall
2017-07-18 11:41 ` [RFC PATCH v3 20/24] ACPI: Move arch specific SRAT parsing vijay.kilari
2017-07-24 21:15 ` Stefano Stabellini
2017-07-18 11:41 ` [RFC PATCH v3 21/24] ARM: NUMA: ACPI: Extract proximity from SRAT table vijay.kilari
2017-07-24 22:17 ` Stefano Stabellini
2017-07-26 18:18 ` Julien Grall
2017-07-18 11:41 ` [RFC PATCH v3 22/24] ARM: NUMA: Initialize ACPI NUMA vijay.kilari
2017-07-24 22:11 ` Stefano Stabellini
2017-07-26 18:23 ` Julien Grall
2017-07-18 11:41 ` [RFC PATCH v3 23/24] NUMA: Move CONFIG_NUMA to common Kconfig vijay.kilari
2017-07-18 16:25 ` Julien Grall
2017-07-18 18:00 ` Julien Grall
2017-07-28 10:08 ` Jan Beulich
2017-07-18 11:41 ` [RFC PATCH v3 24/24] NUMA: Enable ACPI_NUMA config vijay.kilari
2017-07-18 16:18 ` [RFC PATCH v3 00/24] ARM: Add Xen NUMA support Julien Grall
2017-07-19 6:31 ` Vijay Kilari
2017-07-19 7:18 ` Julien Grall
[not found] ` <CALicx6svuo3JXik=8bYuciFzWDu6qmwVi1VXdBgjLp_f_YUhqQ@mail.gmail.com>
2017-10-06 17:09 ` vkilari
2017-10-06 17:30 ` Julien Grall
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=1500378106-2620-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=dario.faggioli@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=julien.grall@arm.com \
--cc=kevin.tian@intel.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).