Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1477079 > unrolled thread

[PATCH] x86: Put the num_processors++ code in a more suitable position

Started byDou Liyang <douly.fnst@cn.fujitsu.com>
First post2016-09-06 07:40 +0200
Last post2016-09-07 04:10 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] x86: Put the num_processors++ code in a more suitable position Dou Liyang <douly.fnst@cn.fujitsu.com> - 2016-09-06 07:40 +0200
    Re: [PATCH] x86: Put the num_processors++ code in a more suitable  position David Rientjes <rientjes@google.com> - 2016-09-06 23:30 +0200
      Re: [PATCH] x86: Put the num_processors++ code in a more suitable  position Dou Liyang <douly.fnst@cn.fujitsu.com> - 2016-09-07 04:10 +0200

#1477079 — [PATCH] x86: Put the num_processors++ code in a more suitable position

FromDou Liyang <douly.fnst@cn.fujitsu.com>
Date2016-09-06 07:40 +0200
Subject[PATCH] x86: Put the num_processors++ code in a more suitable position
Message-ID<sehh0-64g-11@gated-at.bofh.it>
This is a code optimization.

If checking the topology package map of apicid and cpu is failure,
it will stop generating the processor info for that apicid and the
disabled_cpus will plus one. However, the num-processors has already
been added one above. That may cause the number of processors incorrect.

Just put the num_processors++ code in the more suitable position.
it makes sure that the num-processors will not conflict with the
disabled_cpus.

Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com>
---
 arch/x86/kernel/apic/apic.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 50c95af..f3e9b2d 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -2093,7 +2093,6 @@ int generic_processor_info(int apicid, int version)
 		return -EINVAL;
 	}
 
-	num_processors++;
 	if (apicid == boot_cpu_physical_apicid) {
 		/*
 		 * x86_bios_cpu_apicid is required to have processors listed
@@ -2116,10 +2115,13 @@ int generic_processor_info(int apicid, int version)
 
 		pr_warning("APIC: Package limit reached. Processor %d/0x%x ignored.\n",
 			   thiscpu, apicid);
+
 		disabled_cpus++;
 		return -ENOSPC;
 	}
 
+	num_processors++;
+
 	/*
 	 * Validate version
 	 */
-- 
2.5.5

[toc] | [next] | [standalone]


#1477829 — Re: [PATCH] x86: Put the num_processors++ code in a more suitable position

FromDavid Rientjes <rientjes@google.com>
Date2016-09-06 23:30 +0200
SubjectRe: [PATCH] x86: Put the num_processors++ code in a more suitable position
Message-ID<sew6l-7po-13@gated-at.bofh.it>
In reply to#1477079
On Tue, 6 Sep 2016, Dou Liyang wrote:

> This is a code optimization.
> 

Not sure that it's optimization, it's just for correctness.

> If checking the topology package map of apicid and cpu is failure,
> it will stop generating the processor info for that apicid and the
> disabled_cpus will plus one. However, the num-processors has already
> been added one above. That may cause the number of processors incorrect.
> 
> Just put the num_processors++ code in the more suitable position.
> it makes sure that the num-processors will not conflict with the
> disabled_cpus.
> 
> Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com>

Acked-by: David Rientjes <rientjes@google.com>

[toc] | [prev] | [next] | [standalone]


#1477931 — Re: [PATCH] x86: Put the num_processors++ code in a more suitable position

FromDou Liyang <douly.fnst@cn.fujitsu.com>
Date2016-09-07 04:10 +0200
SubjectRe: [PATCH] x86: Put the num_processors++ code in a more suitable position
Message-ID<seAtk-1Sb-7@gated-at.bofh.it>
In reply to#1477829
Hi David,

At 09/07/2016 05:23 AM, David Rientjes wrote:
> On Tue, 6 Sep 2016, Dou Liyang wrote:
>
>> This is a code optimization.
>>
>
> Not sure that it's optimization, it's just for correctness.

Yes, I see. I will improve it in next version.

Thanks,
Dou

>
>> If checking the topology package map of apicid and cpu is failure,
>> it will stop generating the processor info for that apicid and the
>> disabled_cpus will plus one. However, the num-processors has already
>> been added one above. That may cause the number of processors incorrect.
>>
>> Just put the num_processors++ code in the more suitable position.
>> it makes sure that the num-processors will not conflict with the
>> disabled_cpus.
>>
>> Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com>
>
> Acked-by: David Rientjes <rientjes@google.com>
>
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web