linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [v4.6-rc1 Regression] x86/topology: Create logical package id
@ 2016-05-06 18:15 Joseph Salisbury
  2016-05-06 18:48 ` Thomas Gleixner
  0 siblings, 1 reply; 11+ messages in thread
From: Joseph Salisbury @ 2016-05-06 18:15 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Peter Zijlstra (Intel), Andi Kleen, Andrew Morton,
	Andy Lutomirski, Arnaldo Carvalho de Melo, Borislav Petkov,
	Brian Gerst, Denys Vlasenko, H. Peter Anvin, Harish Chegondi,
	Jacob Pan, Jiri Olsa, Kan Liang, Linus Torvalds,
	Luis R. Rodriguez, Peter Zijlstra, Stephane Eranian, Toshi Kani,
	Vince Weaver, LKML, yingying.zhao, Zhang, Xiong Y, 1573231,
	1397880, Ingo Molnar, x86, Andy Shevchenko, Chen Yucong,
	Laura Abbott

Hi Thomas,

A kernel bug report was opened against Ubuntu [0].  After a kernel
bisect, it was found that reverting the following commit resolved this bug:

commit 1f12e32f4cd5243ae46d8b933181be0d022c6793
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Mon Feb 22 22:19:15 2016 +0000

    x86/topology: Create logical package id

To build successfully with this commit reverted, I also had to revert
commits: e7ee3e8,2d4de83,87f01cc and 33c3cc7.

The regression was introduced as of v4.6-rc1.
    
I was hoping to get your feedback, since you are the patch author.  Do
you think gathering any additional data will help diagnose this issue,
or would it be best to submit a revert request?
    
    
Thanks,
    
Joe

[0] http://pad.lv/1573231

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [v4.6-rc1 Regression] x86/topology: Create logical package id
  2016-05-06 18:15 [v4.6-rc1 Regression] x86/topology: Create logical package id Joseph Salisbury
@ 2016-05-06 18:48 ` Thomas Gleixner
  2016-05-06 19:13   ` Boris Ostrovsky
                     ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Thomas Gleixner @ 2016-05-06 18:48 UTC (permalink / raw)
  To: Joseph Salisbury
  Cc: Peter Zijlstra (Intel), Andi Kleen, Andrew Morton,
	Andy Lutomirski, Arnaldo Carvalho de Melo, Borislav Petkov,
	Brian Gerst, Denys Vlasenko, H. Peter Anvin, Harish Chegondi,
	Jacob Pan, Jiri Olsa, Kan Liang, Linus Torvalds,
	Luis R. Rodriguez, Peter Zijlstra, Stephane Eranian, Toshi Kani,
	Vince Weaver, LKML, yingying.zhao, Zhang, Xiong Y, 1573231,
	1397880, Ingo Molnar, x86, Andy Shevchenko, Chen Yucong,
	Laura Abbott, Boris Ostrovsky, David Vrabel

On Fri, 6 May 2016, Joseph Salisbury wrote:
> A kernel bug report was opened against Ubuntu [0].  After a kernel
> bisect, it was found that reverting the following commit resolved this bug:
> 
> commit 1f12e32f4cd5243ae46d8b933181be0d022c6793
> Author: Thomas Gleixner <tglx@linutronix.de>
> Date:   Mon Feb 22 22:19:15 2016 +0000
> 
>     x86/topology: Create logical package id
> 
> To build successfully with this commit reverted, I also had to revert
> commits: e7ee3e8,2d4de83,87f01cc and 33c3cc7.
> 
> The regression was introduced as of v4.6-rc1.
>     
> I was hoping to get your feedback, since you are the patch author.  Do
> you think gathering any additional data will help diagnose this issue,
> or would it be best to submit a revert request?

Yuck. That dies with a divide error. And that looks like XEN is supplying crap
data in the CPUID.

Does the patch below cure the issue?

Thanks,

        tglx

8<---------------

--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -332,6 +332,11 @@ static void __init smp_init_package_map(
 	 * primary cores.
 	 */
 	ncpus = boot_cpu_data.x86_max_cores;
+	if (!ncpus) {
+		pr_warn("x86_max_cores == zero !?!?");
+		ncpus = 1;
+	}
+
 	__max_logical_packages = DIV_ROUND_UP(total_cpus, ncpus);
 
 	/*

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [v4.6-rc1 Regression] x86/topology: Create logical package id
  2016-05-06 18:48 ` Thomas Gleixner
@ 2016-05-06 19:13   ` Boris Ostrovsky
  2016-05-06 19:38     ` Joseph Salisbury
  2016-05-06 19:38   ` Joseph Salisbury
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 11+ messages in thread
From: Boris Ostrovsky @ 2016-05-06 19:13 UTC (permalink / raw)
  To: Thomas Gleixner, Joseph Salisbury
  Cc: Peter Zijlstra (Intel), Andi Kleen, Andrew Morton,
	Andy Lutomirski, Arnaldo Carvalho de Melo, Borislav Petkov,
	Brian Gerst, Denys Vlasenko, H. Peter Anvin, Harish Chegondi,
	Jacob Pan, Jiri Olsa, Kan Liang, Linus Torvalds,
	Luis R. Rodriguez, Stephane Eranian, Toshi Kani, Vince Weaver,
	LKML, yingying.zhao, Zhang, Xiong Y, 1573231, 1397880,
	Ingo Molnar, x86, Andy Shevchenko, Chen Yucong, Laura Abbott,
	David Vrabel

On 05/06/2016 02:48 PM, Thomas Gleixner wrote:
> On Fri, 6 May 2016, Joseph Salisbury wrote:
>> A kernel bug report was opened against Ubuntu [0].  After a kernel
>> bisect, it was found that reverting the following commit resolved this bug:
>>
>> commit 1f12e32f4cd5243ae46d8b933181be0d022c6793
>> Author: Thomas Gleixner <tglx@linutronix.de>
>> Date:   Mon Feb 22 22:19:15 2016 +0000
>>
>>     x86/topology: Create logical package id
>>
>> To build successfully with this commit reverted, I also had to revert
>> commits: e7ee3e8,2d4de83,87f01cc and 33c3cc7.
>>
>> The regression was introduced as of v4.6-rc1.
>>     
>> I was hoping to get your feedback, since you are the patch author.  Do
>> you think gathering any additional data will help diagnose this issue,
>> or would it be best to submit a revert request?
> Yuck. That dies with a divide error. And that looks like XEN is supplying crap
> data in the CPUID.

Joe, do you have

ed6069b xen/apic: Provide Xen-specific version of cpu_present_to_apicid
APIC op

-boris


>
> Does the patch below cure the issue?
>
> Thanks,
>
>         tglx
>
> 8<---------------
>
> --- a/arch/x86/kernel/smpboot.c
> +++ b/arch/x86/kernel/smpboot.c
> @@ -332,6 +332,11 @@ static void __init smp_init_package_map(
>  	 * primary cores.
>  	 */
>  	ncpus = boot_cpu_data.x86_max_cores;
> +	if (!ncpus) {
> +		pr_warn("x86_max_cores == zero !?!?");
> +		ncpus = 1;
> +	}
> +
>  	__max_logical_packages = DIV_ROUND_UP(total_cpus, ncpus);
>  
>  	/*

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [v4.6-rc1 Regression] x86/topology: Create logical package id
  2016-05-06 19:13   ` Boris Ostrovsky
@ 2016-05-06 19:38     ` Joseph Salisbury
  2016-05-06 20:46       ` Boris Ostrovsky
  0 siblings, 1 reply; 11+ messages in thread
From: Joseph Salisbury @ 2016-05-06 19:38 UTC (permalink / raw)
  To: Boris Ostrovsky, Thomas Gleixner
  Cc: Peter Zijlstra (Intel), Andi Kleen, Andrew Morton,
	Andy Lutomirski, Arnaldo Carvalho de Melo, Borislav Petkov,
	Brian Gerst, Denys Vlasenko, H. Peter Anvin, Harish Chegondi,
	Jacob Pan, Jiri Olsa, Kan Liang, Linus Torvalds,
	Luis R. Rodriguez, Stephane Eranian, Toshi Kani, Vince Weaver,
	LKML, yingying.zhao, Zhang, Xiong Y, 1573231, 1397880,
	Ingo Molnar, x86, Andy Shevchenko, Chen Yucong, Laura Abbott,
	David Vrabel

On 05/06/2016 03:13 PM, Boris Ostrovsky wrote:
> On 05/06/2016 02:48 PM, Thomas Gleixner wrote:
>> On Fri, 6 May 2016, Joseph Salisbury wrote:
>>> A kernel bug report was opened against Ubuntu [0].  After a kernel
>>> bisect, it was found that reverting the following commit resolved this bug:
>>>
>>> commit 1f12e32f4cd5243ae46d8b933181be0d022c6793
>>> Author: Thomas Gleixner <tglx@linutronix.de>
>>> Date:   Mon Feb 22 22:19:15 2016 +0000
>>>
>>>     x86/topology: Create logical package id
>>>
>>> To build successfully with this commit reverted, I also had to revert
>>> commits: e7ee3e8,2d4de83,87f01cc and 33c3cc7.
>>>
>>> The regression was introduced as of v4.6-rc1.
>>>     
>>> I was hoping to get your feedback, since you are the patch author.  Do
>>> you think gathering any additional data will help diagnose this issue,
>>> or would it be best to submit a revert request?
>> Yuck. That dies with a divide error. And that looks like XEN is supplying crap
>> data in the CPUID.
> Joe, do you have
>
> ed6069b xen/apic: Provide Xen-specific version of cpu_present_to_apicid
> APIC op
>
> -boris
Yes the commit is in the 4.4 based Ubuntu kernel.  This bug also happens
with the vanilla 4.6-rc5 kernel, which also has that commit.


>
>
>> Does the patch below cure the issue?
>>
>> Thanks,
>>
>>         tglx
>>
>> 8<---------------
>>
>> --- a/arch/x86/kernel/smpboot.c
>> +++ b/arch/x86/kernel/smpboot.c
>> @@ -332,6 +332,11 @@ static void __init smp_init_package_map(
>>  	 * primary cores.
>>  	 */
>>  	ncpus = boot_cpu_data.x86_max_cores;
>> +	if (!ncpus) {
>> +		pr_warn("x86_max_cores == zero !?!?");
>> +		ncpus = 1;
>> +	}
>> +
>>  	__max_logical_packages = DIV_ROUND_UP(total_cpus, ncpus);
>>  
>>  	/*
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [v4.6-rc1 Regression] x86/topology: Create logical package id
  2016-05-06 18:48 ` Thomas Gleixner
  2016-05-06 19:13   ` Boris Ostrovsky
@ 2016-05-06 19:38   ` Joseph Salisbury
  2016-05-06 20:50     ` Joseph Salisbury
  2016-05-07  5:16   ` Ingo Molnar
  2016-05-07  8:12   ` [tip:x86/urgent] x86/topology: Handle CPUID bogosity gracefully tip-bot for Thomas Gleixner
  3 siblings, 1 reply; 11+ messages in thread
From: Joseph Salisbury @ 2016-05-06 19:38 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Peter Zijlstra (Intel), Andi Kleen, Andrew Morton,
	Andy Lutomirski, Arnaldo Carvalho de Melo, Borislav Petkov,
	Brian Gerst, Denys Vlasenko, H. Peter Anvin, Harish Chegondi,
	Jacob Pan, Jiri Olsa, Kan Liang, Linus Torvalds,
	Luis R. Rodriguez, Stephane Eranian, Toshi Kani, Vince Weaver,
	LKML, yingying.zhao, Zhang, Xiong Y, 1573231, 1397880,
	Ingo Molnar, x86, Andy Shevchenko, Chen Yucong, Laura Abbott,
	Boris Ostrovsky, David Vrabel

On 05/06/2016 02:48 PM, Thomas Gleixner wrote:
> On Fri, 6 May 2016, Joseph Salisbury wrote:
>> A kernel bug report was opened against Ubuntu [0].  After a kernel
>> bisect, it was found that reverting the following commit resolved this bug:
>>
>> commit 1f12e32f4cd5243ae46d8b933181be0d022c6793
>> Author: Thomas Gleixner <tglx@linutronix.de>
>> Date:   Mon Feb 22 22:19:15 2016 +0000
>>
>>     x86/topology: Create logical package id
>>
>> To build successfully with this commit reverted, I also had to revert
>> commits: e7ee3e8,2d4de83,87f01cc and 33c3cc7.
>>
>> The regression was introduced as of v4.6-rc1.
>>     
>> I was hoping to get your feedback, since you are the patch author.  Do
>> you think gathering any additional data will help diagnose this issue,
>> or would it be best to submit a revert request?
> Yuck. That dies with a divide error. And that looks like XEN is supplying crap
> data in the CPUID.
>
> Does the patch below cure the issue?
>
> Thanks,
>
>         tglx
>
> 8<---------------
>
> --- a/arch/x86/kernel/smpboot.c
> +++ b/arch/x86/kernel/smpboot.c
> @@ -332,6 +332,11 @@ static void __init smp_init_package_map(
>  	 * primary cores.
>  	 */
>  	ncpus = boot_cpu_data.x86_max_cores;
> +	if (!ncpus) {
> +		pr_warn("x86_max_cores == zero !?!?");
> +		ncpus = 1;
> +	}
> +
>  	__max_logical_packages = DIV_ROUND_UP(total_cpus, ncpus);
>  
>  	/*
I'll have this patch tested and report back.

Thanks,

Joe

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [v4.6-rc1 Regression] x86/topology: Create logical package id
  2016-05-06 19:38     ` Joseph Salisbury
@ 2016-05-06 20:46       ` Boris Ostrovsky
  2016-05-06 20:51         ` Joseph Salisbury
  0 siblings, 1 reply; 11+ messages in thread
From: Boris Ostrovsky @ 2016-05-06 20:46 UTC (permalink / raw)
  To: Joseph Salisbury, Thomas Gleixner
  Cc: Peter Zijlstra (Intel), Andi Kleen, Andrew Morton,
	Andy Lutomirski, Arnaldo Carvalho de Melo, Borislav Petkov,
	Brian Gerst, Denys Vlasenko, H. Peter Anvin, Harish Chegondi,
	Jacob Pan, Jiri Olsa, Kan Liang, Linus Torvalds,
	Luis R. Rodriguez, Stephane Eranian, Toshi Kani, Vince Weaver,
	LKML, yingying.zhao, Zhang, Xiong Y, 1573231, 1397880,
	Ingo Molnar, x86, Andy Shevchenko, Chen Yucong, Laura Abbott,
	David Vrabel

On 05/06/2016 03:38 PM, Joseph Salisbury wrote:
> On 05/06/2016 03:13 PM, Boris Ostrovsky wrote:
>> On 05/06/2016 02:48 PM, Thomas Gleixner wrote:
>>>
>>> Yuck. That dies with a divide error. And that looks like XEN is supplying crap
>>> data in the CPUID.
>> Joe, do you have
>>
>> ed6069b xen/apic: Provide Xen-specific version of cpu_present_to_apicid
>> APIC op
>>
>> -boris
> Yes the commit is in the 4.4 based Ubuntu kernel.  This bug also happens
> with the vanilla 4.6-rc5 kernel, which also has that commit.


Can you post guest's cpuid -1 -r ? (I guess after you verify Thomas' patch)

Thanks.
-boris

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [v4.6-rc1 Regression] x86/topology: Create logical package id
  2016-05-06 19:38   ` Joseph Salisbury
@ 2016-05-06 20:50     ` Joseph Salisbury
  0 siblings, 0 replies; 11+ messages in thread
From: Joseph Salisbury @ 2016-05-06 20:50 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Peter Zijlstra (Intel), Andi Kleen, Andrew Morton,
	Andy Lutomirski, Arnaldo Carvalho de Melo, Borislav Petkov,
	Brian Gerst, Denys Vlasenko, H. Peter Anvin, Harish Chegondi,
	Jacob Pan, Jiri Olsa, Kan Liang, Linus Torvalds,
	Luis R. Rodriguez, Stephane Eranian, Toshi Kani, Vince Weaver,
	LKML, yingying.zhao, Zhang, Xiong Y, 1573231, 1397880,
	Ingo Molnar, x86, Andy Shevchenko, Chen Yucong, Laura Abbott,
	Boris Ostrovsky, David Vrabel

On 05/06/2016 03:38 PM, Joseph Salisbury wrote:
> On 05/06/2016 02:48 PM, Thomas Gleixner wrote:
>> On Fri, 6 May 2016, Joseph Salisbury wrote:
>>> A kernel bug report was opened against Ubuntu [0].  After a kernel
>>> bisect, it was found that reverting the following commit resolved this bug:
>>>
>>> commit 1f12e32f4cd5243ae46d8b933181be0d022c6793
>>> Author: Thomas Gleixner <tglx@linutronix.de>
>>> Date:   Mon Feb 22 22:19:15 2016 +0000
>>>
>>>     x86/topology: Create logical package id
>>>
>>> To build successfully with this commit reverted, I also had to revert
>>> commits: e7ee3e8,2d4de83,87f01cc and 33c3cc7.
>>>
>>> The regression was introduced as of v4.6-rc1.
>>>     
>>> I was hoping to get your feedback, since you are the patch author.  Do
>>> you think gathering any additional data will help diagnose this issue,
>>> or would it be best to submit a revert request?
>> Yuck. That dies with a divide error. And that looks like XEN is supplying crap
>> data in the CPUID.
>>
>> Does the patch below cure the issue?
>>
>> Thanks,
>>
>>         tglx
>>
>> 8<---------------
>>
>> --- a/arch/x86/kernel/smpboot.c
>> +++ b/arch/x86/kernel/smpboot.c
>> @@ -332,6 +332,11 @@ static void __init smp_init_package_map(
>>  	 * primary cores.
>>  	 */
>>  	ncpus = boot_cpu_data.x86_max_cores;
>> +	if (!ncpus) {
>> +		pr_warn("x86_max_cores == zero !?!?");
>> +		ncpus = 1;
>> +	}
>> +
>>  	__max_logical_packages = DIV_ROUND_UP(total_cpus, ncpus);
>>  
>>  	/*
> I'll have this patch tested and report back.
>
> Thanks,
>
> Joe
Yes, your patch does in fact fix the bug.  Would you like any additional
information regarding the bug?

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [v4.6-rc1 Regression] x86/topology: Create logical package id
  2016-05-06 20:46       ` Boris Ostrovsky
@ 2016-05-06 20:51         ` Joseph Salisbury
  2016-05-06 21:24           ` Boris Ostrovsky
  0 siblings, 1 reply; 11+ messages in thread
From: Joseph Salisbury @ 2016-05-06 20:51 UTC (permalink / raw)
  To: Boris Ostrovsky, Thomas Gleixner
  Cc: Peter Zijlstra (Intel), Andi Kleen, Andrew Morton,
	Andy Lutomirski, Arnaldo Carvalho de Melo, Borislav Petkov,
	Brian Gerst, Denys Vlasenko, H. Peter Anvin, Harish Chegondi,
	Jacob Pan, Jiri Olsa, Kan Liang, Linus Torvalds,
	Luis R. Rodriguez, Stephane Eranian, Toshi Kani, Vince Weaver,
	LKML, yingying.zhao, Zhang, Xiong Y, 1573231, 1397880,
	Ingo Molnar, x86, Andy Shevchenko, Chen Yucong, Laura Abbott,
	David Vrabel

On 05/06/2016 04:46 PM, Boris Ostrovsky wrote:
> On 05/06/2016 03:38 PM, Joseph Salisbury wrote:
>> On 05/06/2016 03:13 PM, Boris Ostrovsky wrote:
>>> On 05/06/2016 02:48 PM, Thomas Gleixner wrote:
>>>> Yuck. That dies with a divide error. And that looks like XEN is supplying crap
>>>> data in the CPUID.
>>> Joe, do you have
>>>
>>> ed6069b xen/apic: Provide Xen-specific version of cpu_present_to_apicid
>>> APIC op
>>>
>>> -boris
>> Yes the commit is in the 4.4 based Ubuntu kernel.  This bug also happens
>> with the vanilla 4.6-rc5 kernel, which also has that commit.
>
> Can you post guest's cpuid -1 -r ? (I guess after you verify Thomas' patch)
>
> Thanks.
> -boris
>
>
>
Thomas' patch does resolve the bug.  The cpuid info can be seen here:
https://launchpadlibrarian.net/258234267/cpuid_full.txt

Thanks,

Joe

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [v4.6-rc1 Regression] x86/topology: Create logical package id
  2016-05-06 20:51         ` Joseph Salisbury
@ 2016-05-06 21:24           ` Boris Ostrovsky
  0 siblings, 0 replies; 11+ messages in thread
From: Boris Ostrovsky @ 2016-05-06 21:24 UTC (permalink / raw)
  To: Joseph Salisbury, Thomas Gleixner
  Cc: Peter Zijlstra (Intel), Andi Kleen, Andrew Morton,
	Andy Lutomirski, Arnaldo Carvalho de Melo, Borislav Petkov,
	Brian Gerst, Denys Vlasenko, H. Peter Anvin, Harish Chegondi,
	Jacob Pan, Jiri Olsa, Kan Liang, Linus Torvalds,
	Luis R. Rodriguez, Stephane Eranian, Toshi Kani, Vince Weaver,
	LKML, yingying.zhao, Zhang, Xiong Y, 1573231, 1397880,
	Ingo Molnar, x86, Andy Shevchenko, Chen Yucong, Laura Abbott,
	David Vrabel

On 05/06/2016 04:51 PM, Joseph Salisbury wrote:
> Thomas' patch does resolve the bug.  The cpuid info can be seen here:
> https://launchpadlibrarian.net/258234267/cpuid_full.txt

Any chance you could post it raw (cpuid -1 -r)?

Thanks.
-boris

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [v4.6-rc1 Regression] x86/topology: Create logical package id
  2016-05-06 18:48 ` Thomas Gleixner
  2016-05-06 19:13   ` Boris Ostrovsky
  2016-05-06 19:38   ` Joseph Salisbury
@ 2016-05-07  5:16   ` Ingo Molnar
  2016-05-07  8:12   ` [tip:x86/urgent] x86/topology: Handle CPUID bogosity gracefully tip-bot for Thomas Gleixner
  3 siblings, 0 replies; 11+ messages in thread
From: Ingo Molnar @ 2016-05-07  5:16 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Joseph Salisbury, Peter Zijlstra (Intel), Andi Kleen,
	Andrew Morton, Andy Lutomirski, Arnaldo Carvalho de Melo,
	Borislav Petkov, Brian Gerst, Denys Vlasenko, H. Peter Anvin,
	Harish Chegondi, Jacob Pan, Jiri Olsa, Kan Liang, Linus Torvalds,
	Luis R. Rodriguez, Stephane Eranian, Toshi Kani, Vince Weaver,
	LKML, yingying.zhao, Zhang, Xiong Y, 1573231, 1397880,
	Ingo Molnar, x86, Andy Shevchenko, Chen Yucong, Laura Abbott,
	Boris Ostrovsky, David Vrabel


* Thomas Gleixner <tglx@linutronix.de> wrote:

> > I was hoping to get your feedback, since you are the patch author.  Do
> > you think gathering any additional data will help diagnose this issue,
> > or would it be best to submit a revert request?
> 
> Yuck. That dies with a divide error. And that looks like XEN is supplying crap
> data in the CPUID.
> 
> Does the patch below cure the issue?
> 
> Thanks,
> 
>         tglx
> 
> 8<---------------
> 
> --- a/arch/x86/kernel/smpboot.c
> +++ b/arch/x86/kernel/smpboot.c
> @@ -332,6 +332,11 @@ static void __init smp_init_package_map(
>  	 * primary cores.
>  	 */
>  	ncpus = boot_cpu_data.x86_max_cores;
> +	if (!ncpus) {
> +		pr_warn("x86_max_cores == zero !?!?");
> +		ncpus = 1;
> +	}
> +

Even if the underlying Xen bug is fixed, I think we should add this protective 
measure to defend against future CPUID mishaps.

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [tip:x86/urgent] x86/topology: Handle CPUID bogosity gracefully
  2016-05-06 18:48 ` Thomas Gleixner
                     ` (2 preceding siblings ...)
  2016-05-07  5:16   ` Ingo Molnar
@ 2016-05-07  8:12   ` tip-bot for Thomas Gleixner
  3 siblings, 0 replies; 11+ messages in thread
From: tip-bot for Thomas Gleixner @ 2016-05-07  8:12 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: david.vrabel, hpa, peterz, joseph.salisbury, linux-kernel,
	boris.ostrovsky, tglx, mingo

Commit-ID:  56402d63eefe22179f7311a51ff2094731420406
Gitweb:     http://git.kernel.org/tip/56402d63eefe22179f7311a51ff2094731420406
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Fri, 6 May 2016 20:48:16 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Sat, 7 May 2016 10:06:55 +0200

x86/topology: Handle CPUID bogosity gracefully

Joseph reported that a XEN guest dies with a division by 0 in the package
topology setup code. This happens if cpu_info.x86_max_cores is zero.

Handle that case and emit a warning. This does not fix the underlying XEN bug,
but makes the code more robust.

Reported-and-tested-by: Joseph Salisbury <joseph.salisbury@canonical.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: David Vrabel <david.vrabel@citrix.com>
Link: http://lkml.kernel.org/r/alpine.DEB.2.11.1605062046270.3540@nanos
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 arch/x86/kernel/smpboot.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index a2065d3..0e4329e 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -332,6 +332,11 @@ static void __init smp_init_package_map(void)
 	 * primary cores.
 	 */
 	ncpus = boot_cpu_data.x86_max_cores;
+	if (!ncpus) {
+		pr_warn("x86_max_cores == zero !?!?");
+		ncpus = 1;
+	}
+
 	__max_logical_packages = DIV_ROUND_UP(total_cpus, ncpus);
 
 	/*

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-05-07  8:13 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-06 18:15 [v4.6-rc1 Regression] x86/topology: Create logical package id Joseph Salisbury
2016-05-06 18:48 ` Thomas Gleixner
2016-05-06 19:13   ` Boris Ostrovsky
2016-05-06 19:38     ` Joseph Salisbury
2016-05-06 20:46       ` Boris Ostrovsky
2016-05-06 20:51         ` Joseph Salisbury
2016-05-06 21:24           ` Boris Ostrovsky
2016-05-06 19:38   ` Joseph Salisbury
2016-05-06 20:50     ` Joseph Salisbury
2016-05-07  5:16   ` Ingo Molnar
2016-05-07  8:12   ` [tip:x86/urgent] x86/topology: Handle CPUID bogosity gracefully tip-bot for Thomas Gleixner

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).