Re: [PATCH next v3 2/2] printk: fix cpu lock ordering

From: Petr Mladek
Date: Wed Jun 16 2021 - 07:30:37 EST


On Tue 2021-06-15 19:55:47, John Ogness wrote:
> The cpu lock implementation uses a full memory barrier to take
> the lock, but no memory barriers when releasing the lock. This
> means that changes performed by a lock owner may not be seen by
> the next lock owner. This may have been "good enough" for use
> by dump_stack() as a serialization mechanism, but it is not
> enough to provide proper protection for a critical section.
>
> Correct this problem by using acquire/release memory barriers
> for lock/unlock, respectively.
>
> Note that it is not necessary for a cpu lock to disable
> interrupts. However, in upcoming work this cpu lock will be used
> for emergency tasks (for example, atomic consoles during kernel
> crashes) and any interruptions while holding the cpu lock should
> be avoided if possible.
>
> Signed-off-by: John Ogness <john.ogness@xxxxxxxxxxxxx>

The patch looks good to me, except for the problems already
reported for the 1st patch.

Best Regards,
Petr