All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/intel_cacheinfo: Fix LLC topology for AMD Fam17h systems
@ 2015-11-03 19:15 Aravind Gopalakrishnan
  2015-11-03 19:27 ` kbuild test robot
  0 siblings, 1 reply; 5+ messages in thread
From: Aravind Gopalakrishnan @ 2015-11-03 19:15 UTC (permalink / raw)
  To: tglx, mingo, hpa, bp
  Cc: x86, sudeep.holla, akpm, geliangtang, tj, linux-kernel

On AMD Fam17h systems, the last level cache is not resident in
Northbridge. Therefore, we cannot assign cpu_llc_id to same
value as Node ID (as we have been doing currently)

We should rather look at the ApicID bits of the core to provide
us the last level cache ID info. Doing that here.

Signed-off-by: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
---
 arch/x86/kernel/cpu/intel_cacheinfo.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
index e38d338..897a483 100644
--- a/arch/x86/kernel/cpu/intel_cacheinfo.c
+++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
@@ -636,6 +636,9 @@ static int find_num_cache_leaves(struct cpuinfo_x86 *c)
 
 void init_amd_cacheinfo(struct cpuinfo_x86 *c)
 {
+	unsigned int cpu = c->cpu_index;
+	unsigned int apicid = c->apicid;
+	unsigned int socket_id, core_complex_id;
 
 	if (cpu_has_topoext) {
 		num_cache_leaves = find_num_cache_leaves(c);
@@ -645,6 +648,17 @@ void init_amd_cacheinfo(struct cpuinfo_x86 *c)
 		else
 			num_cache_leaves = 3;
 	}
+
+	/*
+	 * Fix percpu cpu_llc_id here as LLC topology is different
+	 * for Fam17h systems.
+	 */
+	 if (c->x86 != 0x17 || !cpuid_edx(0x80000006))
+		return;
+
+	socket_id = (apicid >> c->x86_coreid_bits) - 1;
+	core_complex_id = (apicid & ((1 << c->x86_coreid_bits) - 1)) >> 3;
+	per_cpu(cpu_llc_id, cpu) = (socket_id << 3) | core_complex_id;
 }
 
 unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c)
-- 
2.6.1


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

* Re: [PATCH] x86/intel_cacheinfo: Fix LLC topology for AMD Fam17h systems
  2015-11-03 19:15 [PATCH] x86/intel_cacheinfo: Fix LLC topology for AMD Fam17h systems Aravind Gopalakrishnan
@ 2015-11-03 19:27 ` kbuild test robot
  2015-11-03 19:41   ` Aravind Gopalakrishnan
  0 siblings, 1 reply; 5+ messages in thread
From: kbuild test robot @ 2015-11-03 19:27 UTC (permalink / raw)
  To: Aravind Gopalakrishnan
  Cc: kbuild-all, tglx, mingo, hpa, bp, x86, sudeep.holla, akpm,
	geliangtang, tj, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 828 bytes --]

Hi Aravind,

[auto build test ERROR on bp/for-next]
[also ERROR on: v4.3 next-20151103]

url:    https://github.com/0day-ci/linux/commits/Aravind-Gopalakrishnan/x86-intel_cacheinfo-Fix-LLC-topology-for-AMD-Fam17h-systems/20151104-031725
base:   https://github.com/0day-ci/linux Aravind-Gopalakrishnan/x86-intel_cacheinfo-Fix-LLC-topology-for-AMD-Fam17h-systems/20151104-031725
config: i386-tinyconfig (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   arch/x86/built-in.o: In function `init_amd_cacheinfo':
>> (.text+0x6aec): undefined reference to `cpu_llc_id'

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 6035 bytes --]

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

* Re: [PATCH] x86/intel_cacheinfo: Fix LLC topology for AMD Fam17h systems
  2015-11-03 19:27 ` kbuild test robot
@ 2015-11-03 19:41   ` Aravind Gopalakrishnan
  2015-11-03 19:52     ` Borislav Petkov
  0 siblings, 1 reply; 5+ messages in thread
From: Aravind Gopalakrishnan @ 2015-11-03 19:41 UTC (permalink / raw)
  To: kbuild test robot
  Cc: kbuild-all, tglx, mingo, hpa, bp, x86, sudeep.holla, akpm,
	geliangtang, tj, linux-kernel

On 11/3/2015 1:27 PM, kbuild test robot wrote:
> Hi Aravind,
>
> [auto build test ERROR on bp/for-next]
> [also ERROR on: v4.3 next-20151103]
>
> url:    https://github.com/0day-ci/linux/commits/Aravind-Gopalakrishnan/x86-intel_cacheinfo-Fix-LLC-topology-for-AMD-Fam17h-systems/20151104-031725
> base:   https://github.com/0day-ci/linux Aravind-Gopalakrishnan/x86-intel_cacheinfo-Fix-LLC-topology-for-AMD-Fam17h-systems/20151104-031725
> config: i386-tinyconfig (attached as .config)
> reproduce:
>          # save the attached .config to linux build tree
>          make ARCH=i386
>
> All errors (new ones prefixed by >>):
>
>     arch/x86/built-in.o: In function `init_amd_cacheinfo':
>>> (.text+0x6aec): undefined reference to `cpu_llc_id'
>

Thanks for the catch!

cpu_llc_id references should be wrapped under #ifdef CONFIG_SMP.

Did that and kernel build worked with the attached config.

Will send a V2 with the fix.

Thanks,
-Aravind.

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

* Re: [PATCH] x86/intel_cacheinfo: Fix LLC topology for AMD Fam17h systems
  2015-11-03 19:41   ` Aravind Gopalakrishnan
@ 2015-11-03 19:52     ` Borislav Petkov
  2015-11-03 19:58       ` Aravind Gopalakrishnan
  0 siblings, 1 reply; 5+ messages in thread
From: Borislav Petkov @ 2015-11-03 19:52 UTC (permalink / raw)
  To: Aravind Gopalakrishnan
  Cc: kbuild test robot, kbuild-all, tglx, mingo, hpa, bp, x86,
	sudeep.holla, akpm, geliangtang, tj, linux-kernel

On Tue, Nov 03, 2015 at 01:41:53PM -0600, Aravind Gopalakrishnan wrote:
> cpu_llc_id references should be wrapped under #ifdef CONFIG_SMP.
> 
> Did that and kernel build worked with the attached config.
> 
> Will send a V2 with the fix.

Why aren't you doing all that figuring out what the llc_id is in
amd_detect_cmp() which is already CONFIG_SMP ifdeffed?

Which is where that code belongs anyway...

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.

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

* Re: [PATCH] x86/intel_cacheinfo: Fix LLC topology for AMD Fam17h systems
  2015-11-03 19:52     ` Borislav Petkov
@ 2015-11-03 19:58       ` Aravind Gopalakrishnan
  0 siblings, 0 replies; 5+ messages in thread
From: Aravind Gopalakrishnan @ 2015-11-03 19:58 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: kbuild test robot, kbuild-all, tglx, mingo, hpa, bp, x86,
	sudeep.holla, akpm, geliangtang, tj, linux-kernel

On 11/3/2015 1:52 PM, Borislav Petkov wrote:
> On Tue, Nov 03, 2015 at 01:41:53PM -0600, Aravind Gopalakrishnan wrote:
>> cpu_llc_id references should be wrapped under #ifdef CONFIG_SMP.
>>
>> Did that and kernel build worked with the attached config.
>>
>> Will send a V2 with the fix.
> Why aren't you doing all that figuring out what the llc_id is in
> amd_detect_cmp() which is already CONFIG_SMP ifdeffed?
>
> Which is where that code belongs anyway...
>

Since we needed to modify last level cache IDs, I thought 
init_amd_cacheinfo() might be a logical place to put it.

But you are right, makes sense to move it to amd_detect_cmp().
I'll do that in V2.

Thanks,
-Aravind.

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

end of thread, other threads:[~2015-11-03 19:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-03 19:15 [PATCH] x86/intel_cacheinfo: Fix LLC topology for AMD Fam17h systems Aravind Gopalakrishnan
2015-11-03 19:27 ` kbuild test robot
2015-11-03 19:41   ` Aravind Gopalakrishnan
2015-11-03 19:52     ` Borislav Petkov
2015-11-03 19:58       ` Aravind Gopalakrishnan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.