public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Suravee Suthikulpanit <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: suravee.suthikulpanit@amd.com, tglx@linutronix.de, bp@suse.de,
	mingo@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org
Subject: [tip:x86/urgent] x86/CPU/AMD: Fix LLC ID bit-shift calculation
Date: Fri, 22 Jun 2018 12:24:51 -0700	[thread overview]
Message-ID: <tip-964d978433a4b9aa1368ff71227ca0027dd1e32f@git.kernel.org> (raw)
In-Reply-To: <1528915390-30533-1-git-send-email-suravee.suthikulpanit@amd.com>

Commit-ID:  964d978433a4b9aa1368ff71227ca0027dd1e32f
Gitweb:     https://git.kernel.org/tip/964d978433a4b9aa1368ff71227ca0027dd1e32f
Author:     Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
AuthorDate: Wed, 13 Jun 2018 13:43:10 -0500
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 22 Jun 2018 21:21:49 +0200

x86/CPU/AMD: Fix LLC ID bit-shift calculation

The current logic incorrectly calculates the LLC ID from the APIC ID.

Unless specified otherwise, the LLC ID should be calculated by removing
the Core and Thread ID bits from the least significant end of the APIC
ID. For more info, see "ApicId Enumeration Requirements" in any Fam17h
PPR document.

[ bp: Improve commit message. ]

Fixes: 68091ee7ac3c ("Calculate last level cache ID from number of sharing threads")
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1528915390-30533-1-git-send-email-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 38354c66df81..0c5fcbd998cf 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;
 		}

      parent reply	other threads:[~2018-06-22 19:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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-bot for Suravee Suthikulpanit [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-964d978433a4b9aa1368ff71227ca0027dd1e32f@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=bp@suse.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox