Received: by 10.192.165.148 with SMTP id m20csp2481943imm; Sun, 22 Apr 2018 07:58:53 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+flaKBOqF04WLmL0TZV2SmEepIFNGJ+MVoRbxCx0HjPnvfrBzHgLU9dA+j2qJt678S35jc X-Received: by 2002:a17:902:bc8b:: with SMTP id bb11-v6mr14081628plb.285.1524409133618; Sun, 22 Apr 2018 07:58:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524409133; cv=none; d=google.com; s=arc-20160816; b=eAr35MPlCpJEXGOdvd0yAMUIY2bFZ5Em33tcBVHhrlvzQTWmOZqIseYL5diSFAzwuj Yar7mO1iScjrUicRNpLP83RBM9+mSlwwbvh9E1lJBE+2FiUmfxmoL2TSIzMgHyklQZC+ 95eUugsMuWaVVox2JxezkOQE5K0qea5s9UY1hVjvfnBWG6CfKNHFHR9tBfkyWVN9ilKF qSjHMPlioUQU67Zmhv0HL61ApL3a+Rr5avpLRSIyJicRxwNeW1Co8Er6EYd0WgADC43r FSrVAio1XNF1bLPFBCNLgO7ykmttCBWbZEDJ7xrX4YkY+xuFYq3w7dE2U/oZBcHmZL/Z G+Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=IVSwu8RR8cWuefbsO5Ynb5b0uX5uxV4w2uDzW74ojhQ=; b=z3+un0lBPhpp2k2YH6//FixN6EdgfdpyxwTXKOv0+Wy0HTXUiLtKuwbisM+Qt5omq5 SA46KehDpq1t8b/4uV410gdZnzwz1ta0DOqWOz+zkhemvJ0RiqL0H8V0uClqgrvaTFDY Yx9rCfm2hcxG+xXdIhRTNjImWbxEFoYkSl0aggE5hKKwbPqFh5heLsPAPS9y1f8zmslw c36iMhLUN46j1CFt+d+iH8ZMgscfV0K0+sIxZbhUNbcAThQB2TVh8PNg4Ruc+POPFXZu mQxqtkcGMVf/1NG5qpkCchN9wDdnZCDOKoc2NoBMc2IbIVIyzD9UbAMQvp8LJSI60E0q aWXA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y11-v6si9212092pln.525.2018.04.22.07.58.39; Sun, 22 Apr 2018 07:58:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756912AbeDVO5e (ORCPT + 99 others); Sun, 22 Apr 2018 10:57:34 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:55806 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756605AbeDVONe (ORCPT ); Sun, 22 Apr 2018 10:13:34 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 43696CE3; Sun, 22 Apr 2018 14:13:33 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Piggin , Michael Ellerman Subject: [PATCH 4.9 27/95] powerpc/powernv: Fix OPAL NVRAM driver OPAL_BUSY loops Date: Sun, 22 Apr 2018 15:52:56 +0200 Message-Id: <20180422135211.547774444@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135210.432103639@linuxfoundation.org> References: <20180422135210.432103639@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nicholas Piggin commit 3b8070335f751aac9f1526ae2e012e6f5b8b0f21 upstream. The OPAL NVRAM driver does not sleep in case it gets OPAL_BUSY or OPAL_BUSY_EVENT from firmware, which causes large scheduling latencies, and various lockup errors to trigger (again, BMC reboot can cause it). Fix this by converting it to the standard form OPAL_BUSY loop that sleeps. Fixes: 628daa8d5abf ("powerpc/powernv: Add RTC and NVRAM support plus RTAS fallbacks") Depends-on: 34dd25de9fe3 ("powerpc/powernv: define a standard delay for OPAL_BUSY type retry loops") Cc: stable@vger.kernel.org # v3.2+ Signed-off-by: Nicholas Piggin Signed-off-by: Michael Ellerman Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/platforms/powernv/opal-nvram.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/arch/powerpc/platforms/powernv/opal-nvram.c +++ b/arch/powerpc/platforms/powernv/opal-nvram.c @@ -11,6 +11,7 @@ #define DEBUG +#include #include #include #include @@ -56,8 +57,12 @@ static ssize_t opal_nvram_write(char *bu while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) { rc = opal_write_nvram(__pa(buf), count, off); - if (rc == OPAL_BUSY_EVENT) + if (rc == OPAL_BUSY_EVENT) { + msleep(OPAL_BUSY_DELAY_MS); opal_poll_events(NULL); + } else if (rc == OPAL_BUSY) { + msleep(OPAL_BUSY_DELAY_MS); + } } if (rc)