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

From: Stephen Rothwell <[email-masked]>
Date: Tue, 12 Oct 2021 15:48:28 +1100

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.

-- 
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