> -----Original Message----- > From: Jon Maloy [mailto:[email protected]] > Sent: Thursday, April 27, 2017 10:49 AM > To: Parthasarathy Bhuvaragan <[email protected]>; > [email protected]; Ying Xue <[email protected]> > Subject: Re: [tipc-discussion] [PATCH net v1 4/6] tipc: lock wakeup & inputq > at tipc_link_reset() > > > > > -----Original Message----- > > From: Parthasarathy Bhuvaragan > > Sent: Thursday, April 27, 2017 07:54 AM > > To: [email protected]; Jon Maloy > > <[email protected]>; Ying Xue <[email protected]> > > Subject: [PATCH net v1 4/6] tipc: lock wakeup & inputq at > > tipc_link_reset() > > > > Until now, in tipc_link_reset() we call copy the wakeup queue to input > > queue using skb_queue_splice_init(link->wakeupq, link->inputq). > > This is performed without holding any locks. This list might be > > simultaneously be accessed by other cpu threads in tipc_sk_rcv() and > > that leads to random missing packets. > > > > Signed-off-by: Parthasarathy Bhuvaragan > > <[email protected]> > > --- > > net/tipc/link.c | 7 ++++++- > > 1 file changed, 6 insertions(+), 1 deletion(-) > > > > diff --git a/net/tipc/link.c b/net/tipc/link.c index > > ddd2dd6f77aa..722b82a884dc 100644 > > --- a/net/tipc/link.c > > +++ b/net/tipc/link.c > > @@ -829,9 +829,14 @@ void tipc_link_reset(struct tipc_link *l) > > l->peer_session = ANY_SESSION; > > l->session++; > > l->mtu = l->advertised_mtu; > > + spin_lock_bh(&l->wakeupq.lock); > > + spin_lock_bh(&l->inputq->lock); > > + skb_queue_splice_init(&l->wakeupq, l->inputq); > > + spin_unlock_bh(&l->inputq->lock); > > + spin_unlock_bh(&l->wakeupq.lock); > > + > > I don't think you need to lock wakeupq here, since it is never touched > outside the link lock scope. > Actually, I don't see why this queue has a lock at all, it must be a missed > remnant from the previous implementation. > > ///jon
On a second thought, just leave it like this. We know that it works, and that is all that counts for now. We can remove the lock and its usage in a later patch to net-next. Acked-by: ///jon > > > __skb_queue_purge(&l->transmq); > > __skb_queue_purge(&l->deferdq); > > - skb_queue_splice_init(&l->wakeupq, l->inputq); > > __skb_queue_purge(&l->backlogq); > > l->backlog[TIPC_LOW_IMPORTANCE].len = 0; > > l->backlog[TIPC_MEDIUM_IMPORTANCE].len = 0; > > -- > > 2.1.4 > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most engaging > tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > tipc-discussion mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/tipc-discussion ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ tipc-discussion mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/tipc-discussion
