Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4535699imm; Mon, 17 Sep 2018 16:03:42 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbXpjW9pn+TAGy4Ke8BanY8mUmHleyEL6c93tyuXdx3nXVmfs8jSwDc/P5FzifcsltE2R6z X-Received: by 2002:a17:902:7e45:: with SMTP id a5-v6mr26929602pln.151.1537225422146; Mon, 17 Sep 2018 16:03:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537225422; cv=none; d=google.com; s=arc-20160816; b=ZnjKSs2YczQLiUr5Zaq9kkk7klVLlutnbymnIc3JCUs2+EGT32on+JB5XcyyuUS+DJ N2iqHCNWk9r2omNX/rXf5mFeZVWTQxo5eR+9zHyPDu8oht2aTP/BUGL2LvS7Q+pz8ujJ bfoc246ZueoHj0LwAGJzkmSz6vQbqG2LyqSrRQ3CLd1Kj2EIgGvLAel1037Y5dSlHRTL u7iLhfK5XWOTjjmsWXekG/z8y6mOT+dbNztBKlwJu9ubLtS4Zaxd5G+4C44ZSWFY4yIS owrLPFV5wYmfT9aTaXBEiwJlOnDtkiToqECU+OE4baEJywcYVa0rI9UxDJPSfiNavCjT yAwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=GJNVN7vjP7XzkIBkfcrFxTYnS4jtxdS/CewUhyElPJw=; b=gAc+zj8B0pvc7hICb/Oda0NqOIWgbk4YE/8EKuyqA0AywV7xEWyvVKsacGEM/ZlmOW M7FR2g2Cclc+ATWCEY8Hxo+Z6XxNVrojIvMWVur/Pny+CO2hX26kvC+sFY3a5lXzHRqe Qokh2Stbr8uEva6bssVCo1VWMOhK61Mm/AzWSivtX/EJncrklZ2CTm4ISwieMGTorJ1R B6iwP1AHdybJypwEsQO8kyU2BUrh33SGNh69GTlJgFnbESLwJUuntmZNGCqxrFxZirtl o68qnHpPtsOZMzFSC1zGo1HMqU98rbyMTmOlhbHpw2WsIczlgtiQGnhIhtOiaZT00eNs BLxw== 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 d39-v6si17148874pla.41.2018.09.17.16.03.27; Mon, 17 Sep 2018 16:03:42 -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 S1730553AbeIREci (ORCPT + 99 others); Tue, 18 Sep 2018 00:32:38 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48730 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726987AbeIREch (ORCPT ); Tue, 18 Sep 2018 00:32:37 -0400 Received: from localhost (li1825-44.members.linode.com [172.104.248.44]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id BE3A5C7D; Mon, 17 Sep 2018 23:03:08 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Kurtz , Thomas Gleixner , Linus Walleij , Sasha Levin Subject: [PATCH 4.14 066/126] pinctrl/amd: only handle irq if it is pending and unmasked Date: Tue, 18 Sep 2018 00:41:54 +0200 Message-Id: <20180917211708.667620480@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180917211703.481236999@linuxfoundation.org> References: <20180917211703.481236999@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: Daniel Kurtz [ Upstream commit 8bbed1eef001fdfc0ee9595f64cc4f769d265af4 ] The AMD pinctrl driver demultiplexes GPIO interrupts and fires off their individual handlers. If one of these GPIO irqs is configured as a level interrupt, and its downstream handler is a threaded ONESHOT interrupt, the GPIO interrupt source is masked by handle_level_irq() until the eventual return of the threaded irq handler. During this time the level GPIO interrupt status will still report as high until the actual gpio source is cleared - both in the individual GPIO interrupt status bit (INTERRUPT_STS_OFF) and in its corresponding "WAKE_INT_STATUS_REG" bit. Thus, if another GPIO interrupt occurs during this time, amd_gpio_irq_handler() will see that the (masked-and-not-yet-cleared) level irq is still pending and incorrectly call its handler again. To fix this, have amd_gpio_irq_handler() check for both interrupts status and mask before calling generic_handle_irq(). Note: Is it possible that this bug was the source of the interrupt storm on Ryzen when using chained interrupts before commit ba714a9c1dea85 ("pinctrl/amd: Use regular interrupt instead of chained")? Signed-off-by: Daniel Kurtz Acked-by: Thomas Gleixner Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/pinctrl/pinctrl-amd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/pinctrl/pinctrl-amd.c +++ b/drivers/pinctrl/pinctrl-amd.c @@ -530,7 +530,8 @@ static irqreturn_t amd_gpio_irq_handler( /* Each status bit covers four pins */ for (i = 0; i < 4; i++) { regval = readl(regs + i); - if (!(regval & PIN_IRQ_PENDING)) + if (!(regval & PIN_IRQ_PENDING) || + !(regval & BIT(INTERRUPT_MASK_OFF))) continue; irq = irq_find_mapping(gc->irqdomain, irqnr + i); generic_handle_irq(irq);