Re: [RFC PATCH 03/86] Revert "ftrace: Use preemption model accessors for trace header printout"

From: Steven Rostedt
Date: Tue Nov 07 2023 - 18:13:25 EST


On Tue, 7 Nov 2023 13:56:49 -0800
Ankur Arora <ankur.a.arora@xxxxxxxxxx> wrote:

> This reverts commit 089c02ae2771a14af2928c59c56abfb9b885a8d7.

I rather not revert this.

If user space can decided between various version of preemption, then the
trace should reflect that. At least state what the preemption model was when
a trace started, or currently is.

That is, the model may not be "static" per boot. Anyway, the real change here should be:

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 7b4b1fcd6f93..2553c4efca15 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2208,14 +2208,6 @@ static inline void cond_resched_rcu(void)
#endif
}

-#ifdef CONFIG_PREEMPT_DYNAMIC
-
-extern bool preempt_model_none(void);
-extern bool preempt_model_voluntary(void);
-extern bool preempt_model_full(void);
-
-#else
-
static inline bool preempt_model_none(void)
{
return IS_ENABLED(CONFIG_PREEMPT_NONE);
@@ -2229,8 +2221,6 @@ static inline bool preempt_model_full(void)
return IS_ENABLED(CONFIG_PREEMPT);
}

-#endif
-
static inline bool preempt_model_rt(void)
{
return IS_ENABLED(CONFIG_PREEMPT_RT);


Then this way we can decided to make it runtime dynamic, we don't need to
fiddle with the tracing code again.

-- Steve