Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp1162558img; Fri, 22 Mar 2019 17:38:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqxFXmcEFM0P0DCr9YLYq39r1HXtZIL/njThvHhg/Y1NOGcINrMfK5rtt4HFciiXAMykx/fR X-Received: by 2002:a63:c242:: with SMTP id l2mr11740419pgg.138.1553301492507; Fri, 22 Mar 2019 17:38:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553301492; cv=none; d=google.com; s=arc-20160816; b=1D5Otv+D2f6ZB/flK5c9GcUx7s/FdZ7x+v80w+oT1+L5haTyG29Tdg6TgyVfaVEgTz ZoylOCN6nDOIIJ9D6ssWJJmrf9lMb+q0UG1/O8tNMUSY0eCYNNdMOzVxiYmXRF75HZSq A1it6NHQ6tdIxAYUj9JYiH3PK1uNQ4Qr4gH4++GuOS+6njRASIyOjvmIHEV8Tez9Ujj3 OCuNSTE6XF0TKGCCNCGKR7OdwUOE6D6uqaJdVkgK3ofEv3rJ1jsWphrIjvqRVgfq4lU2 JC5MEH1ZYtKg4mhEC1mMWX/VwBxZKbrffkDqg7iAmRk+K/46JwvJ9K1+Sx2mGVMrJfzy xdGw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FvQj0vsvYv72yAE8YRembqlumXrTGOSTi8Eky6kwc24=; b=0f+d2eYiRb9ARIxcMsuiFnRlrMByMygdB2tljJkdvOjrNmTgvA8mK7UOL5Q9fm9xJG eZzq1W8OwZzDgTpGlzBpq++o7CtON2IqXrCg6c8UO2hK49BqYbE5NmGNOKlJHCsTR2Up WYteGCRiBxYwRf92DeNv99jkN5bEP35yaWerKOjXYmRX/mbab8ehhpi0aRZGk2fqxtHc oc8899+R3vQRonZSaJLbrV7JeERIFCsSdIAOoYp+9B1F8JQns+IuY0QNdWQRRCmDbhXR 1q31OqyyWKdbTKOVNgF72ApELLUwHKeGyNiGpNq7/I+3fGWerOL3tmg3j5A/rLT9zpzl JTXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qlvS4Wjo; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o7si7864709pgh.273.2019.03.22.17.37.55; Fri, 22 Mar 2019 17:38:12 -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=@gmail.com header.s=20161025 header.b=qlvS4Wjo; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727530AbfCWAhR (ORCPT + 99 others); Fri, 22 Mar 2019 20:37:17 -0400 Received: from mail-oi1-f193.google.com ([209.85.167.193]:40462 "EHLO mail-oi1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726589AbfCWAhQ (ORCPT ); Fri, 22 Mar 2019 20:37:16 -0400 Received: by mail-oi1-f193.google.com with SMTP id 3so3068682oir.7; Fri, 22 Mar 2019 17:37:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FvQj0vsvYv72yAE8YRembqlumXrTGOSTi8Eky6kwc24=; b=qlvS4WjoyGmFNYsaYlyG5aLMzu+InSqSMFo0ItRT329JuXGg6+Vv6N4em11FHlsQLi mB36w46yuy96UCLUzH1oYtAQdtG3QoPU3XvrHBwDNG97nwmkKJTNvinjfBeUpiydH7cS qWQ/FkP+QA9IPjGfZqtnEQwlTfOIhpuTG8QvIxKpfIxD/exathRa0+oo5k6Jvf59+tSX K7g4fYDH2ztu0yfHbclxXbk6YEWIC8u7Sp0T07CrAoEbqqHC0HhOtOxGECLImZrlyj8r ERKofMptfeXaTAq/wH7f3oW/jFvJB22usE4wVG/LYAj9z670RWhcwxa1WiIEePHj7L9e MUTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FvQj0vsvYv72yAE8YRembqlumXrTGOSTi8Eky6kwc24=; b=IqLWPOHeiFv8+5/VfoeCdga2D9j0YqN++TUW7AHJQyagv/gAlnQeTGOeN1uioxZfla JsiYcLDeRNRj/NQ+QUIgQKxFtQw54rjWF2WhEboZZ/q75ss2h6ftENJGJcdWI4wOh5qR HcoLZU09IzcJQDetK/4JeAm3XtxmkBgIoKsnoBJmgDm/7VSx+dv16TGUQXv4dZ1UA3md 5+8ltEYWRyY2UL7V/yyfAtAYEnMQJs1qjpmbPJR9x5sL9Y+u4ro9uc7iZ2/ZK3Ylz83c Kpf0KhvOL2mWXOTayMiBwYjqBDRSHsGEPLgVoPuUBDTO0VcYKL6/tpWn0JWB37RNldj8 c67Q== X-Gm-Message-State: APjAAAV82OcVQBGw7SlVFCFgdFYx9AzWRXn7GDrSqqNH6nUGe5WfnLVK 4JYDztr/4AoGeoveuVsT8nE= X-Received: by 2002:aca:35c5:: with SMTP id c188mr104220oia.18.1553301435777; Fri, 22 Mar 2019 17:37:15 -0700 (PDT) Received: from nuclearis2-1.lan (c-98-195-139-126.hsd1.tx.comcast.net. [98.195.139.126]) by smtp.gmail.com with ESMTPSA id 96sm472584otf.17.2019.03.22.17.37.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Mar 2019 17:37:15 -0700 (PDT) From: Alexandru Gagniuc To: bhelgaas@google.com 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, Alexandru Gagniuc , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] PCI/LINK: bw_notification: Do not leave interrupt handler NULL Date: Fri, 22 Mar 2019 19:36:51 -0500 Message-Id: <20190323003700.7294-1-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20190320193504.GC251185@google.com> References: <20190320193504.GC251185@google.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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