* [patch] x86/AMD: remove an unneeded condition in srat_detect_node()
@ 2016-01-13 12:39 ` Dan Carpenter
0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2016-01-13 12:39 UTC (permalink / raw)
To: Thomas Gleixner, Yinghai Lu
Cc: Ingo Molnar, H. Peter Anvin, x86, Borislav Petkov,
Aravind Gopalakrishnan, Andy Lutomirski, Huang Rui,
Hector Marco-Gisbert, linux-kernel, kernel-janitors
Originally we calculated ht_nodeid as "ht_nodeid = apicid - boot_cpu_id;"
so presumably it could be negative. But after commit 01aaea1afbcd
('x86: introduce initial apicid') we use c->initial_apicid which is an
unsigned short and thus always >= 0.
It causes a static checker warning to test for impossible conditions so
let's remove it.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index e678dde..a07956a 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -434,8 +434,7 @@ static void srat_detect_node(struct cpuinfo_x86 *c)
*/
int ht_nodeid = c->initial_apicid;
- if (ht_nodeid >= 0 &&
- __apicid_to_node[ht_nodeid] != NUMA_NO_NODE)
+ if (__apicid_to_node[ht_nodeid] != NUMA_NO_NODE)
node = __apicid_to_node[ht_nodeid];
/* Pick a nearby node */
if (!node_online(node))
^ permalink raw reply related [flat|nested] 5+ messages in thread* [patch] x86/AMD: remove an unneeded condition in srat_detect_node()
@ 2016-01-13 12:39 ` Dan Carpenter
0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2016-01-13 12:39 UTC (permalink / raw)
To: Thomas Gleixner, Yinghai Lu
Cc: Ingo Molnar, H. Peter Anvin, x86, Borislav Petkov,
Aravind Gopalakrishnan, Andy Lutomirski, Huang Rui,
Hector Marco-Gisbert, linux-kernel, kernel-janitors
Originally we calculated ht_nodeid as "ht_nodeid = apicid - boot_cpu_id;"
so presumably it could be negative. But after commit 01aaea1afbcd
('x86: introduce initial apicid') we use c->initial_apicid which is an
unsigned short and thus always >= 0.
It causes a static checker warning to test for impossible conditions so
let's remove it.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index e678dde..a07956a 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -434,8 +434,7 @@ static void srat_detect_node(struct cpuinfo_x86 *c)
*/
int ht_nodeid = c->initial_apicid;
- if (ht_nodeid >= 0 &&
- __apicid_to_node[ht_nodeid] != NUMA_NO_NODE)
+ if (__apicid_to_node[ht_nodeid] != NUMA_NO_NODE)
node = __apicid_to_node[ht_nodeid];
/* Pick a nearby node */
if (!node_online(node))
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [patch] x86/AMD: remove an unneeded condition in srat_detect_node()
2016-01-13 12:39 ` Dan Carpenter
@ 2016-01-14 5:48 ` Huang Rui
-1 siblings, 0 replies; 5+ messages in thread
From: Huang Rui @ 2016-01-14 5:48 UTC (permalink / raw)
To: Dan Carpenter
Cc: Thomas Gleixner, Yinghai Lu, Ingo Molnar, H. Peter Anvin, x86,
Borislav Petkov, Aravind Gopalakrishnan, Andy Lutomirski,
Hector Marco-Gisbert, linux-kernel, kernel-janitors
On Wed, Jan 13, 2016 at 03:39:40PM +0300, Dan Carpenter wrote:
> Originally we calculated ht_nodeid as "ht_nodeid = apicid - boot_cpu_id;"
> so presumably it could be negative. But after commit 01aaea1afbcd
> ('x86: introduce initial apicid') we use c->initial_apicid which is an
> unsigned short and thus always >= 0.
>
> It causes a static checker warning to test for impossible conditions so
> let's remove it.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
Looks OK for me.
Reviewed-by: Huang Rui <ray.huang@amd.com>
> diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
> index e678dde..a07956a 100644
> --- a/arch/x86/kernel/cpu/amd.c
> +++ b/arch/x86/kernel/cpu/amd.c
> @@ -434,8 +434,7 @@ static void srat_detect_node(struct cpuinfo_x86 *c)
> */
> int ht_nodeid = c->initial_apicid;
>
> - if (ht_nodeid >= 0 &&
> - __apicid_to_node[ht_nodeid] != NUMA_NO_NODE)
> + if (__apicid_to_node[ht_nodeid] != NUMA_NO_NODE)
> node = __apicid_to_node[ht_nodeid];
> /* Pick a nearby node */
> if (!node_online(node))
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [patch] x86/AMD: remove an unneeded condition in srat_detect_node()
@ 2016-01-14 5:48 ` Huang Rui
0 siblings, 0 replies; 5+ messages in thread
From: Huang Rui @ 2016-01-14 5:48 UTC (permalink / raw)
To: Dan Carpenter
Cc: Thomas Gleixner, Yinghai Lu, Ingo Molnar, H. Peter Anvin, x86,
Borislav Petkov, Aravind Gopalakrishnan, Andy Lutomirski,
Hector Marco-Gisbert, linux-kernel, kernel-janitors
On Wed, Jan 13, 2016 at 03:39:40PM +0300, Dan Carpenter wrote:
> Originally we calculated ht_nodeid as "ht_nodeid = apicid - boot_cpu_id;"
> so presumably it could be negative. But after commit 01aaea1afbcd
> ('x86: introduce initial apicid') we use c->initial_apicid which is an
> unsigned short and thus always >= 0.
>
> It causes a static checker warning to test for impossible conditions so
> let's remove it.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
Looks OK for me.
Reviewed-by: Huang Rui <ray.huang@amd.com>
> diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
> index e678dde..a07956a 100644
> --- a/arch/x86/kernel/cpu/amd.c
> +++ b/arch/x86/kernel/cpu/amd.c
> @@ -434,8 +434,7 @@ static void srat_detect_node(struct cpuinfo_x86 *c)
> */
> int ht_nodeid = c->initial_apicid;
>
> - if (ht_nodeid >= 0 &&
> - __apicid_to_node[ht_nodeid] != NUMA_NO_NODE)
> + if (__apicid_to_node[ht_nodeid] != NUMA_NO_NODE)
> node = __apicid_to_node[ht_nodeid];
> /* Pick a nearby node */
> if (!node_online(node))
^ permalink raw reply [flat|nested] 5+ messages in thread
* [tip:x86/urgent] x86/cpu/amd: Remove an unneeded condition in srat_detect_node()
2016-01-13 12:39 ` Dan Carpenter
(?)
(?)
@ 2016-01-14 9:07 ` tip-bot for Dan Carpenter
-1 siblings, 0 replies; 5+ messages in thread
From: tip-bot for Dan Carpenter @ 2016-01-14 9:07 UTC (permalink / raw)
To: linux-tip-commits
Cc: Aravind.Gopalakrishnan, linux-kernel, tglx, ray.huang,
dan.carpenter, torvalds, hecmargi, hpa, mingo, yhlu.kernel, bp,
luto, peterz
Commit-ID: 7030a7e9321166eef44c811fe4af4d460360d424
Gitweb: http://git.kernel.org/tip/7030a7e9321166eef44c811fe4af4d460360d424
Author: Dan Carpenter <dan.carpenter@oracle.com>
AuthorDate: Wed, 13 Jan 2016 15:39:40 +0300
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 14 Jan 2016 09:46:00 +0100
x86/cpu/amd: Remove an unneeded condition in srat_detect_node()
Originally we calculated ht_nodeid as "ht_nodeid = apicid -
boot_cpu_id;" so presumably it could be negative.
But after commit:
01aaea1afbcd ('x86: introduce initial apicid')
we use c->initial_apicid which is an unsigned short and thus always >= 0.
It causes a static checker warning to test for impossible
conditions so let's remove it.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: Hector Marco-Gisbert <hecmargi@upv.es>
Cc: Huang Rui <ray.huang@amd.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Yinghai Lu <yhlu.kernel@gmail.com>
Link: http://lkml.kernel.org/r/20160113123940.GE19993@mwanda
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/kernel/cpu/amd.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index e678dde..a07956a 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -434,8 +434,7 @@ static void srat_detect_node(struct cpuinfo_x86 *c)
*/
int ht_nodeid = c->initial_apicid;
- if (ht_nodeid >= 0 &&
- __apicid_to_node[ht_nodeid] != NUMA_NO_NODE)
+ if (__apicid_to_node[ht_nodeid] != NUMA_NO_NODE)
node = __apicid_to_node[ht_nodeid];
/* Pick a nearby node */
if (!node_online(node))
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-01-14 9:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-13 12:39 [patch] x86/AMD: remove an unneeded condition in srat_detect_node() Dan Carpenter
2016-01-13 12:39 ` Dan Carpenter
2016-01-14 5:48 ` Huang Rui
2016-01-14 5:48 ` Huang Rui
2016-01-14 9:07 ` [tip:x86/urgent] x86/cpu/amd: Remove " tip-bot for Dan Carpenter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.