mirror of
				git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
				synced 2025-11-01 09:13:37 +00:00 
			
		
		
		
	s390: implement perf_arch_fetch_caller_regs
On s390 bpf_get_stack_raw_tp() returns 0 entries for both kernel and user stacks. While there is no practical unwinding solution for userspace on s390 at this moment, there certainly is a kernel unwinder. However, it is not properly integrated with BPF. In order to start unwinding, bpf_get_stack_raw_tp() obtains the current kernel register values using perf_fetch_caller_regs(), which is not implemented for s390. The actual unwinding then happens by passing those registers to perf_callchain_kernel(). Implement perf_arch_fetch_caller_regs() for s390, where __builtin_frame_address(0) points to back_chain. Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
This commit is contained in:
		
							parent
							
								
									ea1f56fa16
								
							
						
					
					
						commit
						914d52e464
					
				
					 1 changed files with 7 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -12,6 +12,7 @@
 | 
			
		|||
 | 
			
		||||
#include <linux/perf_event.h>
 | 
			
		||||
#include <linux/device.h>
 | 
			
		||||
#include <asm/stacktrace.h>
 | 
			
		||||
 | 
			
		||||
/* Per-CPU flags for PMU states */
 | 
			
		||||
#define PMU_F_RESERVED			0x1000
 | 
			
		||||
| 
						 | 
				
			
			@ -73,4 +74,10 @@ struct perf_sf_sde_regs {
 | 
			
		|||
#define SDB_FULL_BLOCKS(hwc)	(SAMPL_FLAGS(hwc) & PERF_CPUM_SF_FULL_BLOCKS)
 | 
			
		||||
#define SAMPLE_FREQ_MODE(hwc)	(SAMPL_FLAGS(hwc) & PERF_CPUM_SF_FREQ_MODE)
 | 
			
		||||
 | 
			
		||||
#define perf_arch_fetch_caller_regs(regs, __ip) do {			\
 | 
			
		||||
	(regs)->psw.addr = (__ip);					\
 | 
			
		||||
	(regs)->gprs[15] = (unsigned long)__builtin_frame_address(0) -	\
 | 
			
		||||
		offsetof(struct stack_frame, back_chain);		\
 | 
			
		||||
} while (0)
 | 
			
		||||
 | 
			
		||||
#endif /* _ASM_S390_PERF_EVENT_H */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue