linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: linux-pci@vger.kernel.org, linux-pm@vger.kernel.org,
	Andreas Noever <andreas.noever@gmail.com>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>
Subject: Re: [PATCH v2 07/13] PCI: pciehp: Ignore interrupts during D3cold
Date: Tue, 2 Aug 2016 18:27:40 +0200	[thread overview]
Message-ID: <20160802162740.GA4036@wunner.de> (raw)
In-Reply-To: <20160617225204.GC10416@localhost>

On Fri, Jun 17, 2016 at 05:52:04PM -0500, Bjorn Helgaas wrote:
> On Fri, May 13, 2016 at 01:15:31PM +0200, Lukas Wunner wrote:
> > If a hotplug port is suspended to D3cold, its slot status register
> > cannot be read.  If that hotplug port happens to share its IRQ with
> > other devices, then whenever an interrupt occurs for one of these
> > devices, a "no response from device" message is logged with level
> > KERN_INFO.  Apart from this annoyance, CPU time is needlessly spent
> > trying to read the slot status register even though we know in advance
> > that it will fail.
> 
> I guess this is a pretty generic problem that could affect any device
> that shares an IRQ.
> 
> I think I'll queue this on my pci/pm branch, since it seems closely
> related to Mika's "PCI: Add runtime PM support for PCIe ports".
> 
> Did you check for the same issue in other likely places, e.g., AER,
> PME, etc.?

Apologies for the delay, I've checked all other port services now:

- Our AER and PME drivers bind only to root ports and I can't imagine
  how those could go to D3cold, they're part of the root complex or
  PCH and I'm not aware of a chipset that would allow turning off the
  power well for individual PCIe ports.

- DPC on the other hand also binds to downstream ports. I do have
  downstream ports in my machine (as part of the Thunderbolt switch)
  but they do not have the DPC capability. I've never seen devices
  with that capability and cannot estimate what the chances are of them
  going to D3cold and sharing an IRQ with other devices. It's probably
  not worth preparing for such a situation without knowing its likelihood.

- VC: We allocate a port service for this but do not have a driver.

Bottom line is that the patch for the PCIe hotplug driver seems to be
sufficient.

FWIW, on my machine I see numerous devices with AER, PME and VC
capabilities. The Nvidia GPU as well as network, Firewire and
Thunderbolt controllers all have those. AFAICS we ignore them
because their specific drivers do not care for the capabilities
and portdrv only binds to root ports.

This seems to support your argument that the PCIe capabilities
should be handled by the core rather than portdrv, as we could
then make use of the capabilities on endpoint devices in a
universal manner.

On the other hand, I think we cannot use a separate MSI for
AER, PME et al, can we? If we cannot, then AER and PME would
share the IRQ with an endpoint device's regular interrupt handler,
and that might ruin performance. E.g. the Broadcom wireless card
generates millions of interrupts on a sufficiently active WiFi.
Accessing the device's config space on every interrupt just to
check for AER or PME seems like a bad idea. So at the very least
we'd need some kind of opt-out.

Best regards,

Lukas

> > On MacBook Pros introduced 2011 and 2012, the IRQ of a Thunderbolt
> > hotplug port is unfortunately shared with a wireless card, an audio card
> > and an SDXC controller.  When the Thunderbolt controller is powered
> > down, the machine carries out at least one unneeded slot status register
> > read for each wireless packet received and prints a corresponding error
> > message to the system log.
> > 
> > The hotplug port's current_state will be D3cold when it's powered down,
> > so ignore interrupts that occur during that power state.
> > 
> > Signed-off-by: Lukas Wunner <lukas@wunner.de>
> > ---
> >  drivers/pci/hotplug/pciehp_hpc.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
> > index 5c24e93..08e84d6 100644
> > --- a/drivers/pci/hotplug/pciehp_hpc.c
> > +++ b/drivers/pci/hotplug/pciehp_hpc.c
> > @@ -546,6 +546,10 @@ static irqreturn_t pcie_isr(int irq, void *dev_id)
> >  	u8 present;
> >  	bool link;
> >  
> > +	/* Interrupts cannot originate from a controller that's asleep */
> > +	if (pdev->current_state == PCI_D3cold)
> > +		return IRQ_NONE;
> > +
> >  	/*
> >  	 * In order to guarantee that all interrupt events are
> >  	 * serviced, we need to re-inspect Slot Status register after
> > -- 
> > 2.8.1

  reply	other threads:[~2016-08-02 16:27 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-13 11:15 [PATCH v2 00/13] Runtime PM for Thunderbolt on Macs Lukas Wunner
2016-05-13 11:15 ` [PATCH v2 09/13] PCI: Do not write to PM control register while in D3cold Lukas Wunner
2016-06-17 21:18   ` Bjorn Helgaas
2016-07-18 13:55   ` Rafael J. Wysocki
2016-05-13 11:15 ` [PATCH v2 02/13] PCI: Allow D3 for Thunderbolt ports Lukas Wunner
2016-05-13 11:15 ` [PATCH v2 13/13] thunderbolt: Support runtime pm on NHI Lukas Wunner
2016-05-13 11:15 ` [PATCH v2 05/13] PCI: Use portdrv pm iterator on further callbacks Lukas Wunner
2016-05-13 11:15 ` [PATCH v2 03/13] PCI: Add Thunderbolt portdrv service type Lukas Wunner
2016-06-17 22:51   ` Bjorn Helgaas
2016-07-20  0:30     ` Rafael J. Wysocki
2016-07-20  6:59     ` Lukas Wunner
2016-05-13 11:15 ` [PATCH v2 12/13] thunderbolt: Support runtime pm on upstream bridge Lukas Wunner
2016-05-13 11:15 ` [PATCH v2 10/13] PCI: Avoid going from D3cold to D3hot for system sleep Lukas Wunner
2016-06-17 21:09   ` Bjorn Helgaas
2016-06-17 22:14     ` Lukas Wunner
2016-07-18 13:39       ` Rafael J. Wysocki
2016-08-03 12:28         ` Lukas Wunner
2016-08-03 23:50           ` Rafael J. Wysocki
2016-08-04  0:45             ` Lukas Wunner
2016-08-04  1:07               ` Rafael J. Wysocki
2016-08-04  8:14                 ` Lukas Wunner
2016-08-04 15:30                   ` Rafael J. Wysocki
2016-08-07  9:03                     ` Lukas Wunner
2016-08-07 23:32                       ` Rafael J. Wysocki
2016-08-11 13:20                         ` Lukas Wunner
2016-08-12  0:50                           ` Rafael J. Wysocki
2016-08-12 16:16                             ` Lukas Wunner
2016-08-12 22:18                               ` Rafael J. Wysocki
2016-08-12 22:37                                 ` Rafael J. Wysocki
2016-08-14 10:27                                 ` Lukas Wunner
2016-08-15 23:05                                   ` Rafael J. Wysocki
2016-05-13 11:15 ` [PATCH v2 07/13] PCI: pciehp: Ignore interrupts during D3cold Lukas Wunner
2016-06-17 22:52   ` Bjorn Helgaas
2016-08-02 16:27     ` Lukas Wunner [this message]
2016-08-05  0:29       ` Rafael J. Wysocki
2016-05-13 11:15 ` [PATCH v2 11/13] PM / sleep: Allow opt-out from runtime resume after direct-complete Lukas Wunner
2016-07-18 13:18   ` Rafael J. Wysocki
2016-08-07  9:56     ` Lukas Wunner
2016-08-07 15:33       ` Alan Stern
2016-08-12 16:39         ` Lukas Wunner
2016-08-12 17:30           ` Alan Stern
2016-08-12 22:40             ` Rafael J. Wysocki
2016-05-13 11:15 ` [PATCH v2 01/13] PCI: Recognize Thunderbolt devices Lukas Wunner
2016-05-13 11:15 ` [PATCH v2 06/13] PCI: pciehp: Support runtime pm Lukas Wunner
2016-05-13 11:15 ` [PATCH v2 08/13] PCI: Allow runtime PM for Thunderbolt hotplug ports on Macs Lukas Wunner
2016-06-14  9:08   ` [PATCH v2 08/13 REBASED] " Lukas Wunner
2016-06-17 21:53   ` [PATCH v2 08/13] " Bjorn Helgaas
2016-05-13 11:15 ` [PATCH v2 04/13] PCI: Generalize portdrv pm iterator Lukas Wunner
2016-05-21  9:48 ` [PATCH v2 00/13] Runtime PM for Thunderbolt on Macs Andreas Noever
2016-06-14 16:37   ` Bjorn Helgaas
2016-06-14 19:14     ` Andreas Noever
2016-06-14 20:22       ` Bjorn Helgaas
2016-06-15 18:40         ` Lukas Wunner
2016-06-16  1:55           ` Linus Torvalds
2016-07-07 17:39         ` Andreas Noever
2016-07-09  5:23           ` Greg KH
2016-07-12 21:46             ` Andreas Noever
2016-06-13 20:58 ` Bjorn Helgaas
2016-06-14  9:27   ` Lukas Wunner
2016-07-07 15:02 ` Lukas Wunner
2016-07-08  1:28   ` Rafael J. Wysocki
2016-07-20  7:23     ` Lukas Wunner
2016-07-20 12:48       ` Rafael J. Wysocki

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=20160802162740.GA4036@wunner.de \
    --to=lukas@wunner.de \
    --cc=andreas.noever@gmail.com \
    --cc=helgaas@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=rjw@rjwysocki.net \
    /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).