Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1219363imm; Fri, 22 Jun 2018 12:27:07 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJZaGYlOqcWxGmzbgFqzJgiHCoktwIXs0JvWoer6d6djB/vOpmOXNoTZKb7n764KIxsjadv X-Received: by 2002:a17:902:6686:: with SMTP id e6-v6mr2956363plk.35.1529695627122; Fri, 22 Jun 2018 12:27:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529695627; cv=none; d=google.com; s=arc-20160816; b=MiYGanrxwJSwMCy0Aj1jkby19GnsJFZyc8Kn2X2aDF3dais/kMQX90UoG5OjnkMtTk P6GUEw8zuQ/oLovEV3+3YpPOYtsuB+8frebeK1o64QKS2iaUlfOcq//GVKaIgDz/ytjb 0oDyUoCy4MysjE+PrrrRf6qEaFfM1DsODQ62/26mlxdvzbPytpA/cd+8NeGsY3lwrp+t YmJpmvtXoiHk9sakg9as9TsKQlUFWooi1MASubwwg4gjRCOX4J1IbTs7f6Vaj9Oq4+eb xbRQzLxkiYd3I1pzw2yMQ3UTu/67rsxBQvqF8PuqX3FAhhEO73He03/0JrM+kPVTqIMN J8+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=PNiFYeAqVJCx5QNMwz8SyYStbk4I7gMWVF7oggzPYG4=; b=qbwIn3NgIt4uB4qLRhWcjRvevKKN7m+ytaWGkzsan6mnHoEPAF8UJHTju10xThMsPL JKgsyr4G1hSMrYEj4CkpD+SF2VFZ6Tdw/JfCHSV7CQHYrTzS/fehF1clRLd4iqUZY/kC xj2uSPZ4lrvxapjVZ01ii4uxc0Naz82gCjVo+dSEFSqgTEjaZYzFoB70m4eR2H6lnAqa suYsG00t0JjsEFe1tUGTIjTrJwqviYKHNDrrUznfLH4slgFbrflOSvYQJPYAE1HHIjQf 7259wGlBXgS9YJzEG91EvNRg7xWHVq3F6qfjwljN2Kwe/Ace6uwMUf9bOkE91zf34oza mpMQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y2-v6si6835192pgr.677.2018.06.22.12.26.52; Fri, 22 Jun 2018 12:27:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934354AbeFVTZC (ORCPT + 99 others); Fri, 22 Jun 2018 15:25:02 -0400 Received: from terminus.zytor.com ([198.137.202.136]:34917 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933382AbeFVTZB (ORCPT ); Fri, 22 Jun 2018 15:25:01 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w5MJOqSq184188 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 22 Jun 2018 12:24:52 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w5MJOpEb184185; Fri, 22 Jun 2018 12:24:51 -0700 Date: Fri, 22 Jun 2018 12:24:51 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Suravee Suthikulpanit Message-ID: Cc: suravee.suthikulpanit@amd.com, tglx@linutronix.de, bp@suse.de, mingo@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org Reply-To: bp@suse.de, hpa@zytor.com, mingo@kernel.org, linux-kernel@vger.kernel.org, suravee.suthikulpanit@amd.com, tglx@linutronix.de In-Reply-To: <1528915390-30533-1-git-send-email-suravee.suthikulpanit@amd.com> References: <1528915390-30533-1-git-send-email-suravee.suthikulpanit@amd.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/urgent] x86/CPU/AMD: Fix LLC ID bit-shift calculation Git-Commit-ID: 964d978433a4b9aa1368ff71227ca0027dd1e32f X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, T_DATE_IN_FUTURE_96_Q autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 964d978433a4b9aa1368ff71227ca0027dd1e32f Gitweb: https://git.kernel.org/tip/964d978433a4b9aa1368ff71227ca0027dd1e32f Author: Suravee Suthikulpanit AuthorDate: Wed, 13 Jun 2018 13:43:10 -0500 Committer: Thomas Gleixner 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 Signed-off-by: Borislav Petkov Signed-off-by: Thomas Gleixner 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; }