linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Vivek Goyal <vgoyal@redhat.com>
Cc: Paul Bolle <pebolle@tiscali.nl>, Jens Axboe <jaxboe@fusionio.com>,
	linux kernel mailing list <linux-kernel@vger.kernel.org>
Subject: Re: Mysterious CFQ crash and RCU
Date: Fri, 3 Jun 2011 08:33:44 -0700	[thread overview]
Message-ID: <20110603153344.GB2333@linux.vnet.ibm.com> (raw)
In-Reply-To: <20110603134514.GA31057@redhat.com>

On Fri, Jun 03, 2011 at 09:45:14AM -0400, Vivek Goyal wrote:
> On Thu, Jun 02, 2011 at 10:07:24PM -0700, Paul E. McKenney wrote:
> 
> [..]
> > > Thu May 26 10:47:20 CEST 2011
> > > /sys/kernel/debug/rcu/rcugp:
> > > rcu_sched: completed=682249  gpnum=682250
> > 
> > 15 more seconds, a few thousand more grace periods.  About 500 grace
> > periods per second, which is quite reasonable on a single-CPU system.
> 
> PaulB mentioned that crash happened at May 26 10:47:07. I am wondering
> how are we able to sample the data after the crash. I am assuming
> that above data gives information only before crash and does not
> tell us anything about what happened just before crash. What am I missing.
> 
> PaulM, in one of the mails you had mentioned that one could print
> context switch id to make sure we did not block in rcu section. Would
> you have quick pointer where is context switch id stored. May be
> I can write a small patch for PaulB.

>From what I can see, the task_struct nvcsw and nivcsw fields should do
it, though I am not seeing where these are incremented.

So if these don't do what you need, the following (untested but trivial)
patch will provide an rcu_switch_count in the task structure.

							Thanx, Paul

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

rcu: add diagnostic per-task context-switch count

Note that this is also incremented by softirqs.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 2a8621c..5ef22e2 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1261,6 +1261,7 @@ struct task_struct {
 #ifdef CONFIG_RCU_BOOST
 	struct rt_mutex *rcu_boost_mutex;
 #endif /* #ifdef CONFIG_RCU_BOOST */
+	unsigned long rcu_switch_count;
 
 #if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
 	struct sched_info sched_info;
diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 89419ff..080c6eb 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -154,6 +154,7 @@ void rcu_bh_qs(int cpu)
  */
 void rcu_note_context_switch(int cpu)
 {
+	current->rcu_switch_count++;
 	rcu_sched_qs(cpu);
 	rcu_preempt_note_context_switch(cpu);
 }

  reply	other threads:[~2011-06-03 15:33 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-19 22:24 Mysterious CFQ crash and RCU Vivek Goyal
2011-05-21 21:00 ` Paul E. McKenney
2011-05-21 22:23   ` Paul Bolle
2011-05-21 23:54     ` Paul E. McKenney
2011-05-22 19:30       ` Paul Bolle
2011-05-22 20:13         ` Paul E. McKenney
2011-05-23 15:21   ` Vivek Goyal
2011-05-23 15:38     ` Paul E. McKenney
2011-05-23 22:20       ` Paul Bolle
2011-05-24  4:14         ` Paul E. McKenney
2011-05-24  9:41         ` Jens Axboe
2011-05-24 14:35           ` Paul E. McKenney
2011-05-24 14:51             ` Jens Axboe
2011-05-24 15:42               ` Paul E. McKenney
2011-05-24 15:51                 ` Paul E. McKenney
2011-05-25  8:28           ` Paul Bolle
2011-05-25  8:46             ` Jens Axboe
2011-05-25  9:13               ` Paul Bolle
2011-05-25  9:30                 ` Jens Axboe
2011-05-25  9:40                   ` Paul Bolle
2011-05-25 12:48               ` Paul Bolle
2011-05-25 12:51                 ` Jens Axboe
2011-05-25 17:28               ` Paul Bolle
2011-05-25 18:59                 ` Jens Axboe
2011-05-25 10:17       ` Paul Bolle
2011-05-25 15:33         ` Paul E. McKenney
2011-05-25 17:44           ` Paul Bolle
2011-05-25 20:40             ` Paul E. McKenney
2011-05-26  9:15       ` Paul Bolle
2011-06-03  5:07         ` Paul E. McKenney
2011-06-03 13:45           ` Vivek Goyal
2011-06-03 15:33             ` Paul E. McKenney [this message]
2011-06-03 16:54               ` Paul E. McKenney
2011-06-04 12:22             ` Paul Bolle
2011-06-04 12:50           ` Paul Bolle
2011-06-04 16:03             ` Paul E. McKenney
2011-06-04 22:48               ` Paul Bolle
2011-06-04 23:06                 ` Paul E. McKenney
2011-08-04 15:05                   ` Vivek Goyal
2011-08-04 19:43                     ` Jens Axboe
2011-08-04 19:51                       ` Vivek Goyal
2011-06-05  6:56                 ` Jens Axboe
2011-06-05  8:39                   ` Paul Bolle
2011-06-05 10:38                   ` Paul Bolle
2011-06-05 22:51                     ` Jens Axboe
2011-06-06 14:28                   ` Vivek Goyal
2011-05-23 15:36   ` Vivek Goyal

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=20110603153344.GB2333@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=jaxboe@fusionio.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pebolle@tiscali.nl \
    --cc=vgoyal@redhat.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;
as well as URLs for NNTP newsgroup(s).