callchain.c (2910428106ebf23a9a2176cb751749edb2ce57e2) callchain.c (0a7601b6ffddec11d7cc0bc3264daf0159f5e1a6)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Performance counter callchain support - powerpc architecture code
4 *
5 * Copyright © 2009 Paul Mackerras, IBM Corporation.
6 */
7#include <linux/kernel.h>
8#include <linux/sched.h>
9#include <linux/perf_event.h>
10#include <linux/percpu.h>
11#include <linux/uaccess.h>
12#include <linux/mm.h>
13#include <asm/ptrace.h>
14#include <asm/pgtable.h>
15#include <asm/sigcontext.h>
16#include <asm/ucontext.h>
17#include <asm/vdso.h>
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Performance counter callchain support - powerpc architecture code
4 *
5 * Copyright © 2009 Paul Mackerras, IBM Corporation.
6 */
7#include <linux/kernel.h>
8#include <linux/sched.h>
9#include <linux/perf_event.h>
10#include <linux/percpu.h>
11#include <linux/uaccess.h>
12#include <linux/mm.h>
13#include <asm/ptrace.h>
14#include <asm/pgtable.h>
15#include <asm/sigcontext.h>
16#include <asm/ucontext.h>
17#include <asm/vdso.h>
18#ifdef CONFIG_PPC64
18#ifdef CONFIG_COMPAT
19#include "../kernel/ppc32.h"
20#endif
21#include <asm/pte-walk.h>
22
23
24/*
25 * Is sp valid as the address of the next kernel stack frame after prev_sp?
26 * The next frame may be in a different stack area but should not go

--- 252 unchanged lines hidden (view full) ---

279#define __SIGNAL_FRAMESIZE32 __SIGNAL_FRAMESIZE
280#define sigcontext32 sigcontext
281#define mcontext32 mcontext
282#define ucontext32 ucontext
283#define compat_siginfo_t struct siginfo
284
285#endif /* CONFIG_PPC64 */
286
19#include "../kernel/ppc32.h"
20#endif
21#include <asm/pte-walk.h>
22
23
24/*
25 * Is sp valid as the address of the next kernel stack frame after prev_sp?
26 * The next frame may be in a different stack area but should not go

--- 252 unchanged lines hidden (view full) ---

279#define __SIGNAL_FRAMESIZE32 __SIGNAL_FRAMESIZE
280#define sigcontext32 sigcontext
281#define mcontext32 mcontext
282#define ucontext32 ucontext
283#define compat_siginfo_t struct siginfo
284
285#endif /* CONFIG_PPC64 */
286
287#if defined(CONFIG_PPC32) || defined(CONFIG_COMPAT)
287/*
288 * On 32-bit we just access the address and let hash_page create a
289 * HPTE if necessary, so there is no need to fall back to reading
290 * the page tables. Since this is called at interrupt level,
291 * do_page_fault() won't treat a DSI as a page fault.
292 */
293static int read_user_stack_32(unsigned int __user *ptr, unsigned int *ret)
294{

--- 147 unchanged lines hidden (view full) ---

442
443 if (level == 0)
444 next_ip = lr;
445 perf_callchain_store(entry, next_ip);
446 ++level;
447 sp = next_sp;
448 }
449}
288/*
289 * On 32-bit we just access the address and let hash_page create a
290 * HPTE if necessary, so there is no need to fall back to reading
291 * the page tables. Since this is called at interrupt level,
292 * do_page_fault() won't treat a DSI as a page fault.
293 */
294static int read_user_stack_32(unsigned int __user *ptr, unsigned int *ret)
295{

--- 147 unchanged lines hidden (view full) ---

443
444 if (level == 0)
445 next_ip = lr;
446 perf_callchain_store(entry, next_ip);
447 ++level;
448 sp = next_sp;
449 }
450}
451#else /* 32bit */
452static void perf_callchain_user_32(struct perf_callchain_entry_ctx *entry,
453 struct pt_regs *regs)
454{}
455#endif /* 32bit */
450
451void
452perf_callchain_user(struct perf_callchain_entry_ctx *entry, struct pt_regs *regs)
453{
454 if (!is_32bit_task())
455 perf_callchain_user_64(entry, regs);
456 else
457 perf_callchain_user_32(entry, regs);
458}
456
457void
458perf_callchain_user(struct perf_callchain_entry_ctx *entry, struct pt_regs *regs)
459{
460 if (!is_32bit_task())
461 perf_callchain_user_64(entry, regs);
462 else
463 perf_callchain_user_32(entry, regs);
464}