Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2458470imj; Mon, 18 Feb 2019 06:24:02 -0800 (PST) X-Google-Smtp-Source: AHgI3IZzorsj3oORAdtx0q+V2x9RptBACiDZOPuPELtqDitlfvNmtAyX/P494JifHvCqS2a3+La1 X-Received: by 2002:a65:48c1:: with SMTP id o1mr18327541pgs.94.1550499842676; Mon, 18 Feb 2019 06:24:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550499842; cv=none; d=google.com; s=arc-20160816; b=NuiYTKLut9KkVGDc06I/Phuc0HW1R3pmQ/yJXdtHkTphZc82bGbu/bsl4yFm0ZgUKc 7u82b4PCrwpjUQslbz8YJM9hoDWsXeklHO+LlelMf4iuBeYYOGuewmvKSn6/aPC4vxf6 vfyYMr2MhWh7k5dBBztv9e9zntctMblWL7XBD01rAK6g4be+2KNEmKn8WJpYiutVtApm Ck3morZ8nQtyQ2pRQWVU0Rt+/vs2wxu1tcCAkm5dLBWVhUCUUFk0uamLTdjOYG4Ykxvo LpU+whJGhCEhe6H8dAQGhgiwdUGgcC7ER5kha+fHH1E/v0By7WbzpsO+OsrnwIJcC/s3 SX6g== 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=xI28ZUggNyjs3wZhcjQVm7L7YbnhlB6lYYEr5pt//wA=; b=yuwqP3QNlw4Lw5iBWfrUptJYEX3COXV3bx2C3HK5rkk/cqkPRZEYs6w0GVS1vqfd7k 2DhP/kDzOj3VCyeNMpCcIdWZ7u5UXmYTtxCgmkYp1pkri8jRKHqqjvuq3uskTQA7ERpq 7LgMayGTskKD6DITMfSv+k+1O2oE9bTBEbNty4uVPi7yvHevwaTvRIZ+iEdbOeCAOU/Z WJk9S1BsQh4KXHMcVaGuAnf4Mn6ymqq9/Rzai59umfQYVav3bmaHUeuhRpkEJ/aEbl5/ 7Sl4ncMcapCNffeycYuv7xs24zN36STkWIwmlnQSv/ffsSAEWUnRad/gv571yjOpKLaU u1wQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=w4Ro4E3X; 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 a8si12201068pgw.380.2019.02.18.06.23.46; Mon, 18 Feb 2019 06:24:02 -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=w4Ro4E3X; 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 S2390024AbfBROWy (ORCPT + 99 others); Mon, 18 Feb 2019 09:22:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:47810 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389173AbfBROFG (ORCPT ); Mon, 18 Feb 2019 09:05:06 -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 70131204FD; Mon, 18 Feb 2019 14:05:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550498706; bh=mVYyiD8OaBRmO2F0joei9N9Gzki1VbM4jvmbMIVZaks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w4Ro4E3XZyo3Zqgmlll4QPhYMqAjp4B3PNKFiAmJz5/p+y1w+ICFF/d9RkSXg1L5i sM0MHiXpLm0KZn3LaupSJpyoNUd3/tVC1rhigzsUDAH2X9bZatYad7yQ387SwmyJfv zt6UxZzkGZcqlmW0RgEha9AvIAsRgLoJWOdWodXg= 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.4 094/143] perf/x86/intel/uncore: Add Node ID mask Date: Mon, 18 Feb 2019 14:43:42 +0100 Message-Id: <20190218133532.488169692@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218133529.099444112@linuxfoundation.org> References: <20190218133529.099444112@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.4-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/kernel/cpu/perf_event_intel_uncore_snbep.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- 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_pc .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 de 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)