mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ralph Campbell <ralphc@pathscale.com>
To: "Paul E. McKenney" <paulmck@us.ibm.com>
Cc: Roland Dreier <rolandd@cisco.com>,
	linux-kernel@vger.kernel.org, openib-general@openib.org
Subject: Re: [openib-general] Re: [PATCH 10/13]  [RFC] ipath verbs, part 1
Date: Mon, 19 Dec 2005 12:50:27 -0800	[thread overview]
Message-ID: <1135025427.6397.21.camel@brick.internal.keyresearch.com> (raw)
In-Reply-To: <20051218195922.GC31184@us.ibm.com>

The quick answer is the qp_list is traversed w/o the lock held in
ipath_ib_rcv().  The intent is to be able to do a lookup on the GID
to get a reference to the struct ipath_mcast and then walk the qp_list
w/o locks being held while processing the received packets at
interrupt level.


On Sun, 2005-12-18 at 11:59 -0800, Paul E. McKenney wrote:
> On Fri, Dec 16, 2005 at 03:48:55PM -0800, Roland Dreier wrote:
> > First half of ipath verbs driver
> 
> Some RCU-related questions interspersed.  Basic question is "where is
> the lock-free read-side traversal?"
> 
> 						Thanx, Paul
> 
> > ---
> > 
> >  drivers/infiniband/hw/ipath/ipath_verbs.c | 3244 +++++++++++++++++++++++++++++
> >  1 files changed, 3244 insertions(+), 0 deletions(-)
> >  create mode 100644 drivers/infiniband/hw/ipath/ipath_verbs.c
...
> > +/*
> > + * Insert the multicast GID into the table and
> > + * attach the QP structure.
> > + * Return zero if both were added.
> > + * Return EEXIST if the GID was already in the table but the QP was added.
> > + * Return ESRCH if the QP was already attached and neither structure was added.
> > + */
> > +static int ipath_mcast_add(struct ipath_mcast *mcast,
> > +			   struct ipath_mcast_qp *mqp)
> > +{
> > +	struct rb_node **n = &mcast_tree.rb_node;
> > +	struct rb_node *pn = NULL;
> > +	unsigned long flags;
> > +
> > +	spin_lock_irqsave(&mcast_lock, flags);
> > +
> > +	while (*n) {
> > +		struct ipath_mcast *tmcast;
> > +		struct ipath_mcast_qp *p;
> > +		int ret;
> > +
> > +		pn = *n;
> > +		tmcast = rb_entry(pn, struct ipath_mcast, rb_node);
> > +
> > +		ret = memcmp(mcast->mgid.raw, tmcast->mgid.raw,
> > +			     sizeof(union ib_gid));
> > +		if (ret < 0) {
> > +			n = &pn->rb_left;
> > +			continue;
> > +		}
> > +		if (ret > 0) {
> > +			n = &pn->rb_right;
> > +			continue;
> > +		}
> > +
> > +		/* Search the QP list to see if this is already there. */
> > +		list_for_each_entry_rcu(p, &tmcast->qp_list, list) {
> 
> Given that we hold the global mcast_lock, how is RCU helping here?

Its not really. I'm just trying to be consistent where ever the
qp_list is traversed.

> Is there a lock-free read-side traversal path somewhere that I am
> missing?

The lock free traversal is in ipath_ib_rcv() which is an interrupt
routine.

> > +			if (p->qp == mqp->qp) {
> > +				spin_unlock_irqrestore(&mcast_lock, flags);
> > +				return ESRCH;
> > +			}
> > +		}
> > +		list_add_tail_rcu(&mqp->list, &tmcast->qp_list);
> 
> Ditto...
> 
> > +		spin_unlock_irqrestore(&mcast_lock, flags);
> > +		return EEXIST;
> > +	}
> > +
> > +	list_add_tail_rcu(&mqp->list, &mcast->qp_list);
> 
> Ditto...
> 
> > +		spin_unlock_irqrestore(&mcast_lock, flags);
> > +
> > +	atomic_inc(&mcast->refcount);
> > +	rb_link_node(&mcast->rb_node, pn, n);
> > +	rb_insert_color(&mcast->rb_node, &mcast_tree);
> > +
> > +	spin_unlock_irqrestore(&mcast_lock, flags);
> > +
> > +	return 0;
> > +}

-- 
Ralph Campbell <ralphc@pathscale.com>


  parent reply	other threads:[~2005-12-19 20:50 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20051031150618.627779f1.akpm@osdl.org>
2005-12-16 23:48 ` [PATCH 00/13] [RFC] IB: PathScale InfiniPath driver Roland Dreier
2005-12-16 23:48   ` [PATCH 01/13] [RFC] ipath basic headers Roland Dreier
2005-12-16 23:48     ` [PATCH 02/13] [RFC] ipath debug header Roland Dreier
2005-12-16 23:48       ` [PATCH 03/13] [RFC] ipath copy routines Roland Dreier
2005-12-16 23:48         ` [PATCH 04/13] [RFC] ipath LLD core, part 1 Roland Dreier
2005-12-16 23:48           ` [PATCH 05/13] [RFC] ipath LLD core, part 2 Roland Dreier
2005-12-16 23:48             ` [PATCH 06/13] [RFC] ipath LLD core, part 3 Roland Dreier
2005-12-16 23:48               ` [PATCH 07/13] [RFC] ipath core misc files Roland Dreier
2005-12-16 23:48                 ` [PATCH 08/13] [RFC] ipath core last bit Roland Dreier
2005-12-16 23:48                   ` [PATCH 09/13] [RFC] ipath IB driver headers Roland Dreier
2005-12-16 23:48                     ` [PATCH 10/13] [RFC] ipath verbs, part 1 Roland Dreier
2005-12-16 23:48                       ` [PATCH 11/13] [RFC] ipath verbs, part 2 Roland Dreier
2005-12-16 23:48                         ` [PATCH 12/13] [RFC] ipath verbs MAD handling Roland Dreier
2005-12-16 23:48                           ` [PATCH 13/13] [RFC] ipath Kconfig and Makefile Roland Dreier
2005-12-17 21:52                             ` Adrian Bunk
2005-12-17 22:54                               ` [openib-general] " Robert Walsh
2005-12-17 23:55                                 ` Adrian Bunk
2005-12-18  1:17                                   ` Robert Walsh
2005-12-18  0:27                                 ` Alan Cox
2005-12-18 19:23                             ` Sam Ravnborg
2005-12-20  0:32                               ` [openib-general] " Robert Walsh
2005-12-26  2:49                               ` Roland Dreier
2005-12-18 19:59                       ` [PATCH 10/13] [RFC] ipath verbs, part 1 Paul E. McKenney
2005-12-18 20:05                         ` [openib-general] " Robert Walsh
2005-12-19 20:50                         ` Ralph Campbell [this message]
2005-12-17 20:38                   ` [PATCH 08/13] [RFC] ipath core last bit Andrew Morton
2005-12-21  0:00                     ` Robert Walsh
2005-12-17 20:38                 ` [PATCH 07/13] [RFC] ipath core misc files Andrew Morton
2005-12-17 21:29                   ` Robert Walsh
2005-12-17 21:33                   ` Robert Walsh
2005-12-18  3:10                     ` Andrew Morton
2005-12-18  3:13                       ` Robert Walsh
2005-12-17 20:38           ` [PATCH 04/13] [RFC] ipath LLD core, part 1 Andrew Morton
2005-12-17 21:34             ` Robert Walsh
2005-12-17 12:38         ` [PATCH 03/13] [RFC] ipath copy routines Pekka Enberg
2005-12-17 21:38           ` Robert Walsh
2005-12-17 13:16         ` Christoph Hellwig
2005-12-17 20:38         ` Andrew Morton
2005-12-17 22:40           ` Robert Walsh
2005-12-18  3:19             ` Andrew Morton
2005-12-18  3:35               ` Adrian Bunk
2005-12-18  5:33               ` Robert Walsh
2005-12-18  9:33               ` David S. Miller
2005-12-18 19:52                 ` Robert Walsh
2005-12-18  3:27             ` Andi Kleen
2005-12-18  5:36               ` Robert Walsh
2005-12-18  5:41                 ` Andi Kleen
2005-12-18 13:25               ` Alan Cox
2005-12-17 12:33     ` [PATCH 01/13] [RFC] ipath basic headers Pekka Enberg
2005-12-17 21:55       ` Robert Walsh
2005-12-17 13:14     ` Christoph Hellwig
2005-12-17 21:51       ` Eric W. Biederman
2005-12-18  3:25         ` Andi Kleen
2005-12-18 15:02           ` Eric W. Biederman
2005-12-17 22:19       ` Robert Walsh
2005-12-17 22:25         ` Arjan van de Ven
2005-12-17 22:47           ` Robert Walsh
2005-12-17 20:38     ` Andrew Morton
2005-12-17 22:39       ` Robert Walsh
2005-12-18  3:14         ` Andrew Morton
2005-12-20  1:43       ` Robert Walsh
2005-12-17 13:16   ` [PATCH 00/13] [RFC] IB: PathScale InfiniPath driver Christoph Hellwig
2005-12-17 15:51     ` Roland Dreier

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=1135025427.6397.21.camel@brick.internal.keyresearch.com \
    --to=ralphc@pathscale.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=openib-general@openib.org \
    --cc=paulmck@us.ibm.com \
    --cc=rolandd@cisco.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

Powered by JetHome