mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@kernel.org>
To: kernel test robot <lkp@intel.com>
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org
Subject: Re: [rcu:rcu/test 136/143] kernel/rcu/tree_plugin.h:2696:25: error: 'struct task_struct' has no member named 'on_cpu'
Date: Wed, 23 Dec 2020 10:33:14 -0800	[thread overview]
Message-ID: <20201223183314.GF2657@paulmck-ThinkPad-P72> (raw)
In-Reply-To: <202012232351.OhLvWNy8-lkp@intel.com>

On Wed, Dec 23, 2020 at 11:28:58PM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git rcu/test
> head:   4c4c8e04a7f8522de634aa062f4cd6b8b80c151b
> commit: 72351a864d02b480a5c237144033e21be816f29f [136/143] fixup! rcu/nocb: Add grace period and task state to show_rcu_nocb_state() output
> config: nds32-randconfig-r014-20201221 (attached as .config)
> compiler: nds32le-linux-gcc (GCC) 9.3.0
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git/commit/?id=72351a864d02b480a5c237144033e21be816f29f
>         git remote add rcu https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git
>         git fetch --no-tags rcu rcu/test
>         git checkout 72351a864d02b480a5c237144033e21be816f29f
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=nds32 
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All errors (new ones prefixed by >>):
> 
>    In file included from include/linux/kernel.h:16,
>                     from kernel/rcu/tree.c:21:
>    kernel/rcu/tree_plugin.h: In function 'show_rcu_nocb_gp_state':
> >> kernel/rcu/tree_plugin.h:2696:25: error: 'struct task_struct' has no member named 'on_cpu'
>     2696 |    !rdp->nocb_cb_kthread->on_cpu ? "!" : "");
>          |                         ^~
>    include/linux/printk.h:373:34: note: in definition of macro 'pr_info'
>      373 |  printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
>          |                                  ^~~~~~~~~~~
>    kernel/rcu/tree_plugin.h: In function 'show_rcu_nocb_state':
>    kernel/rcu/tree_plugin.h:2737:25: error: 'struct task_struct' has no member named 'on_cpu'
>     2737 |    !rdp->nocb_cb_kthread->on_cpu ? "!" : "");
>          |                         ^~
>    include/linux/printk.h:373:34: note: in definition of macro 'pr_info'
>      373 |  printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
>          |                                  ^~~~~~~~~~~

Good catch, I missed the case of !SMP and rcu_nocbs CPUs, thank you!

Does the following fix this for you?  (To be folded into the original
with attribution.)

							Thanx, Paul

------------------------------------------------------------------------

diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index 2c16fa8..f97c991 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -2668,6 +2668,19 @@ void rcu_bind_current_to_nocb(void)
 }
 EXPORT_SYMBOL_GPL(rcu_bind_current_to_nocb);
 
+// The ->on_cpu field is available only in CONFIG_SMP=y, so...
+#ifdef CONFIG_SMP
+static char *show_rcu_should_be_on_cpu(struct task_struct *tsp)
+{
+	return tsp && tsp->state == TASK_RUNNING && !tsp->on_cpu ? "!" : "";
+}
+#else // #ifdef CONFIG_SMP
+static char *show_rcu_should_be_on_cpu(struct task_struct *tsp)
+{
+	return "";
+}
+#endif // #else #ifdef CONFIG_SMP
+
 /*
  * Dump out nocb grace-period kthread state for the specified rcu_data
  * structure.
@@ -2693,8 +2706,7 @@ static void show_rcu_nocb_gp_state(struct rcu_data *rdp)
 		rnp->grplo, rnp->grphi, READ_ONCE(rdp->nocb_gp_loops),
 		rdp->nocb_gp_kthread ? task_state_to_char(rdp->nocb_gp_kthread) : '.',
 		rdp->nocb_cb_kthread ? (int)task_cpu(rdp->nocb_gp_kthread) : -1,
-		rdp->nocb_cb_kthread && rdp->nocb_cb_kthread->state == TASK_RUNNING &&
-			!rdp->nocb_cb_kthread->on_cpu ? "!" : "");
+		show_rcu_should_be_on_cpu(rdp->nocb_cb_kthread));
 }
 
 /* Dump out nocb kthread state for the specified rcu_data structure. */
@@ -2734,8 +2746,7 @@ static void show_rcu_nocb_state(struct rcu_data *rdp)
 		rcu_segcblist_n_cbs(&rdp->cblist),
 		rdp->nocb_cb_kthread ? task_state_to_char(rdp->nocb_cb_kthread) : '.',
 		rdp->nocb_cb_kthread ? (int)task_cpu(rdp->nocb_gp_kthread) : -1,
-		rdp->nocb_cb_kthread && rdp->nocb_cb_kthread->state == TASK_RUNNING &&
-			!rdp->nocb_cb_kthread->on_cpu ? "!" : "");
+		show_rcu_should_be_on_cpu(rdp->nocb_cb_kthread));
 
 	/* It is OK for GP kthreads to have GP state. */
 	if (rdp->nocb_gp_rdp == rdp)

      reply	other threads:[~2020-12-23 18:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-23 15:28 kernel test robot
2020-12-23 18:33 ` Paul E. McKenney [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201223183314.GF2657@paulmck-ThinkPad-P72 \
    --to=paulmck@kernel.org \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®