Skip to contentSkip to conversation

rcu: Fix incorrect trace string in rcu_boost_kthread()

PATCH In review Zqiang 2 participants 4 messages Mar 18, 2023 – Mar 19, 2023 RCU

lore
Share & tools
lore

Zqiang

author
#0 lore raw

PATCH 1/1 rcu: Fix incorrect trace string in rcu_boost_kthread()

Currently, the trace string information before and after rcu_wait() and schedule_timeout_idle() are reversed, this commit therefore switches these strings in order to correctly trace.

---
 kernel/rcu/tree_plugin.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/rcu/tree_plugin.h +4 -4
index 7b0fe741a088..7b622b5196a8 100644
@@ -1114,10 +1114,10 @@ static int rcu_boost_kthread(void *arg)
 	trace_rcu_utilization(TPS("Start boost kthread@init"));
 	for (;;) {
 		WRITE_ONCE(rnp->boost_kthread_status, RCU_KTHREAD_WAITING);
-		trace_rcu_utilization(TPS("End boost kthread@rcu_wait"));
+		trace_rcu_utilization(TPS("Start boost kthread@rcu_wait"));
 		rcu_wait(READ_ONCE(rnp->boost_tasks) ||
 			 READ_ONCE(rnp->exp_tasks));
-		trace_rcu_utilization(TPS("Start boost kthread@rcu_wait"));
+		trace_rcu_utilization(TPS("End boost kthread@rcu_wait"));
 		WRITE_ONCE(rnp->boost_kthread_status, RCU_KTHREAD_RUNNING);
 		more2boost = rcu_boost(rnp);
 		if (more2boost)
@@ -1126,9 +1126,9 @@ static int rcu_boost_kthread(void *arg)
 			spincnt = 0;
 		if (spincnt > 10) {
 			WRITE_ONCE(rnp->boost_kthread_status, RCU_KTHREAD_YIELDING);
-			trace_rcu_utilization(TPS("End boost kthread@rcu_yield"));
-			schedule_timeout_idle(2);
 			trace_rcu_utilization(TPS("Start boost kthread@rcu_yield"));
+			schedule_timeout_idle(2);
+			trace_rcu_utilization(TPS("End boost kthread@rcu_yield"));
 			spincnt = 0;
 		}
 	}
Signature · 1 line
2.25.1
#1 lore raw
Quoted 4 lines · Zqiang

Currently, the trace string information before and after rcu_wait() and schedule_timeout_idle() are reversed, this commit therefore switches these strings in order to correctly trace.

I suggest provide more details of how this affects your tracing. One commit to draw inspiration from could be:

f7f7bac9cb1c ("rcu: Have the RCU tracepoints use the tracepoint_string infrastructure")

Which also modifies the same code.

Quoted 11 lines
---
 kernel/rcu/tree_plugin.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/rcu/tree_plugin.h +0 -0
index 7b0fe741a088..7b622b5196a8 100644

kernel/rcu/tree_plugin.h static int rcu_boost_kthread(void *arg) · line 1117

Quoted 5 lines
kernel/rcu/tree_plugin.h +1 -1
@@ -1114,10 +1114,10 @@ static int rcu_boost_kthread(void *arg)
        trace_rcu_utilization(TPS("Start boost kthread@init"));
        for (;;) {
                WRITE_ONCE(rnp->boost_kthread_status, RCU_KTHREAD_WAITING);
-               trace_rcu_utilization(TPS("End boost kthread@rcu_wait"));
+               trace_rcu_utilization(TPS("Start boost kthread@rcu_wait"));

Doesn't that look weird because now you will have 2 "Start boost kthread@" messages in succession (one of them coming before the for loop) ?

kernel/rcu/tree_plugin.h static int rcu_boost_kthread(void *arg) · line 1122

Quoted 6 lines
kernel/rcu/tree_plugin.h +1 -1
                rcu_wait(READ_ONCE(rnp->boost_tasks) ||
                         READ_ONCE(rnp->exp_tasks));
-               trace_rcu_utilization(TPS("Start boost kthread@rcu_wait"));
+               trace_rcu_utilization(TPS("End boost kthread@rcu_wait"));
                WRITE_ONCE(rnp->boost_kthread_status, RCU_KTHREAD_RUNNING);
                more2boost = rcu_boost(rnp);

Also, it is weird here that you are calling rcu_boost() right after printing "End boost kthread".

thanks,

- Joel

Quoted 16 lines
kernel/rcu/tree_plugin.h +2 -3
                if (more2boost)
@@ -1126,9 +1126,9 @@ static int rcu_boost_kthread(void *arg)
                        spincnt = 0;
                if (spincnt > 10) {
                        WRITE_ONCE(rnp->boost_kthread_status, RCU_KTHREAD_YIELDING);
-                       trace_rcu_utilization(TPS("End boost kthread@rcu_yield"));
-                       schedule_timeout_idle(2);
                        trace_rcu_utilization(TPS("Start boost kthread@rcu_yield"));
+                       schedule_timeout_idle(2);
+                       trace_rcu_utilization(TPS("End boost kthread@rcu_yield"));
                        spincnt = 0;
                }
        }
--

2.25.1

#2 lore raw
Quoted 25 lines

Currently, the trace string information before and after rcu_wait() and schedule_timeout_idle() are reversed, this commit therefore switches these strings in order to correctly trace.

I suggest provide more details of how this affects your tracing. One commit to draw inspiration from could be:

f7f7bac9cb1c ("rcu: Have the RCU tracepoints use the tracepoint_string infrastructure")

Which also modifies the same code.

---
 kernel/rcu/tree_plugin.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/rcu/tree_plugin.h +0 -0
index 7b0fe741a088..7b622b5196a8 100644

kernel/rcu/tree_plugin.h static int rcu_boost_kthread(void *arg) · line 1117

Quoted 5 lines
kernel/rcu/tree_plugin.h +1 -1
@@ -1114,10 +1114,10 @@ static int rcu_boost_kthread(void *arg)
        trace_rcu_utilization(TPS("Start boost kthread@init"));
        for (;;) {
                WRITE_ONCE(rnp->boost_kthread_status, RCU_KTHREAD_WAITING);
-               trace_rcu_utilization(TPS("End boost kthread@rcu_wait"));
+               trace_rcu_utilization(TPS("Start boost kthread@rcu_wait"));

Doesn't that look weird because now you will have 2 "Start boost kthread@" messages in succession (one of them coming before the for loop) ?

Quoted 10 lines
kernel/rcu/tree_plugin.h +1 -1
                rcu_wait(READ_ONCE(rnp->boost_tasks) ||
                         READ_ONCE(rnp->exp_tasks));
-               trace_rcu_utilization(TPS("Start boost kthread@rcu_wait"));
+               trace_rcu_utilization(TPS("End boost kthread@rcu_wait"));
                WRITE_ONCE(rnp->boost_kthread_status, RCU_KTHREAD_RUNNING);
                more2boost = rcu_boost(rnp);
 

Also, it is weird here that you are calling rcu_boost() right after printing "End boost kthread".

Hi Joel

Shouldn't that be the normal logic? Or I misunderstood?

trace_rcu_utilization(TPS("Start boost kthread@rcu_wait")); //start wait rcu_wait();
trace_rcu_utilization(TPS("End boost kthread@rcu_wait")); // end wait

Thanks
Zqiang

Quoted 22 lines

thanks,

- Joel

if (more2boost)

kernel/rcu/tree_plugin.h +2 -3
@@ -1126,9 +1126,9 @@ static int rcu_boost_kthread(void *arg)
                        spincnt = 0;
                if (spincnt > 10) {
                        WRITE_ONCE(rnp->boost_kthread_status, RCU_KTHREAD_YIELDING);
-                       trace_rcu_utilization(TPS("End boost kthread@rcu_yield"));
-                       schedule_timeout_idle(2);
                        trace_rcu_utilization(TPS("Start boost kthread@rcu_yield"));
+                       schedule_timeout_idle(2);
+                       trace_rcu_utilization(TPS("End boost kthread@rcu_yield"));
                        spincnt = 0;
                }
        }
--

2.25.1

#3 lore raw
In reply to Joel Fernandes
Quoted 41 lines · Zqiang

Currently, the trace string information before and after rcu_wait() and schedule_timeout_idle() are reversed, this commit therefore switches these strings in order to correctly trace.

I suggest provide more details of how this affects your tracing. One commit to draw inspiration from could be:

f7f7bac9cb1c ("rcu: Have the RCU tracepoints use the tracepoint_string infrastructure")

Which also modifies the same code.

---
 kernel/rcu/tree_plugin.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/rcu/tree_plugin.h +1 -1
index 7b0fe741a088..7b622b5196a8 100644
@@ -1114,10 +1114,10 @@ static int rcu_boost_kthread(void *arg)
        trace_rcu_utilization(TPS("Start boost kthread@init"));
        for (;;) {
                WRITE_ONCE(rnp->boost_kthread_status, RCU_KTHREAD_WAITING);
-               trace_rcu_utilization(TPS("End boost kthread@rcu_wait"));
+               trace_rcu_utilization(TPS("Start boost kthread@rcu_wait"));
 

Doesn't that look weird because now you will have 2 "Start boost kthread@" messages in succession (one of them coming before the for loop) ?

                rcu_wait(READ_ONCE(rnp->boost_tasks) ||
                         READ_ONCE(rnp->exp_tasks));
kernel/rcu/tree_plugin.h +1 -1
-               trace_rcu_utilization(TPS("Start boost kthread@rcu_wait"));
+               trace_rcu_utilization(TPS("End boost kthread@rcu_wait"));
                WRITE_ONCE(rnp->boost_kthread_status, RCU_KTHREAD_RUNNING);
                more2boost = rcu_boost(rnp);
Quoted 2 lines

Also, it is weird here that you are calling rcu_boost() right after printing "End boost kthread".

The trace I understand should be like this:

rcu_boost_kthread()

{
	trace_rcu_utilization(TPS("Start boost kthread@init"));

	for (;;) {
		trace_rcu_utilization(TPS("Start boost kthread@rcu_wait"));
		rcu_wait();
		trace_rcu_utilization(TPS("End boost kthread@rcu_wait"));

		rcu_boost()
		
		trace_rcu_utilization(TPS("Start boost kthread@rcu_yield"));
		schedule_timeout_idle(2);
		trace_rcu_utilization(TPS("End boost kthread@rcu_yield"));
	}

}

Thanks
Zqiang

Quoted 23 lines

thanks,

- Joel

if (more2boost)

kernel/rcu/tree_plugin.h +2 -3
@@ -1126,9 +1126,9 @@ static int rcu_boost_kthread(void *arg)
                        spincnt = 0;
                if (spincnt > 10) {
                        WRITE_ONCE(rnp->boost_kthread_status, RCU_KTHREAD_YIELDING);
-                       trace_rcu_utilization(TPS("End boost kthread@rcu_yield"));
-                       schedule_timeout_idle(2);
                        trace_rcu_utilization(TPS("Start boost kthread@rcu_yield"));
+                       schedule_timeout_idle(2);
+                       trace_rcu_utilization(TPS("End boost kthread@rcu_yield"));
                        spincnt = 0;
                }
        }
--

2.25.1