On 1/18/2018 10:53 AM, Byungchul Park wrote:
Hello,
This is a thing simulating a wait for an event e.g.
wait_for_completion() doing spinning instead of sleep, rather
than a spinlock. I mean:
This context
------------
while (READ_ONCE(console_waiter)) /* Wait for the event */
cpu_relax();
Another context
---------------
WRITE_ONCE(console_waiter, false); /* Event */
That's why I said this's the exact case of cross-release. Anyway
without cross-release, we usually use typical acquire/release
pairs to cover a wait for an event in the following way:
A context
---------
lock_map_acquire(wait); /* Or lock_map_acquire_read(wait) */
/* Read one is better though.. */
/* A section, we suspect, a wait for an event might happen. */
...
lock_map_release(wait);
The place actually doing the wait
---------------------------------
lock_map_acquire(wait);
lock_map_acquire(wait);
^
lock_map_release(wait);
--
Thanks,
Byungchul