Skip to contentSkip to conversation

powerpc/perf/core-book3s: Avoid loading platform pmu driver during dump kernel

PATCH Superseded Madhavan Srinivasan 1 participant 4 messages Feb 16, 2025 PowerPC

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Madhavan Srinivasan

author maintainer
#0 lore raw

PATCH 1/4 powerpc/perf/core-book3s: Avoid loading platform pmu driver during dump kernel

Platform pmu driver may not be used in the dump kernel. Avoid loading it.

---
 arch/powerpc/perf/core-book3s.c | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/powerpc/perf/core-book3s.c +8 -0
index 2b79171ee185..9a009dff63b3 100644
@@ -22,6 +22,8 @@
 
 #ifdef CONFIG_PPC64
 #include "internal.h"
+#include <asm/fadump.h>
+#include <asm/kexec.h>
 #endif
 
 #define BHRB_MAX_ENTRIES	32
@@ -2571,6 +2573,12 @@ static int __init init_ppc64_pmu(void)
 		return 0;
 	}
 
+	/*
+	 * If the dump kernel is active, skip loading these drivers
+	 */
+	if (is_kdump_kernel() || is_fadump_active())
+		return 0;
+
 	/* run through all the pmu drivers one at a time */
 	if (!init_power5_pmu())
 		return 0;
Signature · 1 line
2.47.0
author maintainer
#1 lore raw

PATCH 2/4 powerpc/perf/hv-24x7: Avoid loading hv-24x7 during dump kernel

hv-24x7 pmu driver is intended to get system-wide resourse metrics and may not be used during the dump kernel, avoid loading it

---
 arch/powerpc/perf/hv-24x7.c   | 3 +++
 arch/powerpc/perf/hv-common.h | 2 ++
 2 files changed, 5 insertions(+)
arch/powerpc/perf/hv-24x7.c +3 -0
index d400fa391c27..3a626cd8cf54 100644
@@ -1698,6 +1698,9 @@ static int hv_24x7_init(void)
 	unsigned int pvr = mfspr(SPRN_PVR);
 	struct hv_perf_caps caps;
 
+	if (is_kdump_kernel() || is_fadump_active())
+		return 0;
+
 	if (!firmware_has_feature(FW_FEATURE_LPAR)) {
 		pr_debug("not a virtualized system, not enabling\n");
 		return -ENODEV;
arch/powerpc/perf/hv-common.h +2 -0
index 2cce17bc321c..a4c062d2264e 100644
@@ -4,6 +4,8 @@
 
 #include <linux/perf_event.h>
 #include <linux/types.h>
+#include <asm/fadump.h>
+#include <asm/kexec.h>
 
 struct hv_perf_caps {
 	u16 version;
Signature · 1 line
2.47.0
author maintainer
#2 lore raw

PATCH 3/4 powerpc/perf/hv-gpci: Avoid loading hv-gpci pmu during dump kernel

In reply to Madhavan Srinivasan

hv-gpci pmu driver is intended to get powervm hypervisor system-wide metrics and this may not be used during the dump kernel, avoid loading it

---
 arch/powerpc/perf/hv-gpci.c | 3 +++
 1 file changed, 3 insertions(+)
arch/powerpc/perf/hv-gpci.c +3 -0
index 241551d1282f..e0c3df0a048f 100644
@@ -989,6 +989,9 @@ static int hv_gpci_init(void)
 	struct hv_perf_caps caps;
 	struct hv_gpci_request_buffer *arg;
 
+	if (is_kdump_kernel() || is_fadump_active())
+		return 0;
+
 	hv_gpci_assert_offsets_correct();
 
 	if (!firmware_has_feature(FW_FEATURE_LPAR)) {
Signature · 1 line
2.47.0
author maintainer
#3 lore raw

PATCH 4/4 powerpc/perf/vpa-pmu: Avoid loading vpa-pmy driver during dump kernel

In reply to Madhavan Srinivasan

vpa-pmu driver is used to collect latency metrics for host to guest or guest to host context switches in a PowerVM KVM guest scenario. This may not be used during the dump kernel, avoid loading it

---
 arch/powerpc/perf/vpa-pmu.c | 5 +++++
 1 file changed, 5 insertions(+)
arch/powerpc/perf/vpa-pmu.c +5 -0
index 6a5bfd2a13b5..f7f72b976c1d 100644
@@ -10,6 +10,8 @@
 #include <linux/perf_event.h>
 #include <asm/kvm_ppc.h>
 #include <asm/kvm_book3s_64.h>
+#include <asm/fadump.h>
+#include <asm/kexec.h>
 
 #define MODULE_VERS "1.0"
 #define MODULE_NAME "pseries_vpa_pmu"
@@ -183,6 +185,9 @@ static int __init pseries_vpa_pmu_init(void)
 	if (!firmware_has_feature(FW_FEATURE_LPAR) || is_kvm_guest())
 		return -ENODEV;
 
+	if (is_kdump_kernel() || is_fadump_active())
+		return 0;
+
 	perf_pmu_register(&vpa_pmu, vpa_pmu.name, -1);
 	pr_info("Virtual Processor Area PMU registered.\n");
 
Signature · 1 line
2.47.0