linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Lukas Wunner <lukas@wunner.de>, Keith Busch <keith.busch@intel.com>
Cc: Linux PCI <linux-pci@vger.kernel.org>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Sinan Kaya <okaya@kernel.org>, Thomas Tai <thomas.tai@oracle.com>,
	poza@codeaurora.org
Subject: Re: [PATCH 16/16] PCI: Unify device inaccessible
Date: Mon, 03 Sep 2018 10:38:08 +1000	[thread overview]
Message-ID: <0065b46df3c9c6fc535a747b05a02eaac50bbb56.camel@kernel.crashing.org> (raw)
In-Reply-To: <20180902143937.utebcv4cqw6zbb4q@wunner.de>

On Sun, 2018-09-02 at 16:39 +0200, Lukas Wunner wrote:
> On Fri, Aug 31, 2018 at 03:26:39PM -0600, Keith Busch wrote:
> > --- a/drivers/pci/pci.h
> > +++ b/drivers/pci/pci.h
> > @@ -294,21 +294,20 @@ struct pci_sriov {
> >  static inline int pci_dev_set_disconnected(struct pci_dev *dev, void *unused)
> >  {
> > -	set_bit(PCI_DEV_DISCONNECTED, &dev->priv_flags);
> > +	dev->error_state = pci_channel_io_perm_failure;
> >  	return 0;
> >  }
> 
> Back in 2016 when I floated the idea of using error_state to store
> that the device has been removed, you responded:

Wow, lots of activity while I wasn't looking :-) Unfortunately I'll be
away for a few weeks...

A quick note:

>    "I'd be happy if we can reuse that, but concerned about overloading
>     error_state's intended purpose for AER. The conditions under which an
>     'is_removed' may be set can also create AER events, and the aer driver
>     overrides the error_state."
>     https://spinics.net/lists/linux-pci/msg55417.html
> 
> Is it guaranteed that AER refrains from writing a different value to
> error_state once it has been set to pci_channel_io_perm_failure due
> to removal?  If so I'm happy with this patch.

My suggestion to avoid that problem (we have a similar one in theory
with EEH which can set error_state from interrupts) is to make
error_state an atomic by having the "set" function use cmpxchg to
enforce that there is no valid transition from perm_failure.

I was hoping to cookup some patches along the line of the RFC I already
sent factoring the above, but a number of things here got in the way
and I'm about to head out of the country for 3 weeks.

Cheers,
Ben.

      reply	other threads:[~2018-09-03  4:56 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-31 21:26 [PATCH 00/16] PCI, error handling and hot plug Keith Busch
2018-08-31 21:26 ` [PATCH 01/16] PCI: Simplify disconnected marking Keith Busch
2018-08-31 21:26 ` [PATCH 02/16] PCI: Fix pci_reset_bus Keith Busch
2018-08-31 21:52   ` Sinan Kaya
2018-08-31 22:08     ` Keith Busch
2018-08-31 21:26 ` [PATCH 03/16] PCI/AER: Remove dead code Keith Busch
2018-08-31 21:26 ` [PATCH 04/16] PCI/ERR: Use slot reset if available Keith Busch
2018-09-01 17:20   ` Lukas Wunner
2018-09-04 14:53     ` Keith Busch
2018-08-31 21:26 ` [PATCH 05/16] PCI/ERR: Handle fatal error recovery Keith Busch
2018-09-01  8:31   ` Christoph Hellwig
2018-09-05  5:56   ` poza
2018-08-31 21:26 ` [PATCH 06/16] PCI/ERR: Remove devices on recovery failure Keith Busch
2018-08-31 22:26   ` Sinan Kaya
2018-08-31 21:26 ` [PATCH 07/16] PCI/ERR: Always use the first downstream port Keith Busch
2018-08-31 21:26 ` [PATCH 08/16] PCI/ERR: Simplify broadcast callouts Keith Busch
2018-09-01  8:33   ` Christoph Hellwig
2018-08-31 21:26 ` [PATCH 09/16] PCI/ERR: Report current recovery status for udev Keith Busch
2018-09-01  8:36   ` Christoph Hellwig
2018-08-31 21:26 ` [PATCH 10/16] PCI/portdrv: Provide pci error callbacks Keith Busch
2018-09-02 10:16   ` Lukas Wunner
2018-09-04 21:38     ` Keith Busch
2018-08-31 21:26 ` [PATCH 11/16] PCI/portdrv: Restore pci state on slot reset Keith Busch
2018-09-02  9:34   ` Lukas Wunner
2018-09-04 14:36     ` Keith Busch
2018-08-31 21:26 ` [PATCH 12/16] PCI/pciehp: Fix powerfault detection order Keith Busch
2018-09-01 15:18   ` Lukas Wunner
2018-09-04 14:27     ` Keith Busch
2018-08-31 21:26 ` [PATCH 13/16] PCI/pciehp: Implement error handling callbacks Keith Busch
2018-09-02 10:39   ` Lukas Wunner
2018-09-04 14:19     ` Keith Busch
2018-08-31 21:26 ` [PATCH 14/16] pciehp: Ignore link events during DPC event Keith Busch
2018-08-31 22:18   ` Sinan Kaya
2018-08-31 22:33     ` Keith Busch
2018-08-31 22:55       ` Sinan Kaya
2018-08-31 22:59         ` Keith Busch
2018-08-31 23:07           ` Sinan Kaya
2018-09-02 14:27   ` Lukas Wunner
2018-09-04 14:16     ` Keith Busch
2018-09-04 14:40       ` Lukas Wunner
2018-09-04 15:31         ` Keith Busch
2018-08-31 21:26 ` [PATCH 15/16] PCI/DPC: Wait for reset complete Keith Busch
2018-08-31 22:15   ` Sinan Kaya
2018-08-31 21:26 ` [PATCH 16/16] PCI: Unify device inaccessible Keith Busch
2018-09-02 14:39   ` Lukas Wunner
2018-09-03  0:38     ` Benjamin Herrenschmidt [this message]

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=0065b46df3c9c6fc535a747b05a02eaac50bbb56.camel@kernel.crashing.org \
    --to=benh@kernel.crashing.org \
    --cc=bhelgaas@google.com \
    --cc=keith.busch@intel.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=okaya@kernel.org \
    --cc=poza@codeaurora.org \
    --cc=thomas.tai@oracle.com \
    /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).