lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190325225941.GE24180@google.com>
Date:   Mon, 25 Mar 2019 17:59:41 -0500
From:   Bjorn Helgaas <helgaas@...nel.org>
To:     Alexandru Gagniuc <mr.nuke.me@...il.com>
Cc:     austin_bolen@...l.com, alex_gagniuc@...lteam.com,
        keith.busch@...el.com, Shyam_Iyer@...l.com, lukas@...ner.de,
        okaya@...nel.org, torvalds@...ux-foundation.org,
        linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
        Borislav Petkov <bp@...e.de>
Subject: Re: [PATCH v2] PCI/LINK: bw_notification: Do not leave interrupt
 handler NULL

[+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 <torvalds@...ux-foundation.org>
> > Signed-off-by: Alexandru Gagniuc <mr.nuke.me@...il.com>
> 
> 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
> > 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ