Skip to contentSkip to conversation

linux-next: manual merge of the rcu tree with the tip tree

DISCUSSION Stephen Rothwell 2 participants 2 messages Oct 12, 2021 – Oct 13, 2021 Linux-next tree

lore
Share & tools
lore
#0 lore raw

Hi all,

Today's linux-next merge of the rcu tree got a conflict in:

kernel/rcu/tasks.h

between commit:

9b3c4ab3045e ("sched,rcu: Rework try_invoke_on_locked_down_task()")

from the tip tree and commit:

18f08e758f34 ("rcu-tasks: Add trc_inspect_reader() checks for exiting critical section")

from the rcu tree.

I fixed it up (I hope - see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts.

Signature · 48 lines
Cheers,
Stephen Rothwell

diff --cc kernel/rcu/tasks.h
index 171bc848e8e3,e4a32db9f712..000000000000
--- a/kernel/rcu/tasks.h
+++ b/kernel/rcu/tasks.h
@@@ -928,10 -919,10 +919,10 @@@ reset_ipi
  }
  
  /* Callback function for scheduler to check locked-down task.  */
 -static bool trc_inspect_reader(struct task_struct *t, void *arg)
 +static int trc_inspect_reader(struct task_struct *t, void *arg)
  {
  	int cpu = task_cpu(t);
- 	bool in_qs = false;
+ 	int nesting;
  	bool ofl = cpu_is_offline(cpu);
  
  	if (task_curr(t)) {
@@@ -951,18 -942,18 +942,18 @@@
  		n_heavy_reader_updates++;
  		if (ofl)
  			n_heavy_reader_ofl_updates++;
- 		in_qs = true;
+ 		nesting = 0;
  	} else {
  		// The task is not running, so C-language access is safe.
- 		in_qs = likely(!t->trc_reader_nesting);
+ 		nesting = t->trc_reader_nesting;
  	}
  
- 	// Mark as checked so that the grace-period kthread will
- 	// remove it from the holdout list.
- 	t->trc_reader_checked = true;
- 
- 	if (in_qs)
- 		return 0;  // Already in quiescent state, done!!!
+ 	// If not exiting a read-side critical section, mark as checked
+ 	// so that the grace-period kthread will remove it from the
+ 	// holdout list.
+ 	t->trc_reader_checked = nesting >= 0;
+ 	if (nesting <= 0)
 -		return !nesting;  // If in QS, done, otherwise try again later.
++		return (!nesting) ? 0 : -EINVAL;  // If in QS, done, otherwise try again later.
  
  	// The task is in a read-side critical section, so set up its
  	// state so that it will awaken the grace-period kthread upon exit
#1 lore raw
Quoted 14 lines · Stephen Rothwell

Hi all,

Today's linux-next merge of the rcu tree got a conflict in:

kernel/rcu/tasks.h

between commit:

9b3c4ab3045e ("sched,rcu: Rework try_invoke_on_locked_down_task()")

from the tip tree and commit:

18f08e758f34 ("rcu-tasks: Add trc_inspect_reader() checks for exiting critical section")

Quoted 8 lines

from the rcu tree.

I fixed it up (I hope - see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts.

Thank you for catching this! I have it down for my upcoming pull request.

Thanx, Paul

Quoted 49 lines
Signature · 2 lines
Cheers,
Stephen Rothwell
kernel/rcu/tasks.h +9 -9
diff --cc kernel/rcu/tasks.h
index 171bc848e8e3,e4a32db9f712..000000000000
@@@ -928,10 -919,10 +919,10 @@@ reset_ipi
  }
 
  /* Callback function for scheduler to check locked-down task.  */
 -static bool trc_inspect_reader(struct task_struct *t, void *arg)
 +static int trc_inspect_reader(struct task_struct *t, void *arg)
  {
  	int cpu = task_cpu(t);
- 	bool in_qs = false;
+ 	int nesting;
  	bool ofl = cpu_is_offline(cpu);
 
  	if (task_curr(t)) {
@@@ -951,18 -942,18 +942,18 @@@
  		n_heavy_reader_updates++;
  		if (ofl)
  			n_heavy_reader_ofl_updates++;
- 		in_qs = true;
+ 		nesting = 0;
  	} else {
  		// The task is not running, so C-language access is safe.
- 		in_qs = likely(!t->trc_reader_nesting);
+ 		nesting = t->trc_reader_nesting;
  	}
 
- 	// Mark as checked so that the grace-period kthread will
- 	// remove it from the holdout list.
- 	t->trc_reader_checked = true;
- 
- 	if (in_qs)
- 		return 0;  // Already in quiescent state, done!!!
+ 	// If not exiting a read-side critical section, mark as checked
+ 	// so that the grace-period kthread will remove it from the
+ 	// holdout list.
+ 	t->trc_reader_checked = nesting >= 0;
+ 	if (nesting <= 0)
 -		return !nesting;  // If in QS, done, otherwise try again later.
++		return (!nesting) ? 0 : -EINVAL;  // If in QS, done, otherwise try again later.
 
  	// The task is in a read-side critical section, so set up its
  	// state so that it will awaken the grace-period kthread upon exit