Received: by 10.213.65.68 with SMTP id h4csp699565imn; Fri, 6 Apr 2018 07:29:33 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/HPcKZuSy/iMyvgaOxQMcooNWzeWUCIZqGqvEHvglwHd7be8kFlLXysdoZ+M9E8UjAaL8k X-Received: by 10.99.3.216 with SMTP id 207mr17984016pgd.163.1523024973887; Fri, 06 Apr 2018 07:29:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523024973; cv=none; d=google.com; s=arc-20160816; b=G08/T11+6GsP0HUXpKj8j7+d2/EeJ6qexYVP4xQbtgOaKE4qff8Fqt3uIBWmpnZ97Y RPy4OgOD9/LdRJnQfmCavDFRMd2GNMeDV335cvDiHrIKuhbrWvFjwp2LD+w92KT3ZTWq 8lYVM2DzFambSfBH2pdci64IajM0vwl7JmDxAeVq9mUszYcK1A3mq2RlNnnOYqJvKdGi khjGceJ2mqNw3cHvQVcF+cfHkW5D9Wbq7gCqvkKiwPYa3TOI+hjhognhTlxdaTawMcfD 7IQ2vYbyrrao3Fh0CR6hPmXEg2bMXpilbA7mi77AHfOAvD7L2CuS7uU2uryyDoL9gNx5 WucA== 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=9H9t5L3ri4/7gAEyVpyz01qYJc3r25dI0Sd1bKCM0cs=; b=b92lMOsqq2HTidTUuVZvwxGYwZvcfey6bQta58uvSQOMD5HdXfGCpnmb4fjEMzbK51 h8d3fCispmzWdMysg2b13z7ftLvQodRJZVyDKtLOoigbJ5JY8rsjm1zi0sxv4abzK66i TDvX3+7cEMz38upUjvSWJmmQWijaKkIIKP2Y7rB01UAbTMjkUySmr7e1r+HjLXUErLET 82Dl1fL6t6mYow5E2y6pPY8k2VO3RB2Tp1B2qJjQUF9jRrC1SGcpGv495L/I4yN6amF4 mIKBYkIfyV4l7igce4MDj9of76206ymxJ1KkfG90SynZ8mfS0y3I1LQx2YDB52qHIkhY u/JA== 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 g5si1396635pgr.411.2018.04.06.07.29.05; Fri, 06 Apr 2018 07:29:33 -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 S1756732AbeDFOZc (ORCPT + 99 others); Fri, 6 Apr 2018 10:25:32 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33142 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932304AbeDFNho (ORCPT ); Fri, 6 Apr 2018 09:37:44 -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 4A26CD1F; Fri, 6 Apr 2018 13:37:42 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Carol L. Soto" , Nicholas Piggin , Michael Ellerman Subject: [PATCH 4.14 15/67] powerpc/64s: Fix lost pending interrupt due to race causing lost update to irq_happened Date: Fri, 6 Apr 2018 15:23:45 +0200 Message-Id: <20180406084343.313423886@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180406084341.225558262@linuxfoundation.org> References: <20180406084341.225558262@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.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nicholas Piggin commit ff6781fd1bb404d8a551c02c35c70cec1da17ff1 upstream. force_external_irq_replay() can be called in the do_IRQ path with interrupts hard enabled and soft disabled if may_hard_irq_enable() set MSR[EE]=1. It updates local_paca->irq_happened with a load, modify, store sequence. If a maskable interrupt hits during this sequence, it will go to the masked handler to be marked pending in irq_happened. This update will be lost when the interrupt returns and the store instruction executes. This can result in unpredictable latencies, timeouts, lockups, etc. Fix this by ensuring hard interrupts are disabled before modifying irq_happened. This could cause any maskable asynchronous interrupt to get lost, but it was noticed on P9 SMP system doing RDMA NVMe target over 100GbE, so very high external interrupt rate and high IPI rate. The hang was bisected down to enabling doorbell interrupts for IPIs. These provided an interrupt type that could run at high rates in the do_IRQ path, stressing the race. Fixes: 1d607bb3bd60 ("powerpc/irq: Add mechanism to force a replay of interrupts") Cc: stable@vger.kernel.org # v4.8+ Reported-by: Carol L. Soto Signed-off-by: Nicholas Piggin Signed-off-by: Michael Ellerman Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/kernel/irq.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c @@ -430,6 +430,14 @@ void force_external_irq_replay(void) */ WARN_ON(!arch_irqs_disabled()); + /* + * Interrupts must always be hard disabled before irq_happened is + * modified (to prevent lost update in case of interrupt between + * load and store). + */ + __hard_irq_disable(); + local_paca->irq_happened |= PACA_IRQ_HARD_DIS; + /* Indicate in the PACA that we have an interrupt to replay */ local_paca->irq_happened |= PACA_IRQ_EE; }