Date: Sun, 6 Apr 2014 21:39:19 GMT From: jilles@FreeBSD.org To: John.Giacomoni@LineRateSystems.com, jilles@FreeBSD.org, freebsd-bugs@FreeBSD.org, jilles@FreeBSD.org Subject: Re: kern/149591: [kernel] struct callout:c_flags should be volatile Message-ID: <201404062139.s36LdJ85090267@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201404062139.s36LdJ85090267>