Skip to content

Commit b1704f8

Browse files
committed
Merge: perf: Sync with upstream v6.11
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/5400 JIRA: https://issues.redhat.com/browse/RHEL-29795 Signed-off-by: Michael Petlan <mpetlan@redhat.com> Approved-by: Tony Camuso <tcamuso@redhat.com> Approved-by: Arnaldo Carvalho de Melo <acme@redhat.com> Approved-by: Mark Salter <msalter@redhat.com> Approved-by: Steve Best <sbest@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Rado Vrbovsky <rvrbovsk@redhat.com>
2 parents fd58225 + e6c3711 commit b1704f8

File tree

397 files changed

+18652
-8134
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

397 files changed

+18652
-8134
lines changed

Documentation/virt/kvm/api.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4084,7 +4084,7 @@ operating system that uses the PIT for timing (e.g. Linux 2.4.x).
40844084
4.100 KVM_PPC_CONFIGURE_V3_MMU
40854085
------------------------------
40864086

4087-
:Capability: KVM_CAP_PPC_RADIX_MMU or KVM_CAP_PPC_HASH_MMU_V3
4087+
:Capability: KVM_CAP_PPC_MMU_RADIX or KVM_CAP_PPC_MMU_HASH_V3
40884088
:Architectures: ppc
40894089
:Type: vm ioctl
40904090
:Parameters: struct kvm_ppc_mmuv3_cfg (in)
@@ -4118,7 +4118,7 @@ the Power ISA V3.00, Book III section 5.7.6.1.
41184118
4.101 KVM_PPC_GET_RMMU_INFO
41194119
---------------------------
41204120

4121-
:Capability: KVM_CAP_PPC_RADIX_MMU
4121+
:Capability: KVM_CAP_PPC_MMU_RADIX
41224122
:Architectures: ppc
41234123
:Type: vm ioctl
41244124
:Parameters: struct kvm_ppc_rmmu_info (out)
@@ -7834,7 +7834,7 @@ capability via KVM_ENABLE_CAP ioctl on the vcpu fd. Note that this
78347834
will disable the use of APIC hardware virtualization even if supported
78357835
by the CPU, as it's incompatible with SynIC auto-EOI behavior.
78367836

7837-
8.3 KVM_CAP_PPC_RADIX_MMU
7837+
8.3 KVM_CAP_PPC_MMU_RADIX
78387838
-------------------------
78397839

78407840
:Architectures: ppc
@@ -7844,7 +7844,7 @@ available, means that the kernel can support guests using the
78447844
radix MMU defined in Power ISA V3.00 (as implemented in the POWER9
78457845
processor).
78467846

7847-
8.4 KVM_CAP_PPC_HASH_MMU_V3
7847+
8.4 KVM_CAP_PPC_MMU_HASH_V3
78487848
---------------------------
78497849

78507850
:Architectures: ppc

arch/arm/kernel/hw_breakpoint.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ int hw_breakpoint_arch_parse(struct perf_event *bp,
626626
hw->address &= ~alignment_mask;
627627
hw->ctrl.len <<= offset;
628628

629-
if (uses_default_overflow_handler(bp)) {
629+
if (is_default_overflow_handler(bp)) {
630630
/*
631631
* Mismatch breakpoints are required for single-stepping
632632
* breakpoints.
@@ -798,7 +798,7 @@ static void watchpoint_handler(unsigned long addr, unsigned int fsr,
798798
* Otherwise, insert a temporary mismatch breakpoint so that
799799
* we can single-step over the watchpoint trigger.
800800
*/
801-
if (!uses_default_overflow_handler(wp))
801+
if (!is_default_overflow_handler(wp))
802802
continue;
803803
step:
804804
enable_single_step(wp, instruction_pointer(regs));
@@ -811,7 +811,7 @@ static void watchpoint_handler(unsigned long addr, unsigned int fsr,
811811
info->trigger = addr;
812812
pr_debug("watchpoint fired: address = 0x%x\n", info->trigger);
813813
perf_bp_event(wp, regs);
814-
if (uses_default_overflow_handler(wp))
814+
if (is_default_overflow_handler(wp))
815815
enable_single_step(wp, instruction_pointer(regs));
816816
}
817817

@@ -886,7 +886,7 @@ static void breakpoint_handler(unsigned long unknown, struct pt_regs *regs)
886886
info->trigger = addr;
887887
pr_debug("breakpoint fired: address = 0x%x\n", addr);
888888
perf_bp_event(bp, regs);
889-
if (uses_default_overflow_handler(bp))
889+
if (is_default_overflow_handler(bp))
890890
enable_single_step(bp, addr);
891891
goto unlock;
892892
}

arch/arm64/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ config ARM64
240240
select HAVE_ARCH_USERFAULTFD_MINOR if USERFAULTFD
241241
select TRACE_IRQFLAGS_SUPPORT
242242
select HAVE_SOFTIRQ_ON_OWN_STACK
243+
select USER_STACKTRACE_SUPPORT
243244
help
244245
ARM 64-bit (AArch64) Linux support.
245246

arch/arm64/kernel/hw_breakpoint.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ static int breakpoint_handler(unsigned long unused, unsigned long esr,
654654
perf_bp_event(bp, regs);
655655

656656
/* Do we need to handle the stepping? */
657-
if (uses_default_overflow_handler(bp))
657+
if (is_default_overflow_handler(bp))
658658
step = 1;
659659
unlock:
660660
rcu_read_unlock();
@@ -733,7 +733,7 @@ static u64 get_distance_from_watchpoint(unsigned long addr, u64 val,
733733
static int watchpoint_report(struct perf_event *wp, unsigned long addr,
734734
struct pt_regs *regs)
735735
{
736-
int step = uses_default_overflow_handler(wp);
736+
int step = is_default_overflow_handler(wp);
737737
struct arch_hw_breakpoint *info = counter_arch_bp(wp);
738738

739739
info->trigger = addr;

arch/arm64/kernel/perf_callchain.c

Lines changed: 4 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -10,94 +10,12 @@
1010

1111
#include <asm/pointer_auth.h>
1212

13-
struct frame_tail {
14-
struct frame_tail __user *fp;
15-
unsigned long lr;
16-
} __attribute__((packed));
17-
18-
/*
19-
* Get the return address for a single stackframe and return a pointer to the
20-
* next frame tail.
21-
*/
22-
static struct frame_tail __user *
23-
user_backtrace(struct frame_tail __user *tail,
24-
struct perf_callchain_entry_ctx *entry)
25-
{
26-
struct frame_tail buftail;
27-
unsigned long err;
28-
unsigned long lr;
29-
30-
/* Also check accessibility of one struct frame_tail beyond */
31-
if (!access_ok(tail, sizeof(buftail)))
32-
return NULL;
33-
34-
pagefault_disable();
35-
err = __copy_from_user_inatomic(&buftail, tail, sizeof(buftail));
36-
pagefault_enable();
37-
38-
if (err)
39-
return NULL;
40-
41-
lr = ptrauth_strip_user_insn_pac(buftail.lr);
42-
43-
perf_callchain_store(entry, lr);
44-
45-
/*
46-
* Frame pointers should strictly progress back up the stack
47-
* (towards higher addresses).
48-
*/
49-
if (tail >= buftail.fp)
50-
return NULL;
51-
52-
return buftail.fp;
53-
}
54-
55-
#ifdef CONFIG_COMPAT
56-
/*
57-
* The registers we're interested in are at the end of the variable
58-
* length saved register structure. The fp points at the end of this
59-
* structure so the address of this struct is:
60-
* (struct compat_frame_tail *)(xxx->fp)-1
61-
*
62-
* This code has been adapted from the ARM OProfile support.
63-
*/
64-
struct compat_frame_tail {
65-
compat_uptr_t fp; /* a (struct compat_frame_tail *) in compat mode */
66-
u32 sp;
67-
u32 lr;
68-
} __attribute__((packed));
69-
70-
static struct compat_frame_tail __user *
71-
compat_user_backtrace(struct compat_frame_tail __user *tail,
72-
struct perf_callchain_entry_ctx *entry)
13+
static bool callchain_trace(void *data, unsigned long pc)
7314
{
74-
struct compat_frame_tail buftail;
75-
unsigned long err;
76-
77-
/* Also check accessibility of one struct frame_tail beyond */
78-
if (!access_ok(tail, sizeof(buftail)))
79-
return NULL;
80-
81-
pagefault_disable();
82-
err = __copy_from_user_inatomic(&buftail, tail, sizeof(buftail));
83-
pagefault_enable();
84-
85-
if (err)
86-
return NULL;
87-
88-
perf_callchain_store(entry, buftail.lr);
89-
90-
/*
91-
* Frame pointers should strictly progress back up the stack
92-
* (towards higher addresses).
93-
*/
94-
if (tail + 1 >= (struct compat_frame_tail __user *)
95-
compat_ptr(buftail.fp))
96-
return NULL;
15+
struct perf_callchain_entry_ctx *entry = data;
9716

98-
return (struct compat_frame_tail __user *)compat_ptr(buftail.fp) - 1;
17+
return perf_callchain_store(entry, pc) == 0;
9918
}
100-
#endif /* CONFIG_COMPAT */
10119

10220
void perf_callchain_user(struct perf_callchain_entry_ctx *entry,
10321
struct pt_regs *regs)
@@ -107,35 +25,7 @@ void perf_callchain_user(struct perf_callchain_entry_ctx *entry,
10725
return;
10826
}
10927

110-
perf_callchain_store(entry, regs->pc);
111-
112-
if (!compat_user_mode(regs)) {
113-
/* AARCH64 mode */
114-
struct frame_tail __user *tail;
115-
116-
tail = (struct frame_tail __user *)regs->regs[29];
117-
118-
while (entry->nr < entry->max_stack &&
119-
tail && !((unsigned long)tail & 0x7))
120-
tail = user_backtrace(tail, entry);
121-
} else {
122-
#ifdef CONFIG_COMPAT
123-
/* AARCH32 compat mode */
124-
struct compat_frame_tail __user *tail;
125-
126-
tail = (struct compat_frame_tail __user *)regs->compat_fp - 1;
127-
128-
while ((entry->nr < entry->max_stack) &&
129-
tail && !((unsigned long)tail & 0x3))
130-
tail = compat_user_backtrace(tail, entry);
131-
#endif
132-
}
133-
}
134-
135-
static bool callchain_trace(void *data, unsigned long pc)
136-
{
137-
struct perf_callchain_entry_ctx *entry = data;
138-
return perf_callchain_store(entry, pc) == 0;
28+
arch_stack_walk_user(callchain_trace, entry, regs);
13929
}
14030

14131
void perf_callchain_kernel(struct perf_callchain_entry_ctx *entry,

arch/arm64/kernel/stacktrace.c

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,3 +324,123 @@ void show_stack(struct task_struct *tsk, unsigned long *sp, const char *loglvl)
324324
dump_backtrace(NULL, tsk, loglvl);
325325
barrier();
326326
}
327+
328+
/*
329+
* The struct defined for userspace stack frame in AARCH64 mode.
330+
*/
331+
struct frame_tail {
332+
struct frame_tail __user *fp;
333+
unsigned long lr;
334+
} __attribute__((packed));
335+
336+
/*
337+
* Get the return address for a single stackframe and return a pointer to the
338+
* next frame tail.
339+
*/
340+
static struct frame_tail __user *
341+
unwind_user_frame(struct frame_tail __user *tail, void *cookie,
342+
stack_trace_consume_fn consume_entry)
343+
{
344+
struct frame_tail buftail;
345+
unsigned long err;
346+
unsigned long lr;
347+
348+
/* Also check accessibility of one struct frame_tail beyond */
349+
if (!access_ok(tail, sizeof(buftail)))
350+
return NULL;
351+
352+
pagefault_disable();
353+
err = __copy_from_user_inatomic(&buftail, tail, sizeof(buftail));
354+
pagefault_enable();
355+
356+
if (err)
357+
return NULL;
358+
359+
lr = ptrauth_strip_user_insn_pac(buftail.lr);
360+
361+
if (!consume_entry(cookie, lr))
362+
return NULL;
363+
364+
/*
365+
* Frame pointers should strictly progress back up the stack
366+
* (towards higher addresses).
367+
*/
368+
if (tail >= buftail.fp)
369+
return NULL;
370+
371+
return buftail.fp;
372+
}
373+
374+
#ifdef CONFIG_COMPAT
375+
/*
376+
* The registers we're interested in are at the end of the variable
377+
* length saved register structure. The fp points at the end of this
378+
* structure so the address of this struct is:
379+
* (struct compat_frame_tail *)(xxx->fp)-1
380+
*
381+
* This code has been adapted from the ARM OProfile support.
382+
*/
383+
struct compat_frame_tail {
384+
compat_uptr_t fp; /* a (struct compat_frame_tail *) in compat mode */
385+
u32 sp;
386+
u32 lr;
387+
} __attribute__((packed));
388+
389+
static struct compat_frame_tail __user *
390+
unwind_compat_user_frame(struct compat_frame_tail __user *tail, void *cookie,
391+
stack_trace_consume_fn consume_entry)
392+
{
393+
struct compat_frame_tail buftail;
394+
unsigned long err;
395+
396+
/* Also check accessibility of one struct frame_tail beyond */
397+
if (!access_ok(tail, sizeof(buftail)))
398+
return NULL;
399+
400+
pagefault_disable();
401+
err = __copy_from_user_inatomic(&buftail, tail, sizeof(buftail));
402+
pagefault_enable();
403+
404+
if (err)
405+
return NULL;
406+
407+
if (!consume_entry(cookie, buftail.lr))
408+
return NULL;
409+
410+
/*
411+
* Frame pointers should strictly progress back up the stack
412+
* (towards higher addresses).
413+
*/
414+
if (tail + 1 >= (struct compat_frame_tail __user *)
415+
compat_ptr(buftail.fp))
416+
return NULL;
417+
418+
return (struct compat_frame_tail __user *)compat_ptr(buftail.fp) - 1;
419+
}
420+
#endif /* CONFIG_COMPAT */
421+
422+
423+
void arch_stack_walk_user(stack_trace_consume_fn consume_entry, void *cookie,
424+
const struct pt_regs *regs)
425+
{
426+
if (!consume_entry(cookie, regs->pc))
427+
return;
428+
429+
if (!compat_user_mode(regs)) {
430+
/* AARCH64 mode */
431+
struct frame_tail __user *tail;
432+
433+
tail = (struct frame_tail __user *)regs->regs[29];
434+
while (tail && !((unsigned long)tail & 0x7))
435+
tail = unwind_user_frame(tail, cookie, consume_entry);
436+
} else {
437+
#ifdef CONFIG_COMPAT
438+
/* AARCH32 compat mode */
439+
struct compat_frame_tail __user *tail;
440+
441+
tail = (struct compat_frame_tail __user *)regs->compat_fp - 1;
442+
while (tail && !((unsigned long)tail & 0x3))
443+
tail = unwind_compat_user_frame(tail, cookie, consume_entry);
444+
#endif
445+
}
446+
}

0 commit comments

Comments
 (0)