diff mbox series

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

Message ID 20231107215742.363031-4-ankur.a.arora@oracle.com (mailing list archive)
State New
Headers show
Series Make the kernel preemptible | expand

Commit Message

Ankur Arora Nov. 7, 2023, 9:56 p.m. UTC
This reverts commit 089c02ae2771a14af2928c59c56abfb9b885a8d7.

Signed-off-by: Ankur Arora <ankur.a.arora@oracle.com>
---
 kernel/trace/trace.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

Comments

Steven Rostedt Nov. 7, 2023, 11:10 p.m. UTC | #1
On Tue,  7 Nov 2023 13:56:49 -0800
Ankur Arora <ankur.a.arora@oracle.com> 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
Ankur Arora Nov. 7, 2023, 11:23 p.m. UTC | #2
Steven Rostedt <rostedt@goodmis.org> writes:

> On Tue,  7 Nov 2023 13:56:49 -0800
> Ankur Arora <ankur.a.arora@oracle.com> 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.
>
Oh absolutely. As I mention in the cover at least these three patches
would be back:

       089c02ae2771 ("ftrace: Use preemption model accessors for trace header printout")
       cfe43f478b79 ("preempt/dynamic: Introduce preemption model accessors")
       5693fa74f98a ("kcsan: Use preemption model accessors")

The intent was (which I didn't do for the RFC), to do the reverts as cleanly
as possible, do the changes for the series and then bring these patches back
with appropriate modifications.

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

Yeah, I intended to do something like that.

Or would you prefer these not be reverted (and reapplied) at all -- just fixed
as you describe here?

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

Yeah, that makes sense.

--
ankur
Steven Rostedt Nov. 7, 2023, 11:31 p.m. UTC | #3
On Tue, 07 Nov 2023 15:23:05 -0800
Ankur Arora <ankur.a.arora@oracle.com> wrote:

> Or would you prefer these not be reverted (and reapplied) at all -- just fixed
> as you describe here?

Yes, exactly that.

Thanks,

-- Steve
Steven Rostedt Nov. 7, 2023, 11:34 p.m. UTC | #4
On Tue, 7 Nov 2023 18:31:54 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:

> On Tue, 07 Nov 2023 15:23:05 -0800
> Ankur Arora <ankur.a.arora@oracle.com> wrote:
> 
> > Or would you prefer these not be reverted (and reapplied) at all -- just fixed
> > as you describe here?  
> 
> Yes, exactly that.
> 

Note, a revert usually means, "get rid of something because it's broken", it
shouldn't be used for "I'm implementing this differently, and need to
remove the old code first"

For the latter case, just remove what you don't need for the reason why
it's being removed. Reverting commits is confusing, because when you see a
revert in a git log, you think that commit was broken and needed to be taken
out.

-- Steve
Ankur Arora Nov. 8, 2023, 12:12 a.m. UTC | #5
Steven Rostedt <rostedt@goodmis.org> writes:

> On Tue, 7 Nov 2023 18:31:54 -0500
> Steven Rostedt <rostedt@goodmis.org> wrote:
>
>> On Tue, 07 Nov 2023 15:23:05 -0800
>> Ankur Arora <ankur.a.arora@oracle.com> wrote:
>>
>> > Or would you prefer these not be reverted (and reapplied) at all -- just fixed
>> > as you describe here?
>>
>> Yes, exactly that.
>>
>
> Note, a revert usually means, "get rid of something because it's broken", it
> shouldn't be used for "I'm implementing this differently, and need to
> remove the old code first"
>
> For the latter case, just remove what you don't need for the reason why
> it's being removed. Reverting commits is confusing, because when you see a
> revert in a git log, you think that commit was broken and needed to be taken
> out.

Ack that. And, agree, it did feel pretty odd to revert so many good commits.
I guess in that sense it makes sense to minimize the number of reverts.

There are some that I suspect I will have to revert. Will detail specifically
why they are being reverted.

Thanks
--
ankur
diff mbox series

Patch

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index abaaf516fcae..7f565f0a00da 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -4392,11 +4392,17 @@  print_trace_header(struct seq_file *m, struct trace_iterator *iter)
 		   entries,
 		   total,
 		   buf->cpu,
-		   preempt_model_none()      ? "server" :
-		   preempt_model_voluntary() ? "desktop" :
-		   preempt_model_full()      ? "preempt" :
-		   preempt_model_rt()        ? "preempt_rt" :
+#if defined(CONFIG_PREEMPT_NONE)
+		   "server",
+#elif defined(CONFIG_PREEMPT_VOLUNTARY)
+		   "desktop",
+#elif defined(CONFIG_PREEMPT)
+		   "preempt",
+#elif defined(CONFIG_PREEMPT_RT)
+		   "preempt_rt",
+#else
 		   "unknown",
+#endif
 		   /* These are reserved for later use */
 		   0, 0, 0, 0);
 #ifdef CONFIG_SMP