[Skiboot] [PATCH] hw/p8-i2c: Fix deadlock in p9_i2c_bus_owner_change

Anton Blanchard anton at ozlabs.org
Fri Oct 13 01:01:59 AEDT 2017


From: Anton Blanchard <anton at samba.org>

When debugging a system where Linux was taking soft lockup errors, I
noticed two CPUs were stuck in OPAL:

CPU0
lock
p8_i2c_recover
opal_handle_interrupt

CPU1
sync_timer
cancel_timer
p9_i2c_bus_owner_change
occ_p9_interrupt
xive_source_interrupt
opal_handle_interrupt

p8_i2c_recover() is a timer, and is stuck trying to take master->lock.
p9_i2c_bus_owner_change() has taken master->lock, but then is stuck waiting
for all timers to complete. We deadlock.

Fix this by using cancel_timer_async(), as suggested by Oliver.

Fixes: 201fd50f208d ("hw/p8-i2c: Fix OCC locking")
Signed-off-by: Anton Blanchard <anton at samba.org>
---
 hw/p8-i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/p8-i2c.c b/hw/p8-i2c.c
index ffbace93..0defe7b2 100644
--- a/hw/p8-i2c.c
+++ b/hw/p8-i2c.c
@@ -1307,7 +1307,7 @@ void p9_i2c_bus_owner_change(u32 chip_id)
 			goto done;
 
 		/* clear the existing wait timer */
-		cancel_timer(&master->recovery);
+		cancel_timer_async(&master->recovery);
 
 		/* re-start the request now that we own the master */
 		master->state = state_idle;
-- 
2.11.0



More information about the Skiboot mailing list