Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0831C169C4 for ; Tue, 29 Jan 2019 16:40:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 97B572087F for ; Tue, 29 Jan 2019 16:40:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726752AbfA2Qkg (ORCPT ); Tue, 29 Jan 2019 11:40:36 -0500 Received: from mga07.intel.com ([134.134.136.100]:16011 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726374AbfA2Qkg (ORCPT ); Tue, 29 Jan 2019 11:40:36 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Jan 2019 08:40:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,537,1539673200"; d="scan'208";a="138876493" Received: from linux.intel.com ([10.54.29.200]) by fmsmga002.fm.intel.com with ESMTP; 29 Jan 2019 08:40:34 -0800 Received: from [10.254.84.216] (kliang2-mobl1.ccr.corp.intel.com [10.254.84.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by linux.intel.com (Postfix) with ESMTPS id C2BFF580569; Tue, 29 Jan 2019 08:40:33 -0800 (PST) Subject: Re: [PATCH] perf/x86/intel/uncore: Add Node ID mask To: Sasha Levin , tglx@linutronix.de, peterz@infradead.org, mingo@redhat.com Cc: ak@linux.intel.com, songliubraving@fb.com, stable@vger.kernel.org References: <1548600794-33162-1-git-send-email-kan.liang@linux.intel.com> <20190129003519.ECAE32177E@mail.kernel.org> From: "Liang, Kan" Message-ID: Date: Tue, 29 Jan 2019 11:40:29 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190129003519.ECAE32177E@mail.kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On 1/28/2019 7:35 PM, Sasha Levin wrote: > Hi, > > [This is an automated email] > > This commit has been processed because it contains a "Fixes:" tag, > fixing commit: 7c94ee2e0917 perf/x86: Add Intel Nehalem and Sandy Bridge-EP uncore support. > > The bot has tested the following trees: v4.20.5, v4.19.18, v4.14.96, v4.9.153, v4.4.172, v3.18.133. > > v4.20.5: Build OK! > v4.19.18: Build OK! > v4.14.96: Build OK! > v4.9.153: Build OK! > v4.4.172: Failed to apply! Possible dependencies: > Unable to calculate > > v3.18.133: Failed to apply! Possible dependencies: > Unable to calculate > > > How should we proceed with this patch? > Here is the backport patch for 4.4 and 3.18. From 21eb165d645a48fb31efed75902f892986449bb0 Mon Sep 17 00:00:00 2001 From: Kan Liang Date: Tue, 29 Jan 2019 08:35:03 -0800 Subject: [PATCH] perf/x86/intel/uncore: Add Node ID mask Some PCI uncore PMUs cannot be registered on a 8-socket system (HPE Superdome Flex). To understand which Socket the PCI uncore PMUs belong to, perf retrieves the local Node ID of the uncore device from CPUNODEID(0xC0) of the PCI configuration space, and the mapping between Socket ID and Node ID from GIDNIDMAP(0xD4). The Socket ID can be calculated accordingly. The local Node ID is only available at bit 2:0, but current code doesn't mask it. If a BIOS doesn't clear the rest of the bits, a wrong Node ID will be fetched. Filter the Node ID by adding a mask. Fixes: 7c94ee2e0917 ("perf/x86: Add Intel Nehalem and Sandy Bridge-EP uncore support") Reported-by: Song Liu Tested-by: Song Liu Signed-off-by: Kan Liang Acked-by: Song Liu Cc: stable@vger.kernel.org --- arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c b/arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c index f0f4fcb..9475794 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c +++ b/arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c @@ -1081,6 +1081,8 @@ static struct pci_driver snbep_uncore_pci_driver = { .id_table = snbep_uncore_pci_ids, }; +#define NODE_ID_MASK 0x7 + /* * build pci bus to socket mapping */ @@ -1102,7 +1104,7 @@ static int snbep_pci2phy_map_init(int devid) err = pci_read_config_dword(ubox_dev, 0x40, &config); if (err) break; - nodeid = config; + nodeid = config & NODE_ID_MASK; /* get the Node ID mapping */ err = pci_read_config_dword(ubox_dev, 0x54, &config); if (err) -- 2.7.4