Thread (26 messages) 26 messages, 5 authors, 2023-08-03

Re: Question about the barrier() in hlist_nulls_for_each_entry_rcu()

From: Eric Dumazet <edumazet@google.com>
Date: 2023-07-20 21:11:51
Also in: lkml, rcu

On Thu, Jul 20, 2023 at 10:00 PM Alan Huang [off-list ref] wrote:
quoted
2023年7月21日 03:22,Eric Dumazet [off-list ref] 写道:

On Thu, Jul 20, 2023 at 8:54 PM Alan Huang [off-list ref] wrote:
quoted
Hi,

I noticed a commit c87a124a5d5e(“net: force a reload of first item in hlist_nulls_for_each_entry_rcu”)
and a related discussion [1].

After reading the whole discussion, it seems like that ptr->field was cached by gcc even with the deprecated
ACCESS_ONCE(), so my question is:

       Is that a compiler bug? If so, has this bug been fixed today, ten years later?

       What about READ_ONCE(ptr->field)?
Make sure sparse is happy.
It caused a problem without barrier(), and the deprecated ACCESS_ONCE() didn’t help:

        https://lore.kernel.org/all/519D19DA.50400@yandex-team.ru/ (local)

So, my real question is: With READ_ONCE(ptr->field), are there still some unusual cases where gcc
decides not to reload ptr->field?
I can not really answer without seeing an actual patch...

Why are you asking ? Are you tracking compiler bug fixes ?
quoted
Do you have a patch for review ?
Possibly next month. :)
quoted
quoted

[1] https://lore.kernel.org/all/1369699930.3301.494.camel@edumazet-glaptop/ (local)

Thanks,
Alan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help