linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Arjan van de Ven <arjan@infradead.org>
Cc: dipankar@in.ibm.com, linux-input@vger.kernel.org,
	dmitry.torokhov@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: Question about usage of RCU in the input layer
Date: Thu, 19 Mar 2009 21:45:41 -0700	[thread overview]
Message-ID: <20090320044541.GE6807@linux.vnet.ibm.com> (raw)
In-Reply-To: <20090319202032.4c971d92@infradead.org>

On Thu, Mar 19, 2009 at 08:20:32PM -0700, Arjan van de Ven wrote:
> On Thu, 19 Mar 2009 19:07:50 -0700
> "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> wrote:
> 
> > On Thu, Mar 19, 2009 at 07:18:41AM -0700, Arjan van de Ven wrote:
> > > On Thu, 19 Mar 2009 14:26:28 +0530
> > > Dipankar Sarma <dipankar@in.ibm.com> wrote:
> > > 
> > > > On Wed, Mar 18, 2009 at 09:58:12PM -0700, Arjan van de Ven wrote:
> > > > > Hi,
> > > > > 
> > > > > the input layer does a "synchronize_rcu()" after a
> > > > > list_add_tail_rcu(), which is costing me 1 second of boot
> > > > > time..... And based on my understanding of the RCU concept, you
> > > > > only need to synchronize on delete, not on addition... so I
> > > > > think the synchronize is entirely redundant here...
> > > > 
> > > > The more appropriate question is - why is synchronize_rcu() taking
> > > > 1 second ? Any idea what the other CPUs are doing at the time
> > > > of calling synchronize_rcu() ?
> > > 
> > > one cpu is doing a lot of i2c traffic which is a bunch of udelay()s
> > > in loops.. then it does quite a bit of uncached memory access, and
> > > the lot takes quite while.
> > > 
> > > > What driver is this ? How early
> > > > in the boot is this happening ? 
> > > 
> > > during kernel boot.
> > > 
> > > I suppose my question is also more generic.. why synchronize when
> > > it's not needed? At least based on my understanding of RCU (but
> > > you're the expert), you don't need to synchronize for an add, only
> > > between a delete and a (k)free.....
> > 
> > I don't claim to understand the code in question, so it is entirely
> > possible that the following is irrelevant.  But one other reason for
> > synchronize_rcu() is:
> > 
> > 1.	Make change.
> > 
> > 2.	synchronize_rcu()
> > 
> > 3.	Now you are guaranteed that all CPUs/tasks/whatever
> > currently running either are not messing with you on the one hand, or
> > 	have seen the change on the other.
> 
> ok so this is for the case where someone is already iterating the list.
> 
> I don't see anything in the code that assumes this..

I must let the networking guys sort this out.

> > It sounds like you are seeing these delays later in boot, however,
> 
> yeah it's during driver init/
> 
> > Alternatively, again assuming a single-CPU system
> 
> single CPU is soooo last decade ;-)
> But seriously I no longer have systems that aren't dual core or SMT in
> some form... 

OK, I will ask the stupid question...

Why not delay bringing up the non-boot CPUs until later in boot?
The first patch in my earlier email (which is in mainline) will shortcut
synchronize_rcu() whenever there is only one CPU is online, at least
for Classic RCU and Hierarchical RCU.

							Thanx, Paul

  reply	other threads:[~2009-03-20  5:06 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-19  4:58 Question about usage of RCU in the input layer Arjan van de Ven
2009-03-19  7:23 ` Dmitry Torokhov
2009-03-19 14:02   ` Arjan van de Ven
2009-03-19  8:56 ` Dipankar Sarma
2009-03-19 14:18   ` Arjan van de Ven
2009-03-20  2:07     ` Paul E. McKenney
2009-03-20  3:20       ` Arjan van de Ven
2009-03-20  4:45         ` Paul E. McKenney [this message]
2009-03-20  5:28           ` Eric Dumazet
2009-03-20  6:01             ` Dipankar Sarma
2009-03-20  6:35               ` Eric Dumazet
2009-03-20 13:50           ` Arjan van de Ven
2009-03-20 14:31             ` Paul E. McKenney
2009-03-20 18:13               ` Arjan van de Ven
2009-03-21  1:27                 ` Paul E. McKenney
2009-03-21  4:58                   ` Arjan van de Ven
2009-03-21 18:58                     ` Paul E. McKenney
2009-03-21 19:51                   ` Arjan van de Ven
2009-03-21 20:26                     ` Eric Dumazet
2009-03-21 21:07                       ` Paul E. McKenney
2009-03-22  3:40                         ` Arjan van de Ven
2009-03-22  4:38                           ` Paul E. McKenney
2009-03-22  4:51                             ` Arjan van de Ven
2009-03-22  5:18                               ` Paul E. McKenney
2009-03-22  5:53                                 ` Arjan van de Ven
2009-03-22 16:53                                   ` Paul E. McKenney
2009-03-22 19:46                                     ` Arjan van de Ven
2009-03-22 20:52                                       ` Paul E. McKenney
2009-03-22 22:44                                         ` Arjan van de Ven
2009-03-22 23:03                                           ` Paul E. McKenney
2009-03-22 23:16                                             ` Arjan van de Ven
2009-03-23  1:27                                               ` Paul E. McKenney
2009-04-03  1:27                                                 ` Paul E. McKenney
2009-03-21 21:13                       ` Arjan van de Ven
2009-03-20 22:21               ` Paul E. McKenney
2009-03-21  5:46         ` Dmitry Torokhov
2009-03-21  9:13           ` Eric Dumazet
2009-03-21 18:58             ` Paul E. McKenney

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=20090320044541.GE6807@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=arjan@infradead.org \
    --cc=dipankar@in.ibm.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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).