x86/centaur: report correct CPU/cache topology
Quoted 12 lines
-----Original Mail-----
Sender: Thomas Gleixner [mailto:[email protected]]
Time: 2018年4月17日 18:16
Receiver: David Wang <[email protected]>
CC: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; brucechang@via- alliance.com; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] x86/centaur: report correct CPU/cache topology
Quoted 6 lines
Quoted 2 lines · David Wang
This patch is used to support multi-core Centaur CPU. After using this patch, we can get correct CPU topology and correct cache topology.
David. This changelog is pretty useless. First of all, please do not use
'This
Quoted 9 lines
patch ..'. We all know already that this is a patch.
Documentation/process/submitting-patches.rsthas a good explanation about writing changelogs.The changelog should explain why it does something. Let me give you an example:
Centaur CPUs enumerate the cache topology in the same way as Intel CPUs, but the functionality is unused so far. The Centaur init code also
misses
Quoted 7 lines
to initialize
x86_cpuinfo::max_coresso the CPU topology cannot be desribed correctly,Initialize
x86_cpuinfo::max_coresand invokeinit_intel_cacheinfo()to make CPU and cache topology information available and correct.See? I'm neither using 'this patch' nor 'We/I' as I'm not impersonatimg
the
Quoted 1 line
code. It's all factual instead.
OK. I got it.
Quoted 14 lines
arch/x86/kernel/cpu/centaur.c static void early_init_centaur(struct cpuinfo_x86
Quoted 10 lines
Signed-off-by David Wang <[email protected]>--- arch/x86/kernel/cpu/centaur.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)(quoted diff) +0
-0
b/arch/x86/kernel/cpu/centaur.cindex e5ec0f1..713e4db 100644arch/x86/kernel/cpu/centaur.c +0
-0@@ -112,6 +112,19 @@ static void early_init_centaur(struct cpuinfo_x86*c)
Quoted 3 lines
arch/x86/kernel/cpu/centaur.c +0
-0} }
Quoted 12 lines
arch/x86/kernel/cpu/centaur.c static void early_init_centaur(struct cpuinfo_x86 · line 124
Quoted 10 lines
arch/x86/kernel/cpu/centaur.c +10
-0+static int centaur_num_cpu_cores (struct cpuinfo_x86 *c) { +unsigned int eax, ebx, ecx, edx; + +if (c->cpuid_level <4 ) +return 1 ; +cpuid_count (4 ,0 , &eax, &ebx, &ecx, &edx); +if (eax &0x1f ) +return (eax >>26 ) +1 ; +else +return 1 ;This is a bad copy of
intel_num_cpu_cores(). See for the subtle
difference.
Quoted 2 lines
Please rename the intel function and move it to
common.c
OK. I will adjust.
Quoted 10 lines
arch/x86/kernel/cpu/centaur.c
Quoted 9 lines
arch/x86/kernel/cpu/centaur.c +0
-0static void init_centaur(struct cpuinfo_x86 *c) { #ifdef
CONFIG_X86_32@@ -128,6 +141,13 @@ static voidinit_centaur(struct cpuinfo_x86 *c)arch/x86/kernel/cpu/centaur.c +3
-0clear_cpu_cap (c,0 *32 +31 );#endif early_init_centaur (c); + +init_intel_cacheinfo (c); + c->x86_max_cores = centaur_num_cpu_cores(c); #ifdef
CONFIG_X86_32
Quoted 4 lines
arch/x86/kernel/cpu/centaur.c
Quoted 2 lines
arch/x86/kernel/cpu/centaur.c +2
-0+detect_ht (c); +#endif Can you please create a stub inline of
detect_ht()for the !32bit case and
get
Quoted 1 line
rid of these #ifdefs in the code. That wants to be a separate patch which
also
Quoted 1 line
cleans up the existing call sites.
The detect_ht() function will also be called by identify_cpu()
function for
!32bit case. So, I think it means that all 64-bit CPUs can usedetect_ht(),
but only some 32-bit CPUs can use detect_ht(). Please correct me, if I'm wrong.
Quoted 4 lines
Thanks,
tglx
Thanks,
---
David