kern/149591: [kernel] struct callout:c_flags should be volatile

jilles at FreeBSD.org jilles at FreeBSD.org
Sun Apr 6 21:39:20 UTC 2014


Synopsis: [kernel] struct callout:c_flags should be volatile

State-Changed-From-To: open->closed
State-Changed-By: jilles
State-Changed-When: Sun Apr 6 21:34:16 UTC 2014
State-Changed-Why: 
Hi,

Thanks for your request. I think the volatile qualifier should
not be added.

callout_active() should only be called when the callout's lock
(Giant, given mutex or given rwlock) is held. The lock/unlock
operations will force the compiler and CPU to fetch a new value.

The volatile qualifier is not designed to protect against other
threads, even though it might appear to help with that.

In your example, note that DELAY is a busy-wait loop; it is
sometimes useful to wait for hardware, but not to wait for
software events.


Responsible-Changed-From-To: freebsd-bugs->jilles
Responsible-Changed-By: jilles
Responsible-Changed-When: Sun Apr 6 21:34:16 UTC 2014
Responsible-Changed-Why: 
Track replies.

http://www.freebsd.org/cgi/query-pr.cgi?pr=149591


More information about the freebsd-bugs mailing list