From: Keith Busch <keith.busch@intel.com>
To: Lukas Wunner <lukas@wunner.de>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
"Wysocki, Rafael J" <rafael.j.wysocki@intel.com>,
"Raj, Ashok" <ashok.raj@intel.com>,
Yinghai Lu <yinghai@kernel.org>, Sinan Kaya <okaya@kernel.org>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
"Patel, Mayurkumar" <mayurkumar.patel@intel.com>,
Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Subject: Re: [PATCH 09/32] PCI: pciehp: Convert to threaded IRQ
Date: Tue, 19 Jun 2018 17:16:46 -0600 [thread overview]
Message-ID: <20180619231646.GA22648@localhost.localdomain> (raw)
In-Reply-To: <b65b18957cec018dec5c1f1c3de0e2e47b46b265.1529173804.git.lukas@wunner.de>
On Sat, Jun 16, 2018 at 12:25:00PM -0700, Lukas Wunner wrote:
> pciehp's IRQ handler queues up a work item for each event signaled by
> the hardware. A more modern alternative is to let a long running
> kthread service the events. The IRQ handler's sole job is then to check
> whether the IRQ originated from the device in question, acknowledge its
> receipt to the hardware to quiesce the interrupt and wake up the kthread.
>
> One benefit is reduced latency to handle the IRQ, which is a necessity
> for realtime environments. Another benefit is that we can make pciehp
> simpler and more robust by handling events synchronously in process
> context, rather than asynchronously by queueing up work items. pciehp's
> usage of work items is a historic artifact, it predates the introduction
> of threaded IRQ handlers by two years. (The former was introduced in
> 2007 with commit 5d386e1ac402 ("pciehp: Event handling rework"), the
> latter in 2009 with commit 3aa551c9b4c4 ("genirq: add threaded interrupt
> handler support").)
>
> Convert pciehp to threaded IRQ handling by retrieving the pending events
> in pciehp_isr(), saving them for later consumption by the thread handler
> pciehp_ist() and clearing them in the Slot Status register.
>
> By clearing the Slot Status (and thereby acknowledging the events) in
> pciehp_isr(), we can avoid requesting the IRQ with IRQF_ONESHOT, which
> would have the unpleasant side effect of starving devices sharing the
> IRQ until pciehp_ist() has finished.
>
> pciehp_isr() does not count how many times each event occurred, but
> merely records the fact *that* an event occurred. If the same event
> occurs a second time before pciehp_ist() is woken, that second event
> will not be recorded separately, which is problematic according to
> commit fad214b0aa72 ("PCI: pciehp: Process all hotplug events before
> looking for new ones") because we may miss removal of a card in-between
> two back-to-back insertions. We're about to make pciehp_ist() resilient
> to missed events. The present commit regresses the driver's behavior
> temporarily in order to separate the changes into reviewable chunks.
> This doesn't affect regular slow-motion hotplug, only plug-unplug-plug
> operations that happen in a timespan shorter than wakeup of the IRQ
> thread.
I like the series over-all. Definitely an improvement.
I am a little concered about what may happen if we need to remove the
bridge while its irq thread is running. The task removing the bridge
is holding the pci_rescan_remove_lock so when it tries to free the
bridge IRQ, the IRQ subsystem may not be able to progress because the
action->thread may be waiting to take the same lock.
It actually looks like the same deadlock already exists in the current
implementation when it takes down its workqueue, but it's a lot harder to
follow all the different work tasks before this clean-up. Maybe removing
bridges isn't very common, but it's just something I noticed.
next prev parent reply other threads:[~2018-06-19 23:13 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-16 19:25 [PATCH 00/32] Rework pciehp event handling & add runtime PM Lukas Wunner
2018-06-16 19:25 ` [PATCH 11/32] PCI: pciehp: Stop blinking on slot enable failure Lukas Wunner
2018-06-16 19:25 ` [PATCH 21/32] PCI: pciehp: Become resilient to missed events Lukas Wunner
2018-06-16 19:25 ` [PATCH 23/32] PCI: pciehp: Avoid slot access during reset Lukas Wunner
2018-06-21 12:06 ` Mika Westerberg
2018-06-22 9:23 ` Lukas Wunner
2018-06-25 13:10 ` Mika Westerberg
2018-06-16 19:25 ` [PATCH 27/32] PCI: pciehp: Support interrupts sent from D3hot Lukas Wunner
2018-07-12 23:03 ` Bjorn Helgaas
2018-06-16 19:25 ` [PATCH 07/32] PCI: pciehp: Document struct slot and struct controller Lukas Wunner
2018-06-16 19:25 ` [PATCH 24/32] PCI: portdrv: Deduplicate PM callback iterator Lukas Wunner
2018-06-16 19:25 ` [PATCH 18/32] PCI: pciehp: Drop enable/disable lock Lukas Wunner
2018-06-16 19:25 ` [PATCH 02/32] PCI: pciehp: Fix UAF on unplug Lukas Wunner
2018-06-16 19:25 ` [PATCH 16/32] PCI: pciehp: Track enable/disable status Lukas Wunner
2018-06-16 19:25 ` [PATCH 04/32] PCI: pciehp: Fix unprotected list iteration in IRQ handler Lukas Wunner
2018-06-16 19:25 ` [PATCH 03/32] PCI: pciehp: Fix deadlock on unplug Lukas Wunner
2018-09-06 16:01 ` Mika Westerberg
2018-09-06 16:26 ` Lukas Wunner
2018-09-06 18:08 ` Mika Westerberg
2018-06-16 19:25 ` [PATCH 32/32] PCI: Whitelist Thunderbolt ports for runtime D3 Lukas Wunner
2018-06-21 11:13 ` Mika Westerberg
2018-07-18 19:30 ` Lukas Wunner
2018-07-20 15:23 ` Mika Westerberg
2018-07-20 16:00 ` Mika Westerberg
2018-07-20 20:33 ` Bjorn Helgaas
2018-06-16 19:25 ` [PATCH 12/32] PCI: pciehp: Handle events synchronously Lukas Wunner
2018-06-16 19:25 ` [PATCH 13/32] PCI: pciehp: Drop slot workqueue Lukas Wunner
2018-06-16 19:25 ` [PATCH 15/32] PCI: pciehp: Publish to user space last on probe Lukas Wunner
2018-06-16 19:25 ` [PATCH 05/32] PCI: pciehp: Drop unnecessary NULL pointer check Lukas Wunner
2018-06-16 19:25 ` [PATCH 14/32] PCI: hotplug: Demidlayer registration with the core Lukas Wunner
2018-06-17 16:44 ` Andy Shevchenko
2018-07-16 12:46 ` Bjorn Helgaas
2018-07-16 14:14 ` Andy Shevchenko
2018-06-16 19:25 ` [PATCH 01/32] PCI: hotplug: Don't leak pci_slot on registration failure Lukas Wunner
2018-06-16 19:25 ` [PATCH 29/32] PCI: pciehp: Resume parent to D0 on config space access Lukas Wunner
2018-06-16 19:25 ` [PATCH 31/32] PCI: Whitelist native hotplug ports for runtime D3 Lukas Wunner
2018-06-16 19:25 ` [PATCH 20/32] PCI: pciehp: Tolerate initially unstable link Lukas Wunner
2018-06-16 19:25 ` [PATCH 19/32] PCI: pciehp: Declare pciehp_enable/disable_slot() static Lukas Wunner
2018-06-16 19:25 ` [PATCH 25/32] PCI: pciehp: Clear spurious events earlier on resume Lukas Wunner
2018-06-16 19:25 ` [PATCH 22/32] PCI: pciehp: Always enable occupied slot on probe Lukas Wunner
2018-06-16 19:25 ` [PATCH 06/32] PCI: pciehp: Declare pciehp_unconfigure_device() void Lukas Wunner
2018-06-16 19:25 ` [PATCH 28/32] PCI: pciehp: Resume to D0 on enable/disable Lukas Wunner
2018-06-16 19:25 ` [PATCH 09/32] PCI: pciehp: Convert to threaded IRQ Lukas Wunner
2018-06-19 23:16 ` Keith Busch [this message]
2018-06-20 11:01 ` Lukas Wunner
2018-06-16 19:25 ` [PATCH 08/32] genirq: Synchronize only with single thread on free_irq() Lukas Wunner
2018-07-12 22:21 ` Bjorn Helgaas
2018-07-13 7:21 ` Lukas Wunner
2018-07-13 11:44 ` Bjorn Helgaas
2018-07-16 12:37 ` Bjorn Helgaas
2018-07-16 13:37 ` Lukas Wunner
2018-06-16 19:25 ` [PATCH 10/32] PCI: pciehp: Convert to threaded polling Lukas Wunner
2018-06-16 19:25 ` [PATCH 17/32] PCI: pciehp: Enable/disable exclusively from IRQ thread Lukas Wunner
2018-06-21 11:58 ` Mika Westerberg
2018-06-16 19:25 ` [PATCH 30/32] PCI: sysfs: Resume to D0 on function reset Lukas Wunner
2018-06-16 19:25 ` [PATCH 26/32] PCI: pciehp: Obey compulsory command delay after resume Lukas Wunner
2018-06-21 12:19 ` [PATCH 00/32] Rework pciehp event handling & add runtime PM Mika Westerberg
2018-06-27 13:35 ` Patel, Mayurkumar
2018-07-12 22:28 ` Bjorn Helgaas
2018-07-13 7:54 ` Lukas Wunner
2018-07-13 11:43 ` Bjorn Helgaas
2018-07-16 14:20 ` Bjorn Helgaas
2018-07-19 9:43 ` Lukas Wunner
2018-07-19 19:05 ` Bjorn Helgaas
2018-07-19 22:50 ` Bjorn Helgaas
2018-07-28 5:44 ` Lukas Wunner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180619231646.GA22648@localhost.localdomain \
--to=keith.busch@intel.com \
--cc=ashok.raj@intel.com \
--cc=bhelgaas@google.com \
--cc=kaneshige.kenji@jp.fujitsu.com \
--cc=linux-pci@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=mayurkumar.patel@intel.com \
--cc=mika.westerberg@linux.intel.com \
--cc=okaya@kernel.org \
--cc=rafael.j.wysocki@intel.com \
--cc=tglx@linutronix.de \
--cc=yinghai@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).