Re: [PATCH 2/2] udp: RCU handling for Unicast packets.

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Paul E. McKenney
Date: Thursday, October 30, 2008 - 11:25 am

On Thu, Oct 30, 2008 at 12:30:20PM +0100, Eric Dumazet wrote:

As you might guess, I do like that idea.  ;-)

On my plane trip, so am reviewing what I believe to be your current
combined patchset consisting of six patches transmitted in this thread:

Message-ID: <49081D67.3050502@cosmosbay.com>
Message-ID: <49082718.2030201@cosmosbay.com>
Message-ID: <490874F2.2060306@cosmosbay.com>
Message-ID: <4908DEDE.5030706@cosmosbay.com>
Message-ID: <49094B0F.2090208@cosmosbay.com>
Message-ID: <490838C6.4060304@cosmosbay.com>

This probably won't be your latest and greatest by the time you receive
this, but it appears to be the latest and greatest that I have.  ;-)

A few comments, search for blank lines.

							Thanx, Paul


It might be good to take a predicate macro/function instead of nullval,
in order to allow this primitive to be used for a number of different
pseudo-NULL-pointer schemes, and ditto for the similar macros you define
below.  Might be too early to know exactly how such a primitive should
look, though.

So just a random thought at this point.

In any case, this macro cannot be used in read-side critical sections.

Used by sk_for_each_nulls(), which is called by udp_lib_lport_inuse()
and udp_get_first().

udp_lib_lport_inuse() is called by udp_lib_get_port(), which holds the
hslot->lock, so should be OK.

In udp_get_first(), this same lock is held, so again should be OK.


This also must be called with the update-side lock held.  It is
wrappered by sk_for_each_from_nulls(), which in turn is called from
udp_v4_mcast_next() and udp_v6_mcast_next().  According to messages
earlier in this thread, that is the case.

udp_v4_mcast_next() is called from __udp4_lib_mcast_deliver(), which does
hold hslot->lock, so OK.  Ditto for the calls from udp_v6_mcast_next().

Interestingly enough, these two functions use sk_head(), which calls
__sk_head(), which do not do rcu_dereference().  Which is another reason
that this cannot be called from an RCU read-side critical section.


Looks good.  It should be possible to get rid of the "pos" argument in
the upcoming version, as all of the offsets should be even, so the
bottom bit would come through unchanged.  In fact, it should be possible
in this variant as well:

	((unsigned long)pos - offsetof(typeof(*tpos)) >= nullval)

Or am I missing something?


Won't your pseudo-NULL pointers mess up __hlist_del(), which is called
from hlist_del_init_rcu(), and which expects real NULL pointers?

Seems like you need _nulls variants of these list primitives as well.


Same here -- hlist_add_head_rcu() expects real NULL pointers.

Or are these different lists?  I believe that these are the same lists,
given that the ->sk_node field is used in both cases.

So I believe that you need parallel _nulls primitives for this one also.


inet_get_local_port_range() used to be under the write_lock_bh(),
and no longer is.  So, how do we now protect against concurrent port
range changes?


The above -really- confuses me, but not part of this patch.  If we are
out of range, keep going?  Well, I guess that since it is a short, we
cannot go very far...


And I don't understand how we are guaranteed to have scanned all the
possible ports upon failure, but happy to leave that to you guys.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 3/3] Convert the UDP hash lock to RCU, Corey Minyard, (Mon Oct 6, 11:50 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Eric Dumazet, (Mon Oct 6, 2:22 pm)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, David Miller, (Mon Oct 6, 2:40 pm)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Corey Minyard, (Mon Oct 6, 3:07 pm)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Corey Minyard, (Mon Oct 6, 4:08 pm)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Eric Dumazet, (Mon Oct 6, 10:24 pm)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Peter Zijlstra, (Tue Oct 7, 1:17 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Peter Zijlstra, (Tue Oct 7, 1:31 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Evgeniy Polyakov, (Tue Oct 7, 1:37 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Benny Amorsen, (Tue Oct 7, 1:54 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Eric Dumazet, (Tue Oct 7, 2:24 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Eric Dumazet, (Tue Oct 7, 5:59 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Stephen Hemminger, (Tue Oct 7, 7:07 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Christoph Lameter, (Tue Oct 7, 7:15 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Christoph Lameter, (Tue Oct 7, 7:16 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Evgeniy Polyakov, (Tue Oct 7, 7:29 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Paul E. McKenney, (Tue Oct 7, 7:33 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Paul E. McKenney, (Tue Oct 7, 7:36 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Paul E. McKenney, (Tue Oct 7, 7:38 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Christoph Lameter, (Tue Oct 7, 7:38 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Christoph Lameter, (Tue Oct 7, 7:45 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Eric Dumazet, (Tue Oct 7, 7:50 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Paul E. McKenney, (Tue Oct 7, 8:05 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Eric Dumazet, (Tue Oct 7, 8:07 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Paul E. McKenney, (Tue Oct 7, 8:07 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Peter Zijlstra, (Tue Oct 7, 8:09 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Christoph Lameter, (Tue Oct 7, 8:23 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Corey Minyard, (Tue Oct 7, 9:43 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, David Miller, (Tue Oct 7, 11:26 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, David Miller, (Tue Oct 7, 11:29 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, David Miller, (Tue Oct 7, 1:55 pm)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Stephen Hemminger, (Tue Oct 7, 2:20 pm)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Eric Dumazet, (Wed Oct 8, 1:35 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, Eric Dumazet, (Wed Oct 8, 6:55 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, David Miller, (Wed Oct 8, 9:38 am)
Re: [PATCH 3/3] Convert the UDP hash lock to RCU, David Miller, (Wed Oct 8, 11:45 am)
[PATCH 0/2] udp: Convert the UDP hash lock to RCU, Eric Dumazet, (Tue Oct 28, 1:37 pm)
[PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Tue Oct 28, 1:42 pm)
Re: [PATCH 0/2] udp: Convert the UDP hash lock to RCU, Stephen Hemminger, (Tue Oct 28, 2:28 pm)
Re: [PATCH 0/2] udp: Convert the UDP hash lock to RCU, Eric Dumazet, (Tue Oct 28, 2:50 pm)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Tue Oct 28, 3:45 pm)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., David Miller, (Tue Oct 28, 10:05 pm)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Wed Oct 29, 1:23 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., David Miller, (Wed Oct 29, 1:56 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Wed Oct 29, 2:04 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., David Miller, (Wed Oct 29, 2:17 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Wed Oct 29, 3:19 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Corey Minyard, (Wed Oct 29, 6:17 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Wed Oct 29, 7:36 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Corey Minyard, (Wed Oct 29, 8:34 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Wed Oct 29, 9:09 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Paul E. McKenney, (Wed Oct 29, 9:37 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Corey Minyard, (Wed Oct 29, 10:22 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Wed Oct 29, 10:32 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Wed Oct 29, 10:45 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Paul E. McKenney, (Wed Oct 29, 11:11 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., David Miller, (Wed Oct 29, 11:19 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., David Miller, (Wed Oct 29, 11:20 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Corey Minyard, (Wed Oct 29, 11:28 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., David Miller, (Wed Oct 29, 11:29 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Wed Oct 29, 11:36 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Paul E. McKenney, (Wed Oct 29, 11:38 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Paul E. McKenney, (Wed Oct 29, 11:52 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Wed Oct 29, 1:00 pm)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Paul E. McKenney, (Wed Oct 29, 1:17 pm)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Corey Minyard, (Wed Oct 29, 2:29 pm)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Wed Oct 29, 2:57 pm)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Paul E. McKenney, (Wed Oct 29, 2:58 pm)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Wed Oct 29, 3:08 pm)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Corey Minyard, (Wed Oct 29, 8:22 pm)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., David Miller, (Wed Oct 29, 10:40 pm)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Wed Oct 29, 10:50 pm)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Wed Oct 29, 10:51 pm)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Thu Oct 30, 12:04 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., David Miller, (Thu Oct 30, 12:05 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Peter Zijlstra, (Thu Oct 30, 4:04 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Peter Zijlstra, (Thu Oct 30, 4:12 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Thu Oct 30, 4:29 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Thu Oct 30, 4:30 am)
Re: [PATCH] udp: Introduce special NULL pointers for hlist ..., Stephen Hemminger, (Thu Oct 30, 8:51 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Paul E. McKenney, (Thu Oct 30, 11:25 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Eric Dumazet, (Fri Oct 31, 9:40 am)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., Paul E. McKenney, (Fri Oct 31, 8:10 pm)
Re: [PATCH 2/2] udp: RCU handling for Unicast packets., David Miller, (Sat Nov 1, 9:19 pm)
[PATCH 1/3] rcu: Introduce hlist_nulls variant of hlist, Eric Dumazet, (Thu Nov 13, 6:14 am)
[PATCH 2/3] udp: Use hlist_nulls in UDP RCU code, Eric Dumazet, (Thu Nov 13, 6:15 am)
[PATCH 4/3] rcu: documents rculist_nulls, Eric Dumazet, (Thu Nov 13, 9:02 am)
Re: [PATCH 4/3] rcu: documents rculist_nulls, Peter Zijlstra, (Fri Nov 14, 8:16 am)
Re: [PATCH 4/3] rcu: documents rculist_nulls, David Miller, (Sun Nov 16, 8:36 pm)
Re: [PATCH 1/3] rcu: Introduce hlist_nulls variant of hlist, Paul E. McKenney, (Wed Nov 19, 10:01 am)
Re: [PATCH 4/3] rcu: documents rculist_nulls, Paul E. McKenney, (Wed Nov 19, 10:07 am)
Re: [PATCH 2/3] udp: Use hlist_nulls in UDP RCU code, Paul E. McKenney, (Wed Nov 19, 10:29 am)
Re: [PATCH 2/3] udp: Use hlist_nulls in UDP RCU code, Eric Dumazet, (Wed Nov 19, 10:53 am)
Re: [PATCH 1/3] rcu: Introduce hlist_nulls variant of hlist, Paul E. McKenney, (Wed Nov 19, 11:46 am)
Re: [PATCH 1/3] rcu: Introduce hlist_nulls variant of hlist, Arnaldo Carvalho de Melo, (Wed Nov 19, 11:53 am)
Re: [PATCH 0/3] net: RCU lookups for UDP, DCCP and TCP pro ..., Christoph Lameter, (Wed Nov 19, 12:52 pm)
Re: [PATCH 1/3] rcu: Introduce hlist_nulls variant of hlist, Paul E. McKenney, (Wed Nov 19, 2:17 pm)
Re: [PATCH 1/3] rcu: Introduce hlist_nulls variant of hlist, Paul E. McKenney, (Wed Nov 19, 2:21 pm)
Re: [PATCH] net: Convert TCP/DCCP listening hash tables to ..., Paul E. McKenney, (Sun Nov 23, 12:17 pm)