Thread (5 messages) 5 messages, 3 authors, 2021-06-21

Re: [PATCH net v2] net: sched: add barrier to ensure correct ordering for lockless qdisc

From: Jakub Kicinski <kuba@kernel.org>
Date: 2021-06-19 00:38:45
Also in: bpf, linux-can, lkml

On Fri, 18 Jun 2021 17:30:47 -0700 Jakub Kicinski wrote:
On Thu, 17 Jun 2021 09:04:14 +0800 Yunsheng Lin wrote:
quoted
The spin_trylock() was assumed to contain the implicit
barrier needed to ensure the correct ordering between
STATE_MISSED setting/clearing and STATE_MISSED checking
in commit a90c57f2cedd ("net: sched: fix packet stuck
problem for lockless qdisc").

But it turns out that spin_trylock() only has load-acquire
semantic, for strongly-ordered system(like x86), the compiler
barrier implicitly contained in spin_trylock() seems enough
to ensure the correct ordering. But for weakly-orderly system
(like arm64), the store-release semantic is needed to ensure
the correct ordering as clear_bit() and test_bit() is store
operation, see queued_spin_lock().

So add the explicit barrier to ensure the correct ordering
for the above case.

Fixes: a90c57f2cedd ("net: sched: fix packet stuck problem for lockless qdisc")
Signed-off-by: Yunsheng Lin <redacted>  
Acked-by: Jakub Kicinski <kuba@kernel.org>
Actually.. do we really need the _before_atomic() barrier?
I'd think we only need to make sure we re-check the lock 
after we set the bit, ordering of the first check doesn't 
matter.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help