All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@us.ibm.com>
To: Keith Owens <kaos@sgi.com>
Cc: John Hesterberg <jh@sgi.com>, Matt Helsley <matthltc@us.ibm.com>,
	Jes Sorensen <jes@trained-monkey.org>,
	Shailabh Nagar <nagar@watson.ibm.com>,
	Andrew Morton <akpm@osdl.org>, Jay Lan <jlan@engr.sgi.com>,
	LKML <linux-kernel@vger.kernel.org>,
	elsa-devel@lists.sourceforge.net, lse-tech@lists.sourceforge.net,
	CKRM-Tech <ckrm-tech@lists.sourceforge.net>,
	Paul Jackson <pj@sgi.com>, Erik Jacobson <erikj@sgi.com>,
	Jack Steiner <steiner@sgi.com>
Subject: Re: [Lse-tech] Re: [ckrm-tech] Re: [PATCH 00/01] Move Exit Connectors
Date: Wed, 11 Jan 2006 21:04:53 -0800	[thread overview]
Message-ID: <20060112050453.GA23673@us.ibm.com> (raw)
In-Reply-To: <8699.1137036592@kao2.melbourne.sgi.com>

On Thu, Jan 12, 2006 at 02:29:52PM +1100, Keith Owens wrote:
> John Hesterberg (on Wed, 11 Jan 2006 15:39:10 -0600) wrote:
> >On Wed, Jan 11, 2006 at 01:02:10PM -0800, Matt Helsley wrote:
> >> 	Have you looked at Alan Stern's notifier chain fix patch? Could that be
> >> used in task_notify?
> >
> >I have two concerns about an all-tasks notification interface.
> >First, we want this to scale, so don't want more global locks.
> >One unique part of the task notify is that it doesn't use locks.
> 
> Neither does Alan Stern's atomic notifier chain.  Indeed it cannot use
> locks, because the atomic notifier chains can be called from anywhere,
> including non maskable interrupts.  The downside is that Alan's atomic
> notifier chains require RCU.
> 
> An alternative patch that requires no locks and does not even require
> RCU is in http://marc.theaimsgroup.com/?l=linux-kernel&m=113392370322545&w=2

Interesting!  Missed this on the first time around...

But doesn't notifier_call_chain_lockfree() need to either disable
preemption or use atomic operations to update notifier_chain_lockfree_inuse[]
in order to avoid problems with preemption?  If I understand the
code, one such problem could be caused by the following sequence
of events:

1.	Task A enters notifier_call_chain_lockfree(), gets a copy
	of the current CPU in local variable "cpu", snapshots the
	(initially zero) value of notifier_chain_lockfree_inuse[cpu]
	into local variable "nested", then is preempted.

2.	Task B enters notifier_call_chain_lockfree(), gets a copy
	of the current CPU in local variable "cpu", snapshots the
	(still zero) value of notifier_chain_lockfree_inuse[cpu]
	into local variable "nested", sets the value of
	notifier_chain_lockfree_inuse[cpu] to 1.

3.	Task A runs again, perhaps because Task B's priority dropped,
	perhaps because some other CPU became available.  It also
	sets the value of notifier_chain_lockfree_inuse[cpu] to 1.
	It then gains a reference to a notifier_block (call it Fred).

4.	Task B completes running through the notifier chain and sets
	notifier_chain_lockfree_inuse[cpu] = nested, which is zero.

5.	Task C invokes notifier_chain_unregister_lockfree() in order
	to remove Fred.  Task C finds all notifier_chain_lockfree_inuse[cpu]
	entries equal to zero, so removes Fred while Task A is still
	referencing it.  Which I believe is what was to be prevented.

If one updates notifier_chain_lockfree_inuse[cpu] using atomics,
then one could imagine a sequence of calls to notifier_call_chain_lockfree()
and preemptions that prevented one of the notifier_chain_lockfree_inuse[]
elements from ever reaching zero (though maybe this is being overly
paranoid).  If one disables preemption, then latency might become
excessive.

So what am I missing?

						Thanx, Paul

  reply	other threads:[~2006-01-12  5:04 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-03 23:16 [Patch 0/6] Per-task delay accounting Shailabh Nagar
2006-01-03 23:23 ` [Patch 1/6] Delay accounting: timespec diff Shailabh Nagar
2006-01-03 23:26 ` [Patch 2/6] Delay accounting: Initialization, kernel boot option Shailabh Nagar
2006-01-03 23:28 ` [Patch 3/6] Delay accounting: Sync block I/O delays Shailabh Nagar
2006-01-03 23:30 ` [Patch 4/6] Delay accounting: Swap in delays Shailabh Nagar
2006-01-03 23:31 ` [Patch 5/6] Delay accounting: /proc interface Shailabh Nagar
2006-01-03 23:33 ` [Patch 6/6] Delay accounting: Connector interface Shailabh Nagar
2006-01-04  0:21   ` Greg KH
2006-01-04  0:42     ` Shailabh Nagar
2006-01-04  0:51       ` Greg KH
2006-01-04  7:49         ` [Lse-tech] " Shailabh Nagar
2006-01-04 19:04   ` Jay Lan
2006-01-04 21:31     ` Shailabh Nagar
2006-01-04 22:40     ` [ckrm-tech] " Matt Helsley
2006-01-04 23:17       ` Andrew Morton
2006-01-05 18:42         ` [PATCH 00/01] Move Exit Connectors Matt Helsley
2006-01-05 19:17           ` [PATCH 01/01][RFC] " Matt Helsley
2006-01-05 19:20           ` [PATCH 00/01] " Matt Helsley
2006-01-05 23:10             ` Andrew Morton
2006-01-06  0:06               ` [ckrm-tech] " Matt Helsley
2006-01-06  8:57                 ` [Lse-tech] " Jes Sorensen
2006-01-06 16:45                   ` Shailabh Nagar
2006-01-11 10:36                     ` Jes Sorensen
2006-01-11 12:56                       ` John Hesterberg
2006-01-11 13:50                         ` Jes Sorensen
2006-01-11 21:02                       ` Matt Helsley
2006-01-11 21:39                         ` John Hesterberg
2006-01-11 22:42                           ` Matt Helsley
2006-01-12 10:01                             ` Jes Sorensen
2006-01-12 23:20                               ` Matt Helsley
2006-01-13  9:35                                 ` Jes Sorensen
2006-01-14  7:23                                   ` Matt Helsley
2006-01-12  3:29                           ` Keith Owens
2006-01-12  5:04                             ` Paul E. McKenney [this message]
2006-01-12  5:38                               ` Keith Owens
2006-01-12  6:19                               ` Keith Owens
2006-01-12  6:51                                 ` Paul E. McKenney
2006-01-12  7:50                                   ` Keith Owens
2006-01-12 15:17                                     ` Paul E. McKenney
2006-01-17 17:26                                       ` Paul E. McKenney
2006-01-17 23:57                                         ` Keith Owens
2006-01-18  2:49                                           ` Paul E. McKenney
2006-01-18  2:55                                             ` Lee Revell
2006-01-18  6:29                                               ` Paul E. McKenney
2006-01-12  5:26                             ` Matt Helsley
2006-01-12  5:45                               ` Keith Owens
2006-01-12  9:51                         ` Jes Sorensen
2006-01-12 23:01                           ` Matt Helsley
2006-01-13  9:59                             ` Jes Sorensen
2006-01-13 10:38                             ` Jes Sorensen
2006-01-13 23:22                               ` Matt Helsley
2006-01-12 23:49                       ` Matt Helsley
2006-01-05  0:01       ` [ckrm-tech] Re: [Patch 6/6] Delay accounting: Connector interface Shailabh Nagar

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=20060112050453.GA23673@us.ibm.com \
    --to=paulmck@us.ibm.com \
    --cc=akpm@osdl.org \
    --cc=ckrm-tech@lists.sourceforge.net \
    --cc=elsa-devel@lists.sourceforge.net \
    --cc=erikj@sgi.com \
    --cc=jes@trained-monkey.org \
    --cc=jh@sgi.com \
    --cc=jlan@engr.sgi.com \
    --cc=kaos@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lse-tech@lists.sourceforge.net \
    --cc=matthltc@us.ibm.com \
    --cc=nagar@watson.ibm.com \
    --cc=pj@sgi.com \
    --cc=steiner@sgi.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.