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);