Received: by 10.192.165.148 with SMTP id m20csp2472593imm; Sun, 22 Apr 2018 07:46:06 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/AVcY6VhVcfTJlFUBRFuui/JtrbzX1D0iweCkADYc4cTNk/ifrwhO/O0IQuVp3JUKG0EqB X-Received: by 10.98.201.137 with SMTP id l9mr16456882pfk.221.1524408366643; Sun, 22 Apr 2018 07:46:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524408366; cv=none; d=google.com; s=arc-20160816; b=upPJ6dFggTcFDkPCRLdEQDe4egqtVVRmihcDHE62rzLDtOerEe9U+EdbybDcj6xjmT QZCSPm/Rze2ZoFkp7DgbgXaYgWO0kE7ubzam6f45QyQd/4S0RcAS4ZQ/aYpNe3IXyvS9 tiKyTvEjfTdHk9CbYuc3GJBFu+z66Tj88IJ//h9rjVlS6EBUX8hdwd8NOAL+TCem0JI5 cRK8Z17fcXpTD+HEAV/VzJbjDjI2yJvLc7bdeKeP9Wfs59xD422Y99aIfbK57CzynorF rmkPeBxEECPdu+uOdsmHX7AyX4rbxHJsbJnW/i+a/4lkExC/XluaNvgiPbH5uNKN8EiS 0eTQ== 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=zxVu7yl/VhJrBcTPV3gq45LHgaON+UUXUZx4vgiiVoo=; b=txFRpSXzn3lYxxs9wmW9p9/ncqzF1G9YQF88eKqwHnMu98y6RKN23VAVW6Qv+pmwYl fb/1rs6j8ZrFoS8MOzUuB8Kov2PqWCg0WjBPtu50nXTA9k++irNMMpzrwZeTCwi1AH1p c/oeke1rdsgKRn8Tz1+ZKHGDbVa0bkRKjyKXGzWtXcgSdCKtv058Kg69fVqEjVT0I6ON 8I58PTvFxoivfPhoUz6kG7SeiiHIbx1p9dWbRZLI/D32+krZ+aSvL3WPjxIJzI/4oY8Q +Ij96jpmgBRMqt1Si2rMmdBL3L1iUUGdBV1j8men88k2Bm/5qiZ7rCLwUo3pOJPT5syM M3Iw== 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 p13-v6si10059269pll.416.2018.04.22.07.45.52; Sun, 22 Apr 2018 07:46:06 -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 S1757161AbeDVOok (ORCPT + 99 others); Sun, 22 Apr 2018 10:44:40 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:57866 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932160AbeDVOQ6 (ORCPT ); Sun, 22 Apr 2018 10:16:58 -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 C3A33BA0; Sun, 22 Apr 2018 14:16:57 +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.4 42/97] powerpc/powernv: Fix OPAL NVRAM driver OPAL_BUSY loops Date: Sun, 22 Apr 2018 15:53:20 +0200 Message-Id: <20180422135307.666419616@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135304.577223025@linuxfoundation.org> References: <20180422135304.577223025@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.4-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)