Skip to contentSkip to conversation

Improve build test coverage for perf drivers

PATCH RESEND Applied John Garry 2 participants 4 messages Oct 1, 2021 – Oct 4, 2021 Arm PMU profiling and debugging

lore
Share & tools
lore

John Garry

author
#0 lore raw

cover Improve build test coverage for perf drivers

Improve build test coverage by allowing some more drivers build under COMPILE_TEST as appropriate.

Baseline is v5.15-rc3

John Garry (2):
drivers/perf: thunderx2_pmu: Change data in size
tx2_uncore_event_update()
drivers/perf: Improve build test coverage

 drivers/perf/Kconfig         | 12 +++++++-----
 drivers/perf/thunderx2_pmu.c |  2 +-
 2 files changed, 8 insertions(+), 6 deletions(-)
Signature · 1 line
2.26.2
author
#1 lore raw

PATCH RESEND 1/2 drivers/perf: thunderx2_pmu: Change data in size tx2_uncore_event_update()

A LSL of 32 requires > 32b value to hold the result. However in tx2_uncore_event_update(), 1UL << 32 currently only works as unsigned long is 64b on a 64b system.

If we want to compile test for a 32b system, we need unsigned long long, whose min size is 64b.

---
 drivers/perf/thunderx2_pmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/perf/thunderx2_pmu.c +1 -1
index fc1a376ee906..05378c0fd8f3 100644
@@ -487,7 +487,7 @@ static void tx2_uncore_event_update(struct perf_event *event)
 		new = reg_readl(hwc->event_base);
 		prev = local64_xchg(&hwc->prev_count, new);
 		/* handles rollover of 32 bit counter */
-		delta = (u32)(((1UL << 32) - prev) + new);
+		delta = (u32)(((1ULL << 32) - prev) + new);
 	}
 
 	/* DMC event data_transfers granularity is 16 Bytes, convert it to 64 */
Signature · 1 line
2.26.2
author
#2 lore raw

PATCH RESEND 2/2 drivers/perf: Improve build test coverage

In reply to John Garry

Improve build test cover by allowing some drivers to build under COMPILE_TEST where possible.

Some notes:
- Mostly a dependency on CONFIG_ACPI is not really required for only building (but left untouched), but is required for TX2 which uses ACPI functions which have no stubs
- XGENE required 64b dependency as it relies on some unsigned long perf struct fields being 64b
- I don't see why TX2 requires NUMA to build, but left untouched
- Added an explicit dependency on GENERIC_MSI_IRQ_DOMAIN for ARM_SMMU_V3_PMU, which is required for platform MSI functions

---
 drivers/perf/Kconfig | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/perf/Kconfig +7 -5
index 77522e5efe11..4374af292e6d 100644
@@ -36,7 +36,7 @@ config ARM_CCI5xx_PMU
 
 config ARM_CCN
 	tristate "ARM CCN driver support"
-	depends on ARM || ARM64
+	depends on ARM || ARM64 || COMPILE_TEST
 	help
 	  PMU (perf) driver supporting the ARM CCN (Cache Coherent Network)
 	  interconnect.
@@ -62,7 +62,8 @@ config ARM_PMU_ACPI
 
 config ARM_SMMU_V3_PMU
 	 tristate "ARM SMMUv3 Performance Monitors Extension"
-	 depends on ARM64 && ACPI
+	 depends on (ARM64 && ACPI) || (COMPILE_TEST && 64BIT)
+	 depends on GENERIC_MSI_IRQ_DOMAIN
 	   help
 	   Provides support for the ARM SMMUv3 Performance Monitor Counter
 	   Groups (PMCG), which provide monitoring of transactions passing
@@ -80,7 +81,7 @@ config ARM_DSU_PMU
 
 config FSL_IMX8_DDR_PMU
 	tristate "Freescale i.MX8 DDR perf monitor"
-	depends on ARCH_MXC
+	depends on ARCH_MXC || COMPILE_TEST
 	  help
 	  Provides support for the DDR performance monitor in i.MX8, which
 	  can give information about memory throughput and other related
@@ -108,7 +109,8 @@ config QCOM_L3_PMU
 
 config THUNDERX2_PMU
 	tristate "Cavium ThunderX2 SoC PMU UNCORE"
-	depends on ARCH_THUNDER2 && ARM64 && ACPI && NUMA
+	depends on ARCH_THUNDER2 || COMPILE_TEST
+	depends on NUMA && ACPI
 	default m
 	help
 	   Provides support for ThunderX2 UNCORE events.
@@ -116,7 +118,7 @@ config THUNDERX2_PMU
 	   in the DDR4 Memory Controller (DMC).
 
 config XGENE_PMU
-        depends on ARCH_XGENE
+        depends on ARCH_XGENE || (COMPILE_TEST && 64BIT)
         bool "APM X-Gene SoC PMU"
         default n
         help
Signature · 1 line
2.26.2
maintainer Applied
#3 lore raw
In reply to John Garry
Quoted 11 lines · John Garry

Improve build test coverage by allowing some more drivers build under COMPILE_TEST as appropriate.

Baseline is v5.15-rc3

John Garry (2):
drivers/perf: thunderx2_pmu: Change data in size
tx2_uncore_event_update()
drivers/perf: Improve build test coverage

[...]

Applied to will (for-next/perf), thanks!

[1/2] drivers/perf: thunderx2_pmu: Change data in size tx2_uncore_event_update()

      https://git.kernel.org/will/c/78cac393b464
[2/2] drivers/perf: Improve build test coverage
      https://git.kernel.org/will/c/e656972b6986

Cheers,

Signature · 5 lines
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev