Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2714809imj; Mon, 11 Feb 2019 07:24:06 -0800 (PST) X-Google-Smtp-Source: AHgI3IYJ9mD/YX4Xx2jKYCUFpoap/X7x3MI+ssDgoLr4ZCrA5mZpZ9/ZrFdNsT978Gq00GzJ93fn X-Received: by 2002:a17:902:b615:: with SMTP id b21mr32260116pls.338.1549898646470; Mon, 11 Feb 2019 07:24:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549898646; cv=none; d=google.com; s=arc-20160816; b=eiWk7+cC8a1YbjRdbYaPm5MfZ5fLYcq7ImSS1j6HLTOpBg6+HCNDNu3WS17jPRzp7D Vvuk68+R1UvCzDD54bfrv8y6BA6APbQzC8bQG/74P0dBF7IHtvzNOQFjZS/rZb+1zcwP txytyxo5K9Qqk0YsJigznGirHJDdAqpnUfur8hjLk3/W5ZTiU+yIMYBkWXsIgOiwMGwX m5GINX3oZAJpRon+kxQCmjcP0kDKwjmb7E0ELhbz+Dw8AecRMnCYj8fByKZI09Y5nF4h idMJYypi3rPqBnk8KwoJTYKI8vWYUvQTHyC0qO6982opbhD5aYrnMekMBjvUmIVGL6PH 0VPA== 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=4D8LmrUDpFrt4E7b1xOj0/tXaZsyiv4eacKR+AP+HDc=; b=AvlWtOJUGbNOQFa1tefe1ElB/3Xe0DJpP92IxIIgn8d+v2JgFEN5wy4/zyvSBqL9wC TIcDO9RFo6w/vyruvVKDdQBl1WzKorGcm3bUyG7X3GiBSR3ai7lP603JVBndcLF+WVT+ 7Vk2Mfv6EGPf3yJOEa0zBdcGRgZTwNL2QNmpjuvgs2Q1vj+vElAJ0n0WUQvzsxLGpoHC R/GciOTn4InShPZ8VXuyxdJjNKc2yssm5+kEuzGCu2MdRTki5MVMg+WZTYLFYFK5ZaMh oXSbCwFnOYnWATpsM1MKvQu6wwtq5nm7nvbFCBkn3fX2XJHB04GikTArP5vC7ZVbkTE7 vN7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xg8U65Xt; 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 d13si10258979plr.403.2019.02.11.07.23.50; Mon, 11 Feb 2019 07:24:06 -0800 (PST) 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=xg8U65Xt; 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 S2391920AbfBKPW4 (ORCPT + 99 others); Mon, 11 Feb 2019 10:22:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:52262 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390652AbfBKPDf (ORCPT ); Mon, 11 Feb 2019 10:03:35 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 D52E8222B5; Mon, 11 Feb 2019 15:03:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549897415; bh=xb8K4WplBUz8MhpTMWm/UXJHim8mfzicEkObr2l7gsU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xg8U65Xtte5SHz4Rva4riZf7w+JtbtQawajou61xhfoRgkPBBcpqUagnjR3TyuVpI yyfxhp14r/NnbQ61vfzPHtSprWftRa+nSt7khJ8Ur3P6eLjKxyyGrtW5by6NQMaanB 7yyOXcsksCGP8Q3RzBRGGW15ycSWDxnrTBVA4SKQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Song Liu , Kan Liang , "Peter Zijlstra (Intel)" , Alexander Shishkin , Arnaldo Carvalho de Melo , Jiri Olsa , Linus Torvalds , Thomas Gleixner , Ingo Molnar Subject: [PATCH 4.14 196/205] perf/x86/intel/uncore: Add Node ID mask Date: Mon, 11 Feb 2019 15:19:54 +0100 Message-Id: <20190211141841.238833344@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141827.214852402@linuxfoundation.org> References: <20190211141827.214852402@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kan Liang commit 9e63a7894fd302082cf3627fe90844421a6cbe7f upstream. Some PCI uncore PMUs cannot be registered on an 8-socket system (HPE Superdome Flex). To understand which Socket the PCI uncore PMUs belongs 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, an incorrect Node ID will be fetched. Filter the Node ID by adding a mask. Reported-by: Song Liu Tested-by: Song Liu Signed-off-by: Kan Liang Signed-off-by: Peter Zijlstra (Intel) Cc: Alexander Shishkin Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: # v3.7+ Fixes: 7c94ee2e0917 ("perf/x86: Add Intel Nehalem and Sandy Bridge-EP uncore support") Link: https://lkml.kernel.org/r/1548600794-33162-1-git-send-email-kan.liang@linux.intel.com Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- arch/x86/events/intel/uncore_snbep.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/arch/x86/events/intel/uncore_snbep.c +++ b/arch/x86/events/intel/uncore_snbep.c @@ -1221,6 +1221,8 @@ static struct pci_driver snbep_uncore_pc .id_table = snbep_uncore_pci_ids, }; +#define NODE_ID_MASK 0x7 + /* * build pci bus to socket mapping */ @@ -1242,7 +1244,7 @@ static int snbep_pci2phy_map_init(int de err = pci_read_config_dword(ubox_dev, nodeid_loc, &config); if (err) break; - nodeid = config; + nodeid = config & NODE_ID_MASK; /* get the Node ID mapping */ err = pci_read_config_dword(ubox_dev, idmap_loc, &config); if (err)