perf/x86/intel/uncore: Add Node ID mask
Subsystems (3)
PATCH 1/1 perf/x86/intel/uncore: Add Node ID mask
From: Kan Liang <[email protected]>
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.
--- arch/x86/events/intel/uncore_snbep.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/x86/events/intel/uncore_snbep.c +3 -1
@@ -1222,6 +1222,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 */
@@ -1243,7 +1245,7 @@ static int snbep_pci2phy_map_init(int devid, int nodeid_loc, int idmap_loc, bool 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)
Signature · 1 line
2.7.4
Quoted 17 lines · On Jan 27, 2019, at 6:53 AM, [email protected] wrote:
From: Kan Liang <[email protected]>
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.
Quoted 7 lines
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 <[email protected]>Tested-by Song Liu <[email protected]>Signed-off-by Kan Liang <[email protected]>
Thanks Kan!
Quoted 29 lines
---
arch/x86/events/intel/uncore_snbep.c| 4 +++-1 file changed, 3 insertions(+), 1 deletion(-)arch/x86/events/intel/uncore_snbep.c +3
-1@@ -1222,6 +1222,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 */ @@ -1243,7 +1245,7 @@ static int snbep_pci2phy_map_init(int devid, int nodeid_loc, int idmap_loc, bool 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)Signature · 1 line
2.7.4
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 16 lines · Sasha Levin
Hi,
[This is an automated email]
This commit has been processed because it contains a "Fixes:" tag,
fixing commit:7c94ee2e0917perf/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
Quoted 6 lines
v3.18.133: Failed to apply! Possible dependencies:
Unable to calculateHow 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 <[email protected]>
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.
--- arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c +3 -1
@@ -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)
Signature · 1 line
2.7.4
Quoted 76 lines · Kan
Quoted 6 lines · Sasha Levin
Hi,
[This is an automated email]
This commit has been processed because it contains a "Fixes:" tag,
fixing commit:7c94ee2e0917perf/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!Quoted 9 lines
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
21eb165d645a48fb31efed75902f892986449bb0Mon Sep 17 00:00:00 2001
From: Kan Liang <[email protected]>
Date: Tue, 29 Jan 2019 08:35:03 -0800
Subject: [PATCH] perf/x86/intel/uncore: Add Node ID maskSome 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 <[email protected]>Tested-by Song Liu <[email protected]>Signed-off-by Kan Liang <[email protected]>Acked-by Song Liu <[email protected]>---
arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c| 4 +++-1 file changed, 3 insertions(+), 1 deletion(-)arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c +3
-1@@ -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)Signature · 1 line
2.7.4
Is this patch applied to the tip tree? I would like to back port the official commit to our internal tree.
Thanks,
Song
tip-bot for Kan Liang
merge botperf/x86/intel/uncore: Add Node ID mask
Commit-ID: 9e63a7894fd302082cf3627fe90844421a6cbe7f Gitweb: https://git.kernel.org/tip/9e63a7894fd302082cf3627fe90844421a6cbe7f Author: Kan Liang <[email protected]> AuthorDate: Sun, 27 Jan 2019 06:53:14 -0800 Committer: Ingo Molnar <[email protected]> CommitDate: Mon, 4 Feb 2019 08:44:43 +0100
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.
--- arch/x86/events/intel/uncore_snbep.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/x86/events/intel/uncore_snbep.c +3 -1
@@ -1222,6 +1222,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 */
@@ -1243,7 +1245,7 @@ static int snbep_pci2phy_map_init(int devid, int nodeid_loc, int idmap_loc, bool 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)