* [PATCH] x86/NUMA: fix setup_node()
@ 2015-08-28 13:58 Jan Beulich
2015-08-28 14:16 ` Andrew Cooper
2015-08-31 11:46 ` Wei Liu
0 siblings, 2 replies; 3+ messages in thread
From: Jan Beulich @ 2015-08-28 13:58 UTC (permalink / raw)
To: xen-devel; +Cc: Andrew Cooper, Keir Fraser, Wei Liu
[-- Attachment #1: Type: text/plain, Size: 2647 bytes --]
The function referenced an __initdata object (nodes_found). Since this
being a node mask was more complicated than needed, the variable gets
replaced by a simple counter. Check at once that the count of nodes
doesn't go beyond MAX_NUMNODES.
Also consolidate four printk()s related to the function's use into just
one.
Finally (quite the opposite of the above issue) __init-annotate
nodes_cover_memory().
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/arch/x86/srat.c
+++ b/xen/arch/x86/srat.c
@@ -25,7 +25,6 @@ static struct acpi_table_slit *__read_mo
static nodemask_t memory_nodes_parsed __initdata;
static nodemask_t processor_nodes_parsed __initdata;
-static nodemask_t nodes_found __initdata;
static struct node nodes[MAX_NUMNODES] __initdata;
struct pxm2node {
@@ -61,11 +60,12 @@ nodeid_t pxm_to_node(unsigned pxm)
return NUMA_NO_NODE;
}
-__devinit nodeid_t setup_node(unsigned pxm)
+nodeid_t setup_node(unsigned pxm)
{
nodeid_t node;
unsigned idx;
static bool_t warned;
+ static unsigned nodes_found;
BUILD_BUG_ON(MAX_NUMNODES >= NUMA_NO_NODE);
@@ -85,15 +85,17 @@ __devinit nodeid_t setup_node(unsigned p
goto finish;
if (!warned) {
- printk(XENLOG_WARNING "More PXMs than available nodes\n");
+ printk(KERN_WARNING "SRAT: Too many proximity domains (%#x)\n",
+ pxm);
warned = 1;
}
return NUMA_NO_NODE;
finish:
- node = first_unset_node(nodes_found);
- node_set(node, nodes_found);
+ node = nodes_found++;
+ if (node >= MAX_NUMNODES)
+ return NUMA_NO_NODE;
pxm2node[idx].pxm = pxm;
pxm2node[idx].node = node;
@@ -219,7 +221,6 @@ acpi_numa_x2apic_affinity_init(struct ac
pxm = pa->proximity_domain;
node = setup_node(pxm);
if (node == NUMA_NO_NODE) {
- printk(KERN_ERR "SRAT: Too many proximity domains %x\n", pxm);
bad_srat();
return;
}
@@ -254,7 +255,6 @@ acpi_numa_processor_affinity_init(struct
}
node = setup_node(pxm);
if (node == NUMA_NO_NODE) {
- printk(KERN_ERR "SRAT: Too many proximity domains %x\n", pxm);
bad_srat();
return;
}
@@ -299,7 +299,6 @@ acpi_numa_memory_affinity_init(struct ac
pxm &= 0xff;
node = setup_node(pxm);
if (node == NUMA_NO_NODE) {
- printk(KERN_ERR "SRAT: Too many proximity domains.\n");
bad_srat();
return;
}
@@ -341,7 +340,7 @@ acpi_numa_memory_affinity_init(struct ac
/* Sanity check to catch more bad SRATs (they are amazingly common).
Make sure the PXMs cover all memory. */
-static int nodes_cover_memory(void)
+static int __init nodes_cover_memory(void)
{
int i;
[-- Attachment #2: x86-setup-node.patch --]
[-- Type: text/plain, Size: 2671 bytes --]
x86/NUMA: fix setup_node()
The function referenced an __initdata object (nodes_found). Since this
being a node mask was more complicated than needed, the variable gets
replaced by a simple counter. Check at once that the count of nodes
doesn't go beyond MAX_NUMNODES.
Also consolidate four printk()s related to the function's use into just
one.
Finally (quite the opposite of the above issue) __init-annotate
nodes_cover_memory().
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/arch/x86/srat.c
+++ b/xen/arch/x86/srat.c
@@ -25,7 +25,6 @@ static struct acpi_table_slit *__read_mo
static nodemask_t memory_nodes_parsed __initdata;
static nodemask_t processor_nodes_parsed __initdata;
-static nodemask_t nodes_found __initdata;
static struct node nodes[MAX_NUMNODES] __initdata;
struct pxm2node {
@@ -61,11 +60,12 @@ nodeid_t pxm_to_node(unsigned pxm)
return NUMA_NO_NODE;
}
-__devinit nodeid_t setup_node(unsigned pxm)
+nodeid_t setup_node(unsigned pxm)
{
nodeid_t node;
unsigned idx;
static bool_t warned;
+ static unsigned nodes_found;
BUILD_BUG_ON(MAX_NUMNODES >= NUMA_NO_NODE);
@@ -85,15 +85,17 @@ __devinit nodeid_t setup_node(unsigned p
goto finish;
if (!warned) {
- printk(XENLOG_WARNING "More PXMs than available nodes\n");
+ printk(KERN_WARNING "SRAT: Too many proximity domains (%#x)\n",
+ pxm);
warned = 1;
}
return NUMA_NO_NODE;
finish:
- node = first_unset_node(nodes_found);
- node_set(node, nodes_found);
+ node = nodes_found++;
+ if (node >= MAX_NUMNODES)
+ return NUMA_NO_NODE;
pxm2node[idx].pxm = pxm;
pxm2node[idx].node = node;
@@ -219,7 +221,6 @@ acpi_numa_x2apic_affinity_init(struct ac
pxm = pa->proximity_domain;
node = setup_node(pxm);
if (node == NUMA_NO_NODE) {
- printk(KERN_ERR "SRAT: Too many proximity domains %x\n", pxm);
bad_srat();
return;
}
@@ -254,7 +255,6 @@ acpi_numa_processor_affinity_init(struct
}
node = setup_node(pxm);
if (node == NUMA_NO_NODE) {
- printk(KERN_ERR "SRAT: Too many proximity domains %x\n", pxm);
bad_srat();
return;
}
@@ -299,7 +299,6 @@ acpi_numa_memory_affinity_init(struct ac
pxm &= 0xff;
node = setup_node(pxm);
if (node == NUMA_NO_NODE) {
- printk(KERN_ERR "SRAT: Too many proximity domains.\n");
bad_srat();
return;
}
@@ -341,7 +340,7 @@ acpi_numa_memory_affinity_init(struct ac
/* Sanity check to catch more bad SRATs (they are amazingly common).
Make sure the PXMs cover all memory. */
-static int nodes_cover_memory(void)
+static int __init nodes_cover_memory(void)
{
int i;
[-- Attachment #3: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] x86/NUMA: fix setup_node()
2015-08-28 13:58 [PATCH] x86/NUMA: fix setup_node() Jan Beulich
@ 2015-08-28 14:16 ` Andrew Cooper
2015-08-31 11:46 ` Wei Liu
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Cooper @ 2015-08-28 14:16 UTC (permalink / raw)
To: Jan Beulich, xen-devel; +Cc: Keir Fraser, Wei Liu
On 28/08/15 14:58, Jan Beulich wrote:
> The function referenced an __initdata object (nodes_found). Since this
> being a node mask was more complicated than needed, the variable gets
> replaced by a simple counter. Check at once that the count of nodes
> doesn't go beyond MAX_NUMNODES.
>
> Also consolidate four printk()s related to the function's use into just
> one.
>
> Finally (quite the opposite of the above issue) __init-annotate
> nodes_cover_memory().
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] x86/NUMA: fix setup_node()
2015-08-28 13:58 [PATCH] x86/NUMA: fix setup_node() Jan Beulich
2015-08-28 14:16 ` Andrew Cooper
@ 2015-08-31 11:46 ` Wei Liu
1 sibling, 0 replies; 3+ messages in thread
From: Wei Liu @ 2015-08-31 11:46 UTC (permalink / raw)
To: Jan Beulich; +Cc: xen-devel, Keir Fraser, Wei Liu, Andrew Cooper
On Fri, Aug 28, 2015 at 07:58:46AM -0600, Jan Beulich wrote:
> The function referenced an __initdata object (nodes_found). Since this
> being a node mask was more complicated than needed, the variable gets
> replaced by a simple counter. Check at once that the count of nodes
> doesn't go beyond MAX_NUMNODES.
>
> Also consolidate four printk()s related to the function's use into just
> one.
>
> Finally (quite the opposite of the above issue) __init-annotate
> nodes_cover_memory().
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>
Release-acked-by: Wei Liu <wei.liu2@citrix.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-08-31 11:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-28 13:58 [PATCH] x86/NUMA: fix setup_node() Jan Beulich
2015-08-28 14:16 ` Andrew Cooper
2015-08-31 11:46 ` Wei Liu
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).