Received: by 10.192.165.148 with SMTP id m20csp2538522imm; Sun, 22 Apr 2018 09:07:19 -0700 (PDT) X-Google-Smtp-Source: AIpwx482wk2LnT1cSHHGuQJBZZnLBahNIPJDT+KprqeJLNZk+EH3kBJoTarSyH8SqDenL16Wlrff X-Received: by 2002:a17:902:5992:: with SMTP id p18-v6mr18305187pli.49.1524413239547; Sun, 22 Apr 2018 09:07:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524413239; cv=none; d=google.com; s=arc-20160816; b=tgHTAiSOi8HnSweHhmyjYTHE+aIM9As3al9qn4DTmPQchW2rzhN2x+g4kljDySEJj3 dCpVkotgBkx0zlww+yYN99TxKJAjdhThM6Opw6XX2gG5mskSSOW6ws8Tbd3BQo21/yj+ CGBnralAC9FxLUgfUOSimsGn32J6FVwXVo1ck8H/fZx+p5at0Vf65qLxVPFRAS0qmEbs /qOBlObZtpNswSZa5pxQnaVsauGPjPdRw27E8nU46YrzYaVRe45+WuUbHKfknbropINf kJ6pT1aNFhgU1VfZQL2f9+/209XHujxTuCLsxM7BizTQ3WvauYhjuZ30gVcfXZ50mhVj oR0g== 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=XVP1F8m8Ni009f84k6cnUCYAq1kOZCr2fWoSiPsONTk=; b=f/MVhdoXb2wPcpPe1g38iwR4kLjoZqsjFY9y1ziWiP//mjPcbKV1hPM/Ls3GRo62xa 1Rsg7ClQZdugsttDRC84S1IrV1aW3wvZxXfBtuyc6tQsdKt+Q0MmgXY08YsnQAxOOywx iszzp1JiId27k9fXOV5BPDdqvVnGhwq7KBMeB0hHmM4otdbUuRlQCj4EGGtWrv+/bNbs Fy+mXPs0crpxGPtBkBwYZgUJbhQjvDfYBAMlt5Bm4MXSuST4aSCiCcCsJtj0HLgc1rkT 6L2Xk51ICy7sCZnN92Lynuvu+6kue1I7GxHvd6eZKTifGJl8C3w26DSGHfTbnr0chjjJ IvKg== 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 i127si8522617pgc.568.2018.04.22.09.07.05; Sun, 22 Apr 2018 09:07:19 -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 S1754036AbeDVQFu (ORCPT + 99 others); Sun, 22 Apr 2018 12:05:50 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45670 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753956AbeDVN5U (ORCPT ); Sun, 22 Apr 2018 09:57:20 -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 E7895727; Sun, 22 Apr 2018 13:57: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 4.16 067/196] powerpc/powernv: Fix OPAL NVRAM driver OPAL_BUSY loops Date: Sun, 22 Apr 2018 15:51:27 +0200 Message-Id: <20180422135107.722037428@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135104.278511750@linuxfoundation.org> References: <20180422135104.278511750@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.16-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)