Skip to contentSkip to conversation

perf/x86/intel/uncore: Various fix for ICX and SPR

PATCH Applied [email protected] 2 participants 15 messages Aug 26, 2021 – Aug 31, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover perf/x86/intel/uncore: Various fix for ICX and SPR

From: Kan Liang <[email protected]>

The fixes in the series are to fix different issues of perf uncore. They can be merged separately. I just want to make them more visible on maintainers' radar. So I put them together.

Patch 1 is to add extra IMC channel for ICX.
Patch 2 is to fix the missing type 0 unit 0 uncore unit. Patch 3-7 are to update the static event constraints table for IIO, CHA, M2PCIE, M3UPI on ICX and SPR.

Kan Liang (7):
perf/x86/intel/uncore: Support extra IMC channel on Ice Lake server perf/x86/intel/uncore: Fix invalid unit check perf/x86/intel/uncore: Fix Intel ICX IIO event constraints perf/x86/intel/uncore: Fix Intel SPR CHA event constraints perf/x86/intel/uncore: Fix Intel SPR IIO event constraints perf/x86/intel/uncore: Fix Intel SPR M2PCIE event constraints perf/x86/intel/uncore: Fix Intel SPR M3UPI event constraints

 arch/x86/events/intel/uncore_discovery.h |  2 +-
 arch/x86/events/intel/uncore_snbep.c     | 16 ++++++++++++++--
 2 files changed, 15 insertions(+), 3 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/7 perf/x86/intel/uncore: Support extra IMC channel on Ice Lake server

From: Kan Liang <[email protected]>

There are three channels on a Ice Lake server, but only two channels will ever be active. Current perf only enables two channels.

Support the extra IMC channel, which may be activated on some Ice Lake machines. For a non-activated channel, the SW can still access it. The write will be ignored by the HW. 0 is always returned for the reading.

Fixes 2b3b76b5ec67 ("perf/x86/intel/uncore: Add Ice Lake server uncore support")

---

The patch is a RESEND patch. The original post can be found at

https://lore.kernel.org/lkml/[email protected]

 arch/x86/events/intel/uncore_snbep.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/events/intel/uncore_snbep.c +2 -2
index 9a178a9..72a4181 100644
@@ -452,7 +452,7 @@
 #define ICX_M3UPI_PCI_PMON_BOX_CTL		0xa0
 
 /* ICX IMC */
-#define ICX_NUMBER_IMC_CHN			2
+#define ICX_NUMBER_IMC_CHN			3
 #define ICX_IMC_MEM_STRIDE			0x4
 
 /* SPR */
@@ -5458,7 +5458,7 @@ static struct intel_uncore_ops icx_uncore_mmio_ops = {
 static struct intel_uncore_type icx_uncore_imc = {
 	.name		= "imc",
 	.num_counters   = 4,
-	.num_boxes	= 8,
+	.num_boxes	= 12,
 	.perf_ctr_bits	= 48,
 	.fixed_ctr_bits	= 48,
 	.fixed_ctr	= SNR_IMC_MMIO_PMON_FIXED_CTR,
Signature · 1 line
2.7.4
merge bot Applied
#2 lore raw

[tip: perf/core] perf/x86/intel/uncore: Support extra IMC channel on Ice Lake server

The following commit has been merged into the perf/core branch of tip:

The following commit has been merged into the perf/core branch of tip:

Commit-ID:     496a18f09374ad89b3ab4366019bc3975db90234
Gitweb:        https://git.kernel.org/tip/496a18f09374ad89b3ab4366019bc3975db90234
Author:        Kan Liang <[email protected]>
AuthorDate:    Thu, 26 Aug 2021 08:32:37 -07:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Tue, 31 Aug 2021 13:59:35 +02:00

perf/x86/intel/uncore: Support extra IMC channel on Ice Lake server

There are three channels on a Ice Lake server, but only two channels will ever be active. Current perf only enables two channels.

Support the extra IMC channel, which may be activated on some Ice Lake machines. For a non-activated channel, the SW can still access it. The write will be ignored by the HW. 0 is always returned for the reading.

Fixes 2b3b76b5ec67 ("perf/x86/intel/uncore: Add Ice Lake server uncore support")
---
 arch/x86/events/intel/uncore_snbep.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/events/intel/uncore_snbep.c +2 -2
index 5ddc0f3..ea29e89 100644
@@ -452,7 +452,7 @@
 #define ICX_M3UPI_PCI_PMON_BOX_CTL		0xa0
 
 /* ICX IMC */
-#define ICX_NUMBER_IMC_CHN			2
+#define ICX_NUMBER_IMC_CHN			3
 #define ICX_IMC_MEM_STRIDE			0x4
 
 /* SPR */
@@ -5463,7 +5463,7 @@ static struct intel_uncore_ops icx_uncore_mmio_ops = {
 static struct intel_uncore_type icx_uncore_imc = {
 	.name		= "imc",
 	.num_counters   = 4,
-	.num_boxes	= 8,
+	.num_boxes	= 12,
 	.perf_ctr_bits	= 48,
 	.fixed_ctr_bits	= 48,
 	.fixed_ctr	= SNR_IMC_MMIO_PMON_FIXED_CTR,
#3 lore raw

PATCH 2/7 perf/x86/intel/uncore: Fix invalid unit check

In reply to [email protected]

From: Kan Liang <[email protected]>

The uncore unit with the type ID 0 and the unit ID 0 is missed.

The table3 of the uncore unit maybe 0. The uncore_discovery_invalid_unit() mistakenly treated it as an invalid value.

Remove the !unit.table3 check.

Fixes edae1f06c2cd ("perf/x86/intel/uncore: Parse uncore discovery tables")

---

The patch was posted as a part of the "perf: Add Sapphire Rapids server uncore support" patch set. But it doesn't depend on the other patches in the patch set. The bugfix can be accepted and merged separately.

https://lore.kernel.org/lkml/[email protected]/

 arch/x86/events/intel/uncore_discovery.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/events/intel/uncore_discovery.h +1 -1
index 7280c8a..6d735611 100644
@@ -30,7 +30,7 @@
 
 
 #define uncore_discovery_invalid_unit(unit)			\
-	(!unit.table1 || !unit.ctl || !unit.table3 ||	\
+	(!unit.table1 || !unit.ctl || \
 	 unit.table1 == -1ULL || unit.ctl == -1ULL ||	\
 	 unit.table3 == -1ULL)
 
Signature · 1 line
2.7.4
merge bot Applied
#4 lore raw

[tip: perf/core] perf/x86/intel/uncore: Fix invalid unit check

The following commit has been merged into the perf/core branch of tip:

The following commit has been merged into the perf/core branch of tip:

Commit-ID:     e2bb9fab08cbcc7922050c7eb0bd650807abfa4e
Gitweb:        https://git.kernel.org/tip/e2bb9fab08cbcc7922050c7eb0bd650807abfa4e
Author:        Kan Liang <[email protected]>
AuthorDate:    Thu, 26 Aug 2021 08:32:38 -07:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Tue, 31 Aug 2021 13:59:35 +02:00

perf/x86/intel/uncore: Fix invalid unit check

The uncore unit with the type ID 0 and the unit ID 0 is missed.

The table3 of the uncore unit maybe 0. The uncore_discovery_invalid_unit() mistakenly treated it as an invalid value.

Remove the !unit.table3 check.

Fixes edae1f06c2cd ("perf/x86/intel/uncore: Parse uncore discovery tables")
---
 arch/x86/events/intel/uncore_discovery.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/events/intel/uncore_discovery.h +1 -1
index 7280c8a..6d73561 100644
@@ -30,7 +30,7 @@
 
 
 #define uncore_discovery_invalid_unit(unit)			\
-	(!unit.table1 || !unit.ctl || !unit.table3 ||	\
+	(!unit.table1 || !unit.ctl || \
 	 unit.table1 == -1ULL || unit.ctl == -1ULL ||	\
 	 unit.table3 == -1ULL)
 
#5 lore raw

PATCH 3/7 perf/x86/intel/uncore: Fix Intel ICX IIO event constraints

In reply to [email protected]

From: Kan Liang <[email protected]>

According to the latest uncore document, both NUM_OUTSTANDING_REQ_OF_CPU (0x88) event and COMP_BUF_OCCUPANCY(0xd5) event also have constraints. Add them into the event constraints table.

Fixes 2b3b76b5ec67 ("perf/x86/intel/uncore: Add Ice Lake server uncore support")
---
 arch/x86/events/intel/uncore_snbep.c | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/events/intel/uncore_snbep.c +2 -0
index 72a4181..865129a 100644
@@ -5072,8 +5072,10 @@ static struct event_constraint icx_uncore_iio_constraints[] = {
 	UNCORE_EVENT_CONSTRAINT(0x02, 0x3),
 	UNCORE_EVENT_CONSTRAINT(0x03, 0x3),
 	UNCORE_EVENT_CONSTRAINT(0x83, 0x3),
+	UNCORE_EVENT_CONSTRAINT(0x88, 0xc),
 	UNCORE_EVENT_CONSTRAINT(0xc0, 0xc),
 	UNCORE_EVENT_CONSTRAINT(0xc5, 0xc),
+	UNCORE_EVENT_CONSTRAINT(0xd5, 0xc),
 	EVENT_CONSTRAINT_END
 };
 
Signature · 1 line
2.7.4
merge bot Applied
#6 lore raw

[tip: perf/core] perf/x86/intel/uncore: Fix Intel ICX IIO event constraints

The following commit has been merged into the perf/core branch of tip:

The following commit has been merged into the perf/core branch of tip:

Commit-ID:     f42e8a603c88f72bf047a710b9fc1d3579f31e71
Gitweb:        https://git.kernel.org/tip/f42e8a603c88f72bf047a710b9fc1d3579f31e71
Author:        Kan Liang <[email protected]>
AuthorDate:    Thu, 26 Aug 2021 08:32:39 -07:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Tue, 31 Aug 2021 13:59:36 +02:00

perf/x86/intel/uncore: Fix Intel ICX IIO event constraints

According to the latest uncore document, both NUM_OUTSTANDING_REQ_OF_CPU (0x88) event and COMP_BUF_OCCUPANCY(0xd5) event also have constraints. Add them into the event constraints table.

Fixes 2b3b76b5ec67 ("perf/x86/intel/uncore: Add Ice Lake server uncore support")
---
 arch/x86/events/intel/uncore_snbep.c | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/events/intel/uncore_snbep.c +2 -0
index ea29e89..d941854 100644
@@ -5076,8 +5076,10 @@ static struct event_constraint icx_uncore_iio_constraints[] = {
 	UNCORE_EVENT_CONSTRAINT(0x02, 0x3),
 	UNCORE_EVENT_CONSTRAINT(0x03, 0x3),
 	UNCORE_EVENT_CONSTRAINT(0x83, 0x3),
+	UNCORE_EVENT_CONSTRAINT(0x88, 0xc),
 	UNCORE_EVENT_CONSTRAINT(0xc0, 0xc),
 	UNCORE_EVENT_CONSTRAINT(0xc5, 0xc),
+	UNCORE_EVENT_CONSTRAINT(0xd5, 0xc),
 	EVENT_CONSTRAINT_END
 };
 
#7 lore raw

PATCH 4/7 perf/x86/intel/uncore: Fix Intel SPR CHA event constraints

In reply to [email protected]

From: Kan Liang <[email protected]>

SPR CHA events have the exact same event constraints as SKX, so add the constraints.

Fixes 949b11381f81 ("perf/x86/intel/uncore: Add Sapphire Rapids server CHA support")
---
 arch/x86/events/intel/uncore_snbep.c | 1 +
 1 file changed, 1 insertion(+)
arch/x86/events/intel/uncore_snbep.c +1 -0
index 865129a..06ad632 100644
@@ -5644,6 +5644,7 @@ static struct intel_uncore_type spr_uncore_chabox = {
 	.event_mask		= SPR_CHA_PMON_EVENT_MASK,
 	.event_mask_ext		= SPR_RAW_EVENT_MASK_EXT,
 	.num_shared_regs	= 1,
+	.constraints		= skx_uncore_chabox_constraints,
 	.ops			= &spr_uncore_chabox_ops,
 	.format_group		= &spr_uncore_chabox_format_group,
 	.attr_update		= uncore_alias_groups,
Signature · 1 line
2.7.4
merge bot Applied
#8 lore raw

[tip: perf/core] perf/x86/intel/uncore: Fix Intel SPR CHA event constraints

The following commit has been merged into the perf/core branch of tip:

The following commit has been merged into the perf/core branch of tip:

Commit-ID:     9d756e408e080d40e7916484b00c802026e6d1ad
Gitweb:        https://git.kernel.org/tip/9d756e408e080d40e7916484b00c802026e6d1ad
Author:        Kan Liang <[email protected]>
AuthorDate:    Thu, 26 Aug 2021 08:32:40 -07:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Tue, 31 Aug 2021 13:59:36 +02:00

perf/x86/intel/uncore: Fix Intel SPR CHA event constraints

SPR CHA events have the exact same event constraints as SKX, so add the constraints.

Fixes 949b11381f81 ("perf/x86/intel/uncore: Add Sapphire Rapids server CHA support")
---
 arch/x86/events/intel/uncore_snbep.c | 1 +
 1 file changed, 1 insertion(+)
arch/x86/events/intel/uncore_snbep.c +1 -0
index d941854..ce85ee5 100644
@@ -5649,6 +5649,7 @@ static struct intel_uncore_type spr_uncore_chabox = {
 	.event_mask		= SPR_CHA_PMON_EVENT_MASK,
 	.event_mask_ext		= SPR_RAW_EVENT_MASK_EXT,
 	.num_shared_regs	= 1,
+	.constraints		= skx_uncore_chabox_constraints,
 	.ops			= &spr_uncore_chabox_ops,
 	.format_group		= &spr_uncore_chabox_format_group,
 	.attr_update		= uncore_alias_groups,
#9 lore raw

PATCH 5/7 perf/x86/intel/uncore: Fix Intel SPR IIO event constraints

In reply to [email protected]

From: Kan Liang <[email protected]>

SPR IIO events have the exact same event constraints as ICX, so add the constraints.

Fixes 3ba7095beaec ("perf/x86/intel/uncore: Add Sapphire Rapids server IIO support")
---
 arch/x86/events/intel/uncore_snbep.c | 1 +
 1 file changed, 1 insertion(+)
arch/x86/events/intel/uncore_snbep.c +1 -0
index 06ad632..3a49a5a 100644
@@ -5656,6 +5656,7 @@ static struct intel_uncore_type spr_uncore_iio = {
 	.event_mask_ext		= SNR_IIO_PMON_RAW_EVENT_MASK_EXT,
 	.format_group		= &snr_uncore_iio_format_group,
 	.attr_update		= uncore_alias_groups,
+	.constraints		= icx_uncore_iio_constraints,
 };
 
 static struct attribute *spr_uncore_raw_formats_attr[] = {
Signature · 1 line
2.7.4
merge bot Applied
#10 lore raw

[tip: perf/core] perf/x86/intel/uncore: Fix Intel SPR IIO event constraints

The following commit has been merged into the perf/core branch of tip:

The following commit has been merged into the perf/core branch of tip:

Commit-ID:     67c5d44384f8dc57e1c1b3040423cfce99b578cd
Gitweb:        https://git.kernel.org/tip/67c5d44384f8dc57e1c1b3040423cfce99b578cd
Author:        Kan Liang <[email protected]>
AuthorDate:    Thu, 26 Aug 2021 08:32:41 -07:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Tue, 31 Aug 2021 13:59:36 +02:00

perf/x86/intel/uncore: Fix Intel SPR IIO event constraints

SPR IIO events have the exact same event constraints as ICX, so add the constraints.

Fixes 3ba7095beaec ("perf/x86/intel/uncore: Add Sapphire Rapids server IIO support")
---
 arch/x86/events/intel/uncore_snbep.c | 1 +
 1 file changed, 1 insertion(+)
arch/x86/events/intel/uncore_snbep.c +1 -0
index ce85ee5..2d75d21 100644
@@ -5661,6 +5661,7 @@ static struct intel_uncore_type spr_uncore_iio = {
 	.event_mask_ext		= SNR_IIO_PMON_RAW_EVENT_MASK_EXT,
 	.format_group		= &snr_uncore_iio_format_group,
 	.attr_update		= uncore_alias_groups,
+	.constraints		= icx_uncore_iio_constraints,
 };
 
 static struct attribute *spr_uncore_raw_formats_attr[] = {
#11 lore raw

PATCH 6/7 perf/x86/intel/uncore: Fix Intel SPR M2PCIE event constraints

In reply to [email protected]

From: Kan Liang <[email protected]>

Similar to the ICX M2PCIE events, some of the SPR M2PCIE events also have constraints. Add the constraints for SPR M2PCIE.

Fixes f85ef898f884 ("perf/x86/intel/uncore: Add Sapphire Rapids server M2PCIe support")
---
 arch/x86/events/intel/uncore_snbep.c | 7 +++++++
 1 file changed, 7 insertions(+)
arch/x86/events/intel/uncore_snbep.c +7 -0
index 3a49a5a..0a8f8a6 100644
@@ -5685,9 +5685,16 @@ static struct intel_uncore_type spr_uncore_irp = {
 
 };
 
+static struct event_constraint spr_uncore_m2pcie_constraints[] = {
+	UNCORE_EVENT_CONSTRAINT(0x14, 0x3),
+	UNCORE_EVENT_CONSTRAINT(0x2d, 0x3),
+	EVENT_CONSTRAINT_END
+};
+
 static struct intel_uncore_type spr_uncore_m2pcie = {
 	SPR_UNCORE_COMMON_FORMAT(),
 	.name			= "m2pcie",
+	.constraints		= spr_uncore_m2pcie_constraints,
 };
 
 static struct intel_uncore_type spr_uncore_pcu = {
Signature · 1 line
2.7.4
merge bot Applied
#12 lore raw

[tip: perf/core] perf/x86/intel/uncore: Fix Intel SPR M2PCIE event constraints

The following commit has been merged into the perf/core branch of tip:

The following commit has been merged into the perf/core branch of tip:

Commit-ID:     f01d7d558e1855d4aa8e927b86111846536dd476
Gitweb:        https://git.kernel.org/tip/f01d7d558e1855d4aa8e927b86111846536dd476
Author:        Kan Liang <[email protected]>
AuthorDate:    Thu, 26 Aug 2021 08:32:42 -07:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Tue, 31 Aug 2021 13:59:37 +02:00

perf/x86/intel/uncore: Fix Intel SPR M2PCIE event constraints

Similar to the ICX M2PCIE events, some of the SPR M2PCIE events also have constraints. Add the constraints for SPR M2PCIE.

Fixes f85ef898f884 ("perf/x86/intel/uncore: Add Sapphire Rapids server M2PCIe support")
---
 arch/x86/events/intel/uncore_snbep.c | 7 +++++++
 1 file changed, 7 insertions(+)
arch/x86/events/intel/uncore_snbep.c +7 -0
index 2d75d21..cd53057 100644
@@ -5690,9 +5690,16 @@ static struct intel_uncore_type spr_uncore_irp = {
 
 };
 
+static struct event_constraint spr_uncore_m2pcie_constraints[] = {
+	UNCORE_EVENT_CONSTRAINT(0x14, 0x3),
+	UNCORE_EVENT_CONSTRAINT(0x2d, 0x3),
+	EVENT_CONSTRAINT_END
+};
+
 static struct intel_uncore_type spr_uncore_m2pcie = {
 	SPR_UNCORE_COMMON_FORMAT(),
 	.name			= "m2pcie",
+	.constraints		= spr_uncore_m2pcie_constraints,
 };
 
 static struct intel_uncore_type spr_uncore_pcu = {
#13 lore raw

PATCH 7/7 perf/x86/intel/uncore: Fix Intel SPR M3UPI event constraints

In reply to [email protected]

From: Kan Liang <[email protected]>

SPR M3UPI have the exact same event constraints as ICX, so add the constraints.

Fixes 2a8e51eae7c8 ("perf/x86/intel/uncore: Add Sapphire Rapids server M3UPI support")
---
 arch/x86/events/intel/uncore_snbep.c | 1 +
 1 file changed, 1 insertion(+)
arch/x86/events/intel/uncore_snbep.c +1 -0
index 0a8f8a6..02b926d 100644
@@ -5771,6 +5771,7 @@ static struct intel_uncore_type spr_uncore_upi = {
 static struct intel_uncore_type spr_uncore_m3upi = {
 	SPR_UNCORE_PCI_COMMON_FORMAT(),
 	.name			= "m3upi",
+	.constraints		= icx_uncore_m3upi_constraints,
 };
 
 static struct intel_uncore_type spr_uncore_mdf = {
Signature · 1 line
2.7.4
merge bot Applied
#14 lore raw

[tip: perf/core] perf/x86/intel/uncore: Fix Intel SPR M3UPI event constraints

The following commit has been merged into the perf/core branch of tip:

The following commit has been merged into the perf/core branch of tip:

Commit-ID:     4034fb207e302cc0b1f304084d379640c1fb1436
Gitweb:        https://git.kernel.org/tip/4034fb207e302cc0b1f304084d379640c1fb1436
Author:        Kan Liang <[email protected]>
AuthorDate:    Thu, 26 Aug 2021 08:32:43 -07:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Tue, 31 Aug 2021 13:59:37 +02:00

perf/x86/intel/uncore: Fix Intel SPR M3UPI event constraints

SPR M3UPI have the exact same event constraints as ICX, so add the constraints.

Fixes 2a8e51eae7c8 ("perf/x86/intel/uncore: Add Sapphire Rapids server M3UPI support")
---
 arch/x86/events/intel/uncore_snbep.c | 1 +
 1 file changed, 1 insertion(+)
arch/x86/events/intel/uncore_snbep.c +1 -0
index cd53057..eb2c6ce 100644
@@ -5776,6 +5776,7 @@ static struct intel_uncore_type spr_uncore_upi = {
 static struct intel_uncore_type spr_uncore_m3upi = {
 	SPR_UNCORE_PCI_COMMON_FORMAT(),
 	.name			= "m3upi",
+	.constraints		= icx_uncore_m3upi_constraints,
 };
 
 static struct intel_uncore_type spr_uncore_mdf = {