]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/xmon: Don't loop forever in get_output_lock()
authorMichael Ellerman <michael@ellerman.id.au>
Mon, 23 Dec 2013 12:46:04 +0000 (23:46 +1100)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Tue, 11 Feb 2014 00:24:50 +0000 (11:24 +1100)
commit336aea39b9453ae44a93e6b9a76cbba5861ba2a8
treeb66d851be73038d03b3322442f720d04138ff97b
parent3fec543de54ae7697b5ca527a0a59a1914bc39aa
powerpc/xmon: Don't loop forever in get_output_lock()

If we enter with xmon_speaker != 0 we skip the first cmpxchg(), we also
skip the while loop because xmon_speaker != last_speaker (0) - meaning we
skip the second cmpxchg() also.

Following that code path the compiler sees no memory barriers and so is
within its rights to never reload xmon_speaker. The end result is we loop
forever.

This manifests as all cpus being in xmon ('c' command), but they refuse
to take control when you switch to them ('c x' for cpu # x).

I have seen this deadlock in practice and also checked the generated code to
confirm this is what's happening.

The simplest fix is just to always try the cmpxchg().

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/xmon/xmon.c