From patchwork Thu Oct 12 14:01:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Blanchard X-Patchwork-Id: 825201 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yCrTB0KrCz9sNr for ; Fri, 13 Oct 2017 12:57:50 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="apehhAbQ"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3yCrT94RSFzDr9F for ; Fri, 13 Oct 2017 12:57:49 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="apehhAbQ"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [103.22.144.67]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3yCXbK2QvqzDr4T for ; Fri, 13 Oct 2017 01:02:05 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="apehhAbQ"; dkim-atps=neutral Received: by ozlabs.org (Postfix, from userid 1010) id 3yCXbK1NNGz9t2l; Fri, 13 Oct 2017 01:02:05 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1507816925; bh=I2j0h9QSOzhr1Bxb/VbW7tEUqXQ4AtEgCmPSNuIvids=; h=From:To:Cc:Subject:Date:From; b=apehhAbQ+2QkyTRAGll6/RWrglap1FwLN6iiY3b0zEgUuF+nPR0x8qSQ/77U7j3+d cJas3mUH+kF5og1/TDi2l36Mxsj5nGqvn/DkXJoV6+u/0KrnTzJPAgxZ3Fi+mOuZX+ b7o0CVgIsgvyKf5g/QTQvNPHA/oBzMqEFFjEE+gna9VK9vCaRz7i6/G/D/YNMtN+HP 5NDj9x6S4s5cVHMKVTsJxOsqUYL9QUIpAg6M19faKvd6uI3a1o4CzNuzOBz+TMgoTr rDPMHAhVuyERwQTGcj1mDiMIo43YoTdGDITeleF45CyKPDRaauho6R0viuwapsU+Ak w/BCA6vocTPPg== From: Anton Blanchard To: oohall@gmail.com, stewart@linux.vnet.ibm.com Date: Fri, 13 Oct 2017 01:01:59 +1100 Message-Id: <20171012140159.1808-1-anton@ozlabs.org> X-Mailer: git-send-email 2.11.0 X-Mailman-Approved-At: Fri, 13 Oct 2017 12:57:46 +1100 Subject: [Skiboot] [PATCH] hw/p8-i2c: Fix deadlock in p9_i2c_bus_owner_change X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: skiboot@lists.ozlabs.org MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" From: Anton Blanchard 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 --- 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;