Skip to content

Commit 45c9f2b

Browse files
Vasily Gorbikhcahca
authored andcommitted
s390/entry: Mark IRQ entries to fix stack depot warnings
The stack depot filters out everything outside of the top interrupt context as an uninteresting or irrelevant part of the stack traces. This helps with stack trace de-duplication, avoiding an explosion of saved stack traces that share the same IRQ context code path but originate from different randomly interrupted points, eventually exhausting the stack depot. Filtering uses in_irqentry_text() to identify functions within the .irqentry.text and .softirqentry.text sections, which then become the last stack trace entries being saved. While __do_softirq() is placed into the .softirqentry.text section by common code, populating .irqentry.text is architecture-specific. Currently, the .irqentry.text section on s390 is empty, which prevents stack depot filtering and de-duplication and could result in warnings like: Stack depot reached limit capacity WARNING: CPU: 0 PID: 286113 at lib/stackdepot.c:252 depot_alloc_stack+0x39a/0x3c8 with PREEMPT and KASAN enabled. Fix this by moving the IO/EXT interrupt handlers from .kprobes.text into the .irqentry.text section and updating the kprobes blacklist to include the .irqentry.text section. This is done only for asynchronous interrupts and explicitly not for program checks, which are synchronous and where the context beyond the program check is important to preserve. Despite machine checks being somewhat in between, they are extremely rare, and preserving context when possible is also of value. SVCs and Restart Interrupts are not relevant, one being always at the boundary to user space and the other being a one-time thing. IRQ entries filtering is also optionally used in ftrace function graph, where the same logic applies. Cc: [email protected] # 5.15+ Reviewed-by: Heiko Carstens <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
1 parent 7bc1ee2 commit 45c9f2b

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

arch/s390/kernel/entry.S

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,9 +430,13 @@ SYM_CODE_START(\name)
430430
SYM_CODE_END(\name)
431431
.endm
432432

433+
.section .irqentry.text, "ax"
434+
433435
INT_HANDLER ext_int_handler,__LC_EXT_OLD_PSW,do_ext_irq
434436
INT_HANDLER io_int_handler,__LC_IO_OLD_PSW,do_io_irq
435437

438+
.section .kprobes.text, "ax"
439+
436440
/*
437441
* Machine check handler routines
438442
*/

arch/s390/kernel/kprobes.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,12 @@ int __init arch_init_kprobes(void)
489489
return 0;
490490
}
491491

492+
int __init arch_populate_kprobe_blacklist(void)
493+
{
494+
return kprobe_add_area_blacklist((unsigned long)__irqentry_text_start,
495+
(unsigned long)__irqentry_text_end);
496+
}
497+
492498
int arch_trampoline_kprobe(struct kprobe *p)
493499
{
494500
return 0;

0 commit comments

Comments
 (0)