Commit-ID: 8dfeae0d73bf803be1a533e147b3b0ea69375596 Gitweb: http://git.kernel.org/tip/8dfeae0d73bf803be1a533e147b3b0ea69375596 Author: Huang Rui <ray.hu...@amd.com> AuthorDate: Thu, 14 Jan 2016 10:50:04 +0800 Committer: Ingo Molnar <mi...@kernel.org> CommitDate: Mon, 21 Mar 2016 09:08:22 +0100
perf/x86/amd: Move nodes_per_socket into bsp_init_amd() nodes_per_socket is static and it needn't be initialized many times during every CPU core init. So move its initialization into bsp_init_amd(). Signed-off-by: Huang Rui <ray.hu...@amd.com> Signed-off-by: Borislav Petkov <b...@suse.de> Cc: Aaron Lu <aaron...@intel.com> Cc: Alexander Shishkin <alexander.shish...@linux.intel.com> Cc: Andreas Herrmann <herrmann.der.u...@googlemail.com> Cc: Andy Lutomirski <l...@amacapital.net> Cc: Andy Lutomirski <l...@kernel.org> Cc: Aravind Gopalakrishnan <aravind.gopalakrish...@amd.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: Borislav Petkov <b...@alien8.de> Cc: Brian Gerst <brge...@gmail.com> Cc: David Ahern <dsah...@gmail.com> Cc: Denys Vlasenko <dvlas...@redhat.com> Cc: Fengguang Wu <fengguang...@intel.com> Cc: Frédéric Weisbecker <fweis...@gmail.com> Cc: Guenter Roeck <li...@roeck-us.net> Cc: H. Peter Anvin <h...@zytor.com> Cc: Hector Marco-Gisbert <hecma...@upv.es> Cc: Jacob Shin <jacob.w.s...@gmail.com> Cc: Jiri Olsa <jo...@redhat.com> Cc: John Stultz <john.stu...@linaro.org> Cc: Linus Torvalds <torva...@linux-foundation.org> Cc: Namhyung Kim <namhy...@kernel.org> Cc: Peter Zijlstra <pet...@infradead.org> Cc: Robert Richter <r...@kernel.org> Cc: Stephane Eranian <eran...@google.com> Cc: Suravee Suthikulpanit <suravee.suthikulpa...@amd.com> Cc: Thomas Gleixner <t...@linutronix.de> Cc: Vince Weaver <vincent.wea...@maine.edu> Cc: spg_linux_ker...@amd.com Link: http://lkml.kernel.org/r/1452739808-11871-2-git-send-email-ray.hu...@amd.com Signed-off-by: Ingo Molnar <mi...@kernel.org> --- arch/x86/kernel/cpu/amd.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index b39338c..d4b06e8 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -306,7 +306,6 @@ static void amd_get_topology(struct cpuinfo_x86 *c) u32 eax, ebx, ecx, edx; cpuid(0x8000001e, &eax, &ebx, &ecx, &edx); - nodes_per_socket = ((ecx >> 8) & 7) + 1; node_id = ecx & 7; /* get compute unit information */ @@ -317,7 +316,6 @@ static void amd_get_topology(struct cpuinfo_x86 *c) u64 value; rdmsrl(MSR_FAM10H_NODE_ID, value); - nodes_per_socket = ((value >> 3) & 7) + 1; node_id = value & 7; } else return; @@ -519,6 +517,18 @@ static void bsp_init_amd(struct cpuinfo_x86 *c) if (cpu_has(c, X86_FEATURE_MWAITX)) use_mwaitx_delay(); + + if (boot_cpu_has(X86_FEATURE_TOPOEXT)) { + u32 ecx; + + ecx = cpuid_ecx(0x8000001e); + nodes_per_socket = ((ecx >> 8) & 7) + 1; + } else if (boot_cpu_has(X86_FEATURE_NODEID_MSR)) { + u64 value; + + rdmsrl(MSR_FAM10H_NODE_ID, value); + nodes_per_socket = ((value >> 3) & 7) + 1; + } } static void early_init_amd(struct cpuinfo_x86 *c)