netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Packet gets stuck in NOLOCK pfifo_fast qdisc
@ 2019-10-09  6:46 Jonas Bonn
  2019-10-09 19:14 ` Paolo Abeni
  0 siblings, 1 reply; 47+ messages in thread
From: Jonas Bonn @ 2019-10-09  6:46 UTC (permalink / raw)
  To: netdev, LKML, David S . Miller, pabeni

Hi,

The lockless pfifo_fast qdisc has an issue with packets getting stuck in 
the queue.  What appears to happen is:

i)  Thread 1 holds the 'seqlock' on the qdisc and dequeues packets.
ii)  Thread 1 dequeues the last packet in the queue.
iii)  Thread 1 iterates through the qdisc->dequeue function again and 
determines that the queue is empty.

iv)  Thread 2 queues up a packet.  Since 'seqlock' is busy, it just 
assumes the packet will be dequeued by whoever is holding the lock.

v)  Thread 1 releases 'seqlock'.

After v), nobody will check if there are packets in the queue until a 
new packet is enqueued.  Thereby, the packet enqueued by Thread 2 may be 
delayed indefinitely.

What, I think, should probably happen is that Thread 1 should check that 
the queue is empty again after releasing 'seqlock'.  I poked at this, 
but it wasn't obvious to me how to go about this given the way the 
layering works here.  Roughly:

qdisc_run_end() {
...
	spin_unlock(seqlock);
	if (!qdisc_is_empty(qdisc))
		qdisc_run();
...
}

Calling qdisc_run() from qdisc_run_end() doesn't feel right!

There's a qdisc->empty property (and qdisc_is_empty() relies on it) but 
it's not particularly useful in this case since there's a race in 
setting this property which makes it not quite reliable.

Hope someone can shine some light on how to proceed here.

/Jonas

^ permalink raw reply	[flat|nested] 47+ messages in thread

end of thread, other threads:[~2021-04-06 12:24 UTC | newest]

Thread overview: 47+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-09  6:46 Packet gets stuck in NOLOCK pfifo_fast qdisc Jonas Bonn
2019-10-09 19:14 ` Paolo Abeni
2019-10-10  6:27   ` Jonas Bonn
2019-10-11  0:39   ` Jonas Bonn
2020-06-23 13:42     ` Michael Zhivich
2020-06-30 19:14       ` Josh Hunt
2020-07-01  7:53         ` Jonas Bonn
2020-07-01 16:05         ` Cong Wang
2020-07-01 19:58           ` Cong Wang
2020-07-01 22:02             ` Josh Hunt
2020-07-02  6:14             ` Jonas Bonn
2020-07-02  9:45               ` Paolo Abeni
2020-07-02 18:08                 ` Josh Hunt
2020-07-07 14:18                   ` Paolo Abeni
2020-07-08 20:16                     ` Cong Wang
2020-07-09  9:20                       ` Paolo Abeni
2020-07-08 20:33                   ` Zhivich, Michael
2020-08-20  7:43                   ` Jike Song
2020-08-20 18:13                     ` Josh Hunt
     [not found]                     ` <20200822032800.16296-1-hdanton@sina.com>
2020-08-25  2:18                       ` Fengkehuan Feng
     [not found]                         ` <20200825032312.11776-1-hdanton@sina.com>
2020-08-25  7:14                           ` Fengkehuan Feng
     [not found]                             ` <20200825162329.11292-1-hdanton@sina.com>
2020-08-26  2:38                               ` Kehuan Feng
     [not found]                                 ` <CACS=qqKptAQQGiMoCs1Zgs9S4ZppHhasy1AK4df2NxnCDR+vCw@mail.gmail.com>
     [not found]                                   ` <5f46032e.1c69fb81.9880c.7a6cSMTPIN_ADDED_MISSING@mx.google.com>
2020-08-27  6:56                                     ` Kehuan Feng
     [not found]                                       ` <20200827125747.5816-1-hdanton@sina.com>
2020-08-28  1:45                                         ` Kehuan Feng
2020-09-03  5:01                                           ` Cong Wang
2020-09-03  8:39                                             ` Paolo Abeni
2020-09-03 17:43                                               ` Cong Wang
2020-09-04  5:07                                                 ` John Fastabend
2020-09-10 20:15                                                   ` Cong Wang
2020-09-10 21:07                                                     ` John Fastabend
2020-09-10 21:40                                                       ` Paolo Abeni
2021-04-02 19:25                                                   ` Jiri Kosina
2021-04-02 19:33                                                     ` Josh Hunt
     [not found]                                                     ` <20210403003537.2032-1-hdanton@sina.com>
2021-04-03 12:23                                                       ` Jiri Kosina
2021-04-06  0:55                                                         ` Yunsheng Lin
2021-04-06  7:06                                                           ` Michal Kubecek
2021-04-06 10:13                                                             ` Juergen Gross
2021-04-06 12:17                                                               ` Yunsheng Lin
2021-04-06  1:49                                                         ` Cong Wang
2021-04-06  2:46                                                           ` Yunsheng Lin
2021-04-06  7:31                                                             ` Michal Kubecek
2021-04-06 12:24                                                               ` Yunsheng Lin
     [not found]                                               ` <20200903101957.428-1-hdanton@sina.com>
2020-09-04  3:20                                                 ` Kehuan Feng
2020-09-10 20:19                                                   ` Cong Wang
2020-09-14  2:10                                                     ` Yunsheng Lin
2020-09-17 19:52                                                       ` Cong Wang
2020-09-18  2:06                                                         ` Kehuan Feng

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).