public inbox for linux-trace-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] tracing: Make percpu stack trace buffer invariant to PAGE_SIZE
@ 2024-10-21 14:18 Ryan Roberts
  2024-10-30  8:50 ` Ryan Roberts
  0 siblings, 1 reply; 3+ messages in thread
From: Ryan Roberts @ 2024-10-21 14:18 UTC (permalink / raw)
  To: Steven Rostedt, Masami Hiramatsu, Mathieu Desnoyers
  Cc: Ryan Roberts, linux-kernel, linux-trace-kernel

Previously the size of "struct ftrace_stacks" depended upon PAGE_SIZE.
For the common 4K page size, on a 64-bit system, sizeof(struct
ftrace_stacks) was 32K. But for a 64K page size, sizeof(struct
ftrace_stacks) was 512K.

But ftrace stack usage requirements should be invariant to page size. So
let's redefine FTRACE_KSTACK_ENTRIES so that "struct ftrace_stacks" is
always sized at 32K for 64-bit and 16K for 32-bit.

As a side effect, it removes the PAGE_SIZE compile-time constant
assumption from this code, which is required to reach the goal of
boot-time page size selection.

Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
---
 kernel/trace/trace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 1c69ca1f1088..d4654943b580 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -2914,7 +2914,7 @@ trace_function(struct trace_array *tr, unsigned long ip, unsigned long
 /* Allow 4 levels of nesting: normal, softirq, irq, NMI */
 #define FTRACE_KSTACK_NESTING	4

-#define FTRACE_KSTACK_ENTRIES	(PAGE_SIZE / FTRACE_KSTACK_NESTING)
+#define FTRACE_KSTACK_ENTRIES	(SZ_4K / FTRACE_KSTACK_NESTING)

 struct ftrace_stack {
 	unsigned long		calls[FTRACE_KSTACK_ENTRIES];
--
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-10-30 21:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-21 14:18 [PATCH v2] tracing: Make percpu stack trace buffer invariant to PAGE_SIZE Ryan Roberts
2024-10-30  8:50 ` Ryan Roberts
2024-10-30 21:15   ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox