Skip to content

Commit 9e63a78

Browse files
Kan LiangIngo Molnar
authored andcommitted
perf/x86/intel/uncore: Add Node ID mask
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 <songliubraving@fb.com> Tested-by: Song Liu <songliubraving@fb.com> Signed-off-by: Kan Liang <kan.liang@linux.intel.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: <stable@vger.kernel.org> # v3.7+ Fixes: 7c94ee2 ("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 <mingo@kernel.org>
1 parent 8834f56 commit 9e63a78

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

arch/x86/events/intel/uncore_snbep.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1222,6 +1222,8 @@ static struct pci_driver snbep_uncore_pci_driver = {
12221222
.id_table = snbep_uncore_pci_ids,
12231223
};
12241224

1225+
#define NODE_ID_MASK 0x7
1226+
12251227
/*
12261228
* build pci bus to socket mapping
12271229
*/
@@ -1243,7 +1245,7 @@ static int snbep_pci2phy_map_init(int devid, int nodeid_loc, int idmap_loc, bool
12431245
err = pci_read_config_dword(ubox_dev, nodeid_loc, &config);
12441246
if (err)
12451247
break;
1246-
nodeid = config;
1248+
nodeid = config & NODE_ID_MASK;
12471249
/* get the Node ID mapping */
12481250
err = pci_read_config_dword(ubox_dev, idmap_loc, &config);
12491251
if (err)

0 commit comments

Comments
 (0)