Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3692146img; Mon, 25 Mar 2019 16:00:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqz6DTXk6jLkKetmUJIpO2P3rnlGaiGf43RTZVJsh0jzPNNdlDKkJ5f1+lfYCGOZJJ6btrg+ X-Received: by 2002:aa7:814e:: with SMTP id d14mr2821314pfn.101.1553554841461; Mon, 25 Mar 2019 16:00:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553554841; cv=none; d=google.com; s=arc-20160816; b=DN1lDIzzgh7WyiGw6uENreNRU/OG/phTK19+KxX3f0LlCbpIfTrlEosjKDCIGPkoDB TSLA04W9bp7MP/axMkHMxDEefVjuFa3h0HsJ0LaR90tJoA+eylHZgOdmmU7hHZ93QVU3 CPVAI0M80+49NoUWpT8bdyP0LnKKmBUUy+M5twoo8OqFW8xO3hW6UpcomLTdKi6Nt5In WyE5Y9wm4aB1J3Dd8bg4V9oHQkRDf3EdtoeignqeIeUiFWrthrp178wy7URigwEqVxBI CV/O1FBGkXfYMIGud8Xd3HZh8jDYS2Z60TZTJvSyKYvUvTIfljvOgfEu1OpHXxMHT83b +rXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=275GNRe5d1EE284hGwNUsl1iSzBIxWOd7YQzNYZoTs8=; b=uxwt5FqqK6E7QGLt6H7OM8q6Fnruxz4TBqi/lWnTDSYbOlJA+xkKiE2KGleIuRIvY1 BpYg488VL1n7nSBga27BKBQ3iEeqc/mOVGUqq3LZm8X7WWHuMv4+q/sHK1C3CaqtQM8S FVL67lp6GRmzGheTQcr9wtW6y+FExuQDWZvW1tlnJSQ4KUjtFy5O/qZDp7WFvTAMyJ3a FTts8gDxxSFmPozwvfqpNP3aQtPM0Y8L8ZV8jxco3QkMfGFWN5VW4CW8bo/ngW8mbXhM R+dCmELiA3CAMJVVBNJAePqmwwSokRN84kIJ1xup9WXU+3rfzjx3ihoqiYzBQr2ahU/v Trlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bJQf+Oup; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j35si15805636plb.61.2019.03.25.16.00.25; Mon, 25 Mar 2019 16:00:41 -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; dkim=pass header.i=@kernel.org header.s=default header.b=bJQf+Oup; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730609AbfCYW7o (ORCPT + 99 others); Mon, 25 Mar 2019 18:59:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:35242 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726010AbfCYW7n (ORCPT ); Mon, 25 Mar 2019 18:59:43 -0400 Received: from localhost (unknown [69.71.4.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6B90420828; Mon, 25 Mar 2019 22:59:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553554782; bh=654SGUtIm/tCjDGh60nT3GMT369dJ1alkPyEBzEb0Dw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bJQf+Oup8U0dZcjMBv1TVsRGdBFKlHROVO/ldpqcOH0jXytDlHf2nw8CnxN6/G+7H Kr+rjDDz9X5A64lTYOAQeGNAqUBwpnpokgJ30avf6rIsEanS6SHbUtaYh9ozL32+cL 9RYz3PVuov55LfHRIYMCt1c1eYFH38+mIcL6KvEs= Date: Mon, 25 Mar 2019 17:59:41 -0500 From: Bjorn Helgaas To: Alexandru Gagniuc Cc: austin_bolen@dell.com, alex_gagniuc@dellteam.com, keith.busch@intel.com, Shyam_Iyer@Dell.com, lukas@wunner.de, okaya@kernel.org, torvalds@linux-foundation.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Borislav Petkov Subject: Re: [PATCH v2] PCI/LINK: bw_notification: Do not leave interrupt handler NULL Message-ID: <20190325225941.GE24180@google.com> References: <20190320193504.GC251185@google.com> <20190323003700.7294-1-mr.nuke.me@gmail.com> <20190325222502.GC24180@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190325222502.GC24180@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [+cc Borislav] Hi Borislav, sorry; I meant to cc: you when I applied the patch below. I did add a Reported-by for you. On Mon, Mar 25, 2019 at 05:25:02PM -0500, Bjorn Helgaas wrote: > On Fri, Mar 22, 2019 at 07:36:51PM -0500, Alexandru Gagniuc wrote: > > A threaded IRQ with a NULL handler does not work with level-triggered > > interrupts. request_threaded_irq() will return an error: > > > > genirq: Threaded irq requested with handler=NULL and !ONESHOT for irq 16 > > pcie_bw_notification: probe of 0000:00:1b.0:pcie010 failed with error -22 > > > > For level interrupts we need to silence the interrupt before exiting > > the IRQ handler, so just clear the PCI_EXP_LNKSTA_LBMS bit there. > > > > Fixes: e8303bb7a75c ("PCI/LINK: Report degraded links via link bandwidth notification") > > Reported-by: Linus Torvalds > > Signed-off-by: Alexandru Gagniuc > > Applied with the following subject line to for-linus for v5.1, thanks! > > PCI/LINK: Supply IRQ handler so level-triggered IRQs are acked > > > --- > > Changes since v1: > > - move pcie_update_link_speed() to irq to prevent duplicate read of link_status > > - Add Fixes: to commit message > > > > drivers/pci/pcie/bw_notification.c | 19 ++++++++++++++----- > > 1 file changed, 14 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/pci/pcie/bw_notification.c b/drivers/pci/pcie/bw_notification.c > > index d2eae3b7cc0f..c48746f1cf3c 100644 > > --- a/drivers/pci/pcie/bw_notification.c > > +++ b/drivers/pci/pcie/bw_notification.c > > @@ -44,11 +44,10 @@ static void pcie_disable_link_bandwidth_notification(struct pci_dev *dev) > > pcie_capability_write_word(dev, PCI_EXP_LNKCTL, lnk_ctl); > > } > > > > -static irqreturn_t pcie_bw_notification_handler(int irq, void *context) > > +static irqreturn_t pcie_bw_notification_irq(int irq, void *context) > > { > > struct pcie_device *srv = context; > > struct pci_dev *port = srv->port; > > - struct pci_dev *dev; > > u16 link_status, events; > > int ret; > > > > @@ -58,6 +57,17 @@ static irqreturn_t pcie_bw_notification_handler(int irq, void *context) > > if (ret != PCIBIOS_SUCCESSFUL || !events) > > return IRQ_NONE; > > > > + pcie_capability_write_word(port, PCI_EXP_LNKSTA, events); > > + pcie_update_link_speed(port->subordinate, link_status); > > + return IRQ_WAKE_THREAD; > > +} > > + > > +static irqreturn_t pcie_bw_notification_handler(int irq, void *context) > > +{ > > + struct pcie_device *srv = context; > > + struct pci_dev *port = srv->port; > > + struct pci_dev *dev; > > + > > /* > > * Print status from downstream devices, not this root port or > > * downstream switch port. > > @@ -67,8 +77,6 @@ static irqreturn_t pcie_bw_notification_handler(int irq, void *context) > > __pcie_print_link_status(dev, false); > > up_read(&pci_bus_sem); > > > > - pcie_update_link_speed(port->subordinate, link_status); > > - pcie_capability_write_word(port, PCI_EXP_LNKSTA, events); > > return IRQ_HANDLED; > > } > > > > @@ -80,7 +88,8 @@ static int pcie_bandwidth_notification_probe(struct pcie_device *srv) > > if (!pcie_link_bandwidth_notification_supported(srv->port)) > > return -ENODEV; > > > > - ret = request_threaded_irq(srv->irq, NULL, pcie_bw_notification_handler, > > + ret = request_threaded_irq(srv->irq, pcie_bw_notification_irq, > > + pcie_bw_notification_handler, > > IRQF_SHARED, "PCIe BW notif", srv); > > if (ret) > > return ret; > > -- > > 2.19.2 > >