hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/arch/s390/kernel/perf_event.c
....@@ -21,6 +21,7 @@
2121 #include <asm/lowcore.h>
2222 #include <asm/processor.h>
2323 #include <asm/sysinfo.h>
24
+#include <asm/unwind.h>
2425
2526 const char *perf_pmu_name(void)
2627 {
....@@ -50,7 +51,7 @@
5051 if (!stack)
5152 return NULL;
5253
53
- return (struct kvm_s390_sie_block *) stack->empty1[0];
54
+ return (struct kvm_s390_sie_block *)stack->empty1[1];
5455 }
5556
5657 static bool is_in_guest(struct pt_regs *regs)
....@@ -219,20 +220,17 @@
219220 }
220221 arch_initcall(service_level_perf_register);
221222
222
-static int __perf_callchain_kernel(void *data, unsigned long address, int reliable)
223
-{
224
- struct perf_callchain_entry_ctx *entry = data;
225
-
226
- perf_callchain_store(entry, address);
227
- return 0;
228
-}
229
-
230223 void perf_callchain_kernel(struct perf_callchain_entry_ctx *entry,
231224 struct pt_regs *regs)
232225 {
233
- if (user_mode(regs))
234
- return;
235
- dump_trace(__perf_callchain_kernel, entry, NULL, regs->gprs[15]);
226
+ struct unwind_state state;
227
+ unsigned long addr;
228
+
229
+ unwind_for_each_frame(&state, current, regs, 0) {
230
+ addr = unwind_get_return_address(&state);
231
+ if (!addr || perf_callchain_store(entry, addr))
232
+ return;
233
+ }
236234 }
237235
238236 /* Perf definitions for PMU event attributes in sysfs */