[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190809202815.4jtpdsnnmztins34@wunner.de>
Date: Fri, 9 Aug 2019 22:28:15 +0200
From: Lukas Wunner <lukas@...ner.de>
To: Keith Busch <kbusch@...nel.org>
Cc: Bjorn Helgaas <helgaas@...nel.org>, linux-pci@...r.kernel.org,
linux-kernel@...r.kernel.org,
Xiongfeng Wang <wangxiongfeng2@...wei.com>
Subject: Re: [PATCH] PCI: pciehp: Avoid returning prematurely from sysfs
requests
On Fri, Aug 09, 2019 at 01:32:16PM -0600, Keith Busch wrote:
> On Fri, Aug 09, 2019 at 12:28:43PM +0200, Lukas Wunner wrote:
> > A sysfs request to enable or disable a PCIe hotplug slot should not
> > return before it has been carried out. That is sought to be achieved
> > by waiting until the controller's "pending_events" have been cleared.
> >
> > However the IRQ thread pciehp_ist() clears the "pending_events" before
> > it acts on them. If pciehp_sysfs_enable_slot() / _disable_slot() happen
> > to check the "pending_events" after they have been cleared but while
> > pciehp_ist() is still running, the functions may return prematurely
> > with an incorrect return value.
> >
> > Fix by introducing an "ist_running" flag which must be false before a
> > sysfs request is allowed to return.
>
> Can you instead just call synchronize_irq(ctrl->pcie->irq) after the
> pending events is cleared?
You mean call synchronize_irq() from pciehp_sysfs_enable_slot() /
disable_slot()? That's a good idea, let me think that through and
try to make it work that way.
Thanks!
Lukas
Powered by blists - more mailing lists