Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1179335ybi; Fri, 2 Aug 2019 10:37:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqwKh6Lb8Vn39rfKF/QgfwY6+QXMfPxaxZ2FvKJVE6KLBPR0JOWw91wRAGf3wxv7SW5/CDWb X-Received: by 2002:a62:7a8a:: with SMTP id v132mr60693571pfc.103.1564767438068; Fri, 02 Aug 2019 10:37:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564767438; cv=none; d=google.com; s=arc-20160816; b=CRl3pRaHHe18hNuZvsI6+wc/gOsp2hIKDM/9IZ/sdef+8zJ3NFLhaPokjx65mCya0i GjzV1yRKt28MIQoyekik4At4EkPu4Hfe/NsHnBnv+ehQZayosF3DKDUhpWhXsWhSa4NO QkRmFcMfkF8j27B79IhOzURbrvljUlM4G3/i7Km8STrvKc6alYr8EXDLbCnrzdC8mZqt 92P/GCMdrdonoi9IFXYcDSnteT/3UURAHAvhi6By5ZdVoWybTcbTx7P9e3oRT8OzYiIx Qb0KP9rPCLtJhNbekN0cYs0Lu9npOWnKnALFJvTo4pZYREyvoIIQlV7kh3Q+W9XgT3YS JV8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1GDAHBH2IWmGPwvCEF5LGVMs22Tw7sGYHm5I6Nl9Mw0=; b=JVVuTAxHSn4znS2qrLLeQ/Qfo3IifNNXhAshJuUn5R1+U+2KsEt2mHBwEq+43SQA3L o7FPr+ScyGHj34S9kUfj4lq5X2rKCQlBnE7HJ+9CSAondOcXgGCbBOBM7IT3QMKg2oD5 4G1ctd94Az6YpPvO9JDaN2tbsd2wauccqw51H2sDkpoPI2Qg+tyqZUOelSS6Q61oclgG gDjT3x4h0jRoOfyXR4NiuWYZYn8vKFRySculFGE61ZeC0hUmmV2NP+u5MY3+e2MreOf9 IgxFuw8yx+EHzXF0bgCSn1dUoJt+xxZjST1tGJ5ZIZhpY7q2VfpBId6dR2WF4PoteKQR lHLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=iaezNV+c; 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 ay3si35499399plb.174.2019.08.02.10.37.02; Fri, 02 Aug 2019 10:37:18 -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; dkim=pass header.i=@kernel.org header.s=default header.b=iaezNV+c; 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 S2405734AbfHBJru (ORCPT + 99 others); Fri, 2 Aug 2019 05:47:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:52754 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405716AbfHBJrr (ORCPT ); Fri, 2 Aug 2019 05:47:47 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 54F8720B7C; Fri, 2 Aug 2019 09:47:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564739266; bh=fE9gGFqLUYNcZs02+L4GYrACGd/PvDwOY0Rqx2oGWv0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iaezNV+cK4/dFJsOy40Eu1eyB1wp3CjPI2y4rj/BICRPDCzl+bj8BvZkQKOlZ61cK YrwPdP4nlGUw7QxCEz42GqG83+VoMpat8X411g5Z/ndqFKh/tfAsRRgIvVi9u4zbnm NQMtNTX32p/VnghTb3BCaoTbWJJGm5O/khGFPzWI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Suravee Suthikulpanit , Borislav Petkov , Thomas Gleixner , "Peter Zijlstra (Intel)" , Janakarajan Natarajan Subject: [PATCH 4.9 153/223] perf/events/amd/uncore: Fix amd_uncore_llc ID to use pre-defined cpu_llc_id Date: Fri, 2 Aug 2019 11:36:18 +0200 Message-Id: <20190802092248.323135956@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190802092238.692035242@linuxfoundation.org> References: <20190802092238.692035242@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Current logic iterates over CPUID Fn8000001d leafs (Cache Properties) to detect the last level cache, and derive the last-level cache ID. However, this information is already available in the cpu_llc_id. Therefore, make use of it instead. Signed-off-by: Suravee Suthikulpanit Signed-off-by: Borislav Petkov Signed-off-by: Thomas Gleixner Cc: "Peter Zijlstra (Intel)" Cc: Janakarajan Natarajan Link: http://lkml.kernel.org/r/1524864877-111962-3-git-send-email-suravee.suthikulpanit@amd.com --- arch/x86/events/amd/uncore.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/arch/x86/events/amd/uncore.c b/arch/x86/events/amd/uncore.c index 10f023799f11..c16c99bc2a10 100644 --- a/arch/x86/events/amd/uncore.c +++ b/arch/x86/events/amd/uncore.c @@ -19,6 +19,7 @@ #include #include #include +#include #define NUM_COUNTERS_NB 4 #define NUM_COUNTERS_L2 4 @@ -377,26 +378,8 @@ static int amd_uncore_cpu_starting(unsigned int cpu) } if (amd_uncore_llc) { - unsigned int apicid = cpu_data(cpu).apicid; - unsigned int nshared, subleaf, prev_eax = 0; - uncore = *per_cpu_ptr(amd_uncore_llc, cpu); - /* - * Iterate over Cache Topology Definition leaves until no - * more cache descriptions are available. - */ - for (subleaf = 0; subleaf < 5; subleaf++) { - cpuid_count(0x8000001d, subleaf, &eax, &ebx, &ecx, &edx); - - /* EAX[0:4] gives type of cache */ - if (!(eax & 0x1f)) - break; - - prev_eax = eax; - } - nshared = ((prev_eax >> 14) & 0xfff) + 1; - - uncore->id = apicid - (apicid % nshared); + uncore->id = per_cpu(cpu_llc_id, cpu); uncore = amd_uncore_find_online_sibling(uncore, amd_uncore_llc); *per_cpu_ptr(amd_uncore_llc, cpu) = uncore; -- 2.20.1