public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/CPU/AMD: Fix LLC ID bit-shift calculation
@ 2018-06-13 18:43 Suravee Suthikulpanit
  2018-06-18 17:20 ` Borislav Petkov
  2018-06-22 19:24 ` [tip:x86/urgent] " tip-bot for Suravee Suthikulpanit
  0 siblings, 2 replies; 7+ messages in thread
From: Suravee Suthikulpanit @ 2018-06-13 18:43 UTC (permalink / raw)
  To: x86, linux-kernel; +Cc: tglx, mingo, bp, bp, Suravee Suthikulpanit

The current logic incorrectly calculates the LLC ID from the APIC ID.
Unless specified otherwise, the LLC ID should be calculated from
the count order of the number of threads sharing cache.

Fixes: 68091ee7ac3c ("Calculate last level cache ID from number of sharing threads")
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
---
 arch/x86/kernel/cpu/cacheinfo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/cacheinfo.c b/arch/x86/kernel/cpu/cacheinfo.c
index 38354c6..0c5fcbd 100644
--- a/arch/x86/kernel/cpu/cacheinfo.c
+++ b/arch/x86/kernel/cpu/cacheinfo.c
@@ -671,7 +671,7 @@ void cacheinfo_amd_init_llc_id(struct cpuinfo_x86 *c, int cpu, u8 node_id)
 			num_sharing_cache = ((eax >> 14) & 0xfff) + 1;
 
 		if (num_sharing_cache) {
-			int bits = get_count_order(num_sharing_cache) - 1;
+			int bits = get_count_order(num_sharing_cache);
 
 			per_cpu(cpu_llc_id, cpu) = c->apicid >> bits;
 		}
-- 
2.7.4


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

end of thread, other threads:[~2018-06-22 19:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-13 18:43 [PATCH] x86/CPU/AMD: Fix LLC ID bit-shift calculation Suravee Suthikulpanit
2018-06-18 17:20 ` Borislav Petkov
2018-06-18 18:14   ` Suthikulpanit, Suravee
2018-06-18 18:23     ` Borislav Petkov
2018-06-18 18:46       ` Suthikulpanit, Suravee
2018-06-18 18:57         ` Borislav Petkov
2018-06-22 19:24 ` [tip:x86/urgent] " tip-bot for Suravee Suthikulpanit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox