Received: by 10.192.165.148 with SMTP id m20csp2460200imm; Sun, 22 Apr 2018 07:30:21 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+ZQHrEpzC6VhCDSNSUSrm2PvIr7DT+UKmU0mO1cAL+WqH2pu0jFeHC1YbmWwe7BjbPsXLb X-Received: by 2002:a17:902:284b:: with SMTP id e69-v6mr17196461plb.240.1524407421325; Sun, 22 Apr 2018 07:30:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524407421; cv=none; d=google.com; s=arc-20160816; b=P448Euxj2+xYDdhMb/HzEgUqknAe+UbvOSo54hSHS0XLemaPoNhY77zXupayRmFBGL UzUbmhZMB2GtMFR748wTTh098Lswpuf9kE7xW9Y0+QJgI58CjaMeAiThblVZHI6VX+Wl g6T/uRq3YsBtc1W0uAsav9kQIOlt07QslAFzr0RPRsmkJmke9fQLETvvD8A2AlX9Bz1d drQw2f/yo2pFvOZ2o+bLcgsQHK/BSjR7f6Nw3bXwyqAf08/siCcgTGUA07uFPSL2q+xq mIhwm+E53jy9IpSz2AVzEvO10pltNz4S5bp+Q69UxALmmAyLmusL2Nh8ez0sczCpRHdz i6vQ== 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=7/u9HnoRRwqi8OcEFcY/YAa7gI54IQegSHIxXQs/y8s=; b=u5BAHJIzz5lsJMz54nuzR4AfD0ta4jhPZVlNiM6wXCbeI50+T6ijmKhNAh2V3mEmG0 u1zp2Ok0uRwzC07ErdCjpY0L5h+qa8URrOInyOFrbeWeFbBCTyI7J/SsdugfQkZy99yX RKODC1UlVUBlXv8lIK0NYCJRvZ1fQLWaMZnseYGsqGfD8yiXZs0fCoG8Jx8W7Z0kcg5+ 15eWnZbzsbxABdgfyLNW5el39O41Wi2zZxr1JahbZ/dybnQ6K7+Q5J5l5ympQwdHLAcx A+0ZY7xFz5ufhVYyU2jxNUIOCOMxyhm9ai03cK6wpwBkqIHN7NWC7Nxh/Mh2qetiSpBG dcKA== 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 59-v6si9959263plc.103.2018.04.22.07.29.43; Sun, 22 Apr 2018 07:30:21 -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 S932625AbeDVO1v (ORCPT + 99 others); Sun, 22 Apr 2018 10:27:51 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:32828 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756006AbeDVOVV (ORCPT ); Sun, 22 Apr 2018 10:21:21 -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 0BD8898C; Sun, 22 Apr 2018 14:21:19 +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 3.18 21/52] powerpc/powernv: Fix OPAL NVRAM driver OPAL_BUSY loops Date: Sun, 22 Apr 2018 15:53:54 +0200 Message-Id: <20180422135316.257965246@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135315.254787616@linuxfoundation.org> References: <20180422135315.254787616@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 3.18-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 @@ -55,8 +56,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)