Re: Only one core of four since kernel 4.9

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Got a kernel 4.9.5 running now with all my four cores.
I created a small patch which work but may be not the correct way to solve this issue.

kind regards
Martin

On 21.01.2017 19:06, Martin Regner wrote:
Hi again,

I fiddled around a little bit and added some logging.

This shows a strange thing:

[ 0.000000] DONMARTIO apicid 5
[ 0.000000] DONMARTIO physical_apicid 16
[ 0.000000] DONMARTIO logical cpuids 1
[ 0.000000] DONMARTIO disabled cpus 1
[ 0.000000] DONMARTIO cpu 1
[ 0.000000] DONMARTIO apicid 6
[ 0.000000] DONMARTIO physical_apicid 16
[ 0.000000] DONMARTIO logical cpuids 2
[ 0.000000] DONMARTIO disabled cpus 2
[ 0.000000] DONMARTIO cpu 2
[ 0.000000] DONMARTIO apicid 7
[ 0.000000] DONMARTIO physical_apicid 16
[ 0.000000] DONMARTIO logical cpuids 3
[ 0.000000] DONMARTIO disabled cpus 3
[ 0.000000] DONMARTIO cpu 3
[ 0.000000] DONMARTIO apicid 8
[ 0.000000] DONMARTIO physical_apicid 16
[ 0.000000] DONMARTIO logical cpuids 4
[ 0.000000] DONMARTIO disabled cpus 4
[ 0.000000] DONMARTIO cpu 4
[ 0.000000] DONMARTIO apicid 16
[ 0.000000] DONMARTIO physical_apicid 16
[ 0.000000] DONMARTIO disabled cpus 4
[ 0.000000] DONMARTIO cpu 0
[ 0.000000] DONMARTIO apicid 17
[ 0.000000] DONMARTIO physical_apicid 16
[ 0.000000] DONMARTIO logical cpuids 5
[ 0.000000] DONMARTIO disabled cpus 4
[ 0.000000] DONMARTIO cpu 5
[ 0.000000] DONMARTIO apicid 18
[ 0.000000] DONMARTIO physical_apicid 16
[ 0.000000] DONMARTIO logical cpuids 6
[ 0.000000] DONMARTIO disabled cpus 4
[ 0.000000] DONMARTIO cpu 6
[ 0.000000] DONMARTIO apicid 19
[ 0.000000] DONMARTIO physical_apicid 16
[ 0.000000] DONMARTIO logical cpuids 7
[ 0.000000] DONMARTIO disabled cpus 4
[ 0.000000] DONMARTIO cpu 7


The system checks eight cpu's on my quadcore. The first four are disabled.

If i add this line

if(apicid < 16) return -ENODEV;

at the beginning of the function __generic_processor_info, i get all 4 cores. (I took the 16, because i know the lowest apicid from the kernel 4.8.17 output).

I'm really curious what's going wrong here.

Kind regards
Martin


On 20.01.2017 07:33, DonMartio wrote:
Hi,

since kernel 4.9 only one core is recognized of my AMD FX(tm)-4100 Quad-Core Processor. I discussed this here <https://forums.gentoo.org/viewtopic-t-1056638-start-25-postdays-0-postorder-asc-highlight-.html> first and tried a lot of thinks without any luck.

One tip of another user was to do a bisect first and then file a possible bug. I did that with kernel 4.8.17 (which works) and 4.9 and came finally to the following commit:

[8f54969dc8d6704632b42cbb5e47730cd75cc713] x86/acpi: Introduce persistent storage for cpuid <-> apicid mapping
8f54969dc8d6704632b42cbb5e47730cd75cc713 is the first bad commit
commit 8f54969dc8d6704632b42cbb5e47730cd75cc713
Author: Gu Zheng<guz.fnst@xxxxxxxxxxxxxx>
Date:   Thu Aug 25 16:35:16 2016 +0800

    x86/acpi: Introduce persistent storage for cpuid <-> apicid mapping

The whole patch-set aims at making cpuid <-> nodeid mapping persistent. So that, when node online/offline happens, cache based on cpuid <-> nodeid mapping such as
    wq_numa_possible_cpumask will not cause any problem.
    It contains 4 steps:
1. Enable apic registeration flow to handle both enabled and disabled cpus. 2. Introduce a new array storing all possible cpuid <-> apicid mapping. 3. Enable _MAT and MADT relative apis to return non-present or disabled cpus' apicid.
    4. Establish all possible cpuid <-> nodeid mapping.

    This patch finishes step 2.

In this patch, we introduce a new static array named cpuid_to_apicid[],
    which is large enough to store info for all possible cpus.

And then, we modify the cpuid calculation. In generic_processor_info(), it simply finds the next unused cpuid. And it is also why the cpuid <-> nodeid
    mapping changes with node hotplug.

After this patch, we find the next unused cpuid, map it to an apicid,
    and store the mapping in cpuid_to_apicid[], so that cpuid <-> apicid
    mapping will be persistent.

And finally we will use this array to make cpuid <-> nodeid persistent.

cpuid <-> apicid mapping is established at local apic registeration time.
    But non-present or disabled cpus are ignored.

In this patch, we establish all possible cpuid <-> apicid mapping when
    registering local apic.

    Signed-off-by: Gu Zheng<guz.fnst@xxxxxxxxxxxxxx>
    Signed-off-by: Tang Chen<tangchen@xxxxxxxxxxxxxx>
    Signed-off-by: Zhu Guihua<zhugh.fnst@xxxxxxxxxxxxxx>
    Signed-off-by: Dou Liyang<douly.fnst@xxxxxxxxxxxxxx>
    Acked-by: Ingo Molnar<mingo@xxxxxxxxxx>
    Cc:mika.j.penttila@xxxxxxxxx
    Cc:len.brown@xxxxxxxxx
    Cc:rafael@xxxxxxxxxx
    Cc:rjw@xxxxxxxxxxxxx
    Cc:yasu.isimatu@xxxxxxxxx
    Cc:linux-mm@xxxxxxxxx
    Cc:linux-acpi@xxxxxxxxxxxxxxx
    Cc:isimatu.yasuaki@xxxxxxxxxxxxxx
    Cc:gongzhaogang@xxxxxxxxxx
    Cc:tj@xxxxxxxxxx
    Cc:izumi.taku@xxxxxxxxxxxxxx
    Cc:cl@xxxxxxxxx
    Cc:chen.tang@xxxxxxxxxxxx
    Cc:akpm@xxxxxxxxxxxxxxxxxxxx
    Cc:kamezawa.hiroyu@xxxxxxxxxxxxxx
    Cc:lenb@xxxxxxxxxx
Link:http://lkml.kernel.org/r/1472114120-3281-4-git-send-email-douly.fnst@xxxxxxxxxxxxxx
    Signed-off-by: Thomas Gleixner<tglx@xxxxxxxxxxxxx>

Is my cpuid missing in the mapping mentioned above?

~ # lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                4
On-line CPU(s) list:   0-3
Thread(s) per core:    2
Core(s) per socket:    2
Socket(s):             1
Vendor ID:             AuthenticAMD
CPU family:            21
Model:                 1
Model name:            AMD FX(tm)-4100 Quad-Core Processor
Stepping:              2
CPU MHz:               3600.000
CPU max MHz:           3600,0000
CPU min MHz:           1400,0000
BogoMIPS:              7183.66
Virtualization:        AMD-V
L1d cache:             16K
L1i cache:             64K
L2 cache:              2048K
L3 cache:              8192K
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc extd_apicid aperfmperf eagerfpu pni pclmulqdq monitor ssse3 cx16 sse4_1 sse4_2 popcnt aes xsave avx lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs xop skinit wdt lwp fma4 nodeid_msr topoext perfctr_core perfctr_nb cpb hw_pstate vmmcall arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold


Or do i miss some new kernel config option?
Do you need more information?

Thanks in advance
Martin



diff -urN a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
--- a/arch/x86/kernel/apic/apic.c	2017-01-20 21:12:10.000000000 +0100
+++ b/arch/x86/kernel/apic/apic.c	2017-01-22 15:06:45.058115715 +0100
@@ -2150,6 +2150,10 @@
 
 		/* Logical cpuid 0 is reserved for BSP. */
 		cpuid_to_apicid[0] = apicid;
+	} else if(!boot_cpu_detected) {
+		pr_warning("APIC: physical cpu not yet deteced. apicid is %d, physical apicid is %d.\n", 
+			apicid, boot_cpu_physical_apicid);
+		return -EINVAL;
 	} else {
 		cpu = allocate_logical_cpuid(apicid);
 		if (cpu < 0) {

[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux