Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Niklas Schnelle <schnelle@linux.ibm.com>
To: Keith Busch <kbusch@meta.com>,
	linux-pci@vger.kernel.org, bhelgaas@google.com,
	alex.williamson@redhat.com
Cc: ameynarkhede03@gmail.com, raphael.norwitz@nutanix.com,
	Keith Busch <kbusch@kernel.org>
Subject: Re: [PATCHv2 2/2] pci: warn if a running device is unaware of reset
Date: Tue, 29 Oct 2024 12:27:41 +0100	[thread overview]
Message-ID: <471500804dff90f31320a2a53a48724fffe318b6.camel@linux.ibm.com> (raw)
In-Reply-To: <20241025222755.3756162-2-kbusch@meta.com>

On Fri, 2024-10-25 at 15:27 -0700, Keith Busch wrote:
> From: Keith Busch <kbusch@kernel.org>
> 
> If a reset is issued to a running device with a driver that didn't
> register the notification callbacks, the driver may be unaware of this
> event and have an inconsistent view of the device's state. Log a warning
> of this event because there's nothing else indicating the event occured,
> which could be confusing when debugging such situations.
> 
> Signed-off-by: Keith Busch <kbusch@kernel.org>
> ---
>  drivers/pci/pci.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 338dfcd983f1e..bbf12d4998269 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -5158,6 +5158,8 @@ static void pci_dev_save_and_disable(struct pci_dev *dev)
>  	 */
>  	if (err_handler && err_handler->reset_prepare)
>  		err_handler->reset_prepare(dev);
> +	else if (dev->driver)
> +		pci_warn(dev, "resetting");
>  
>  	/*
>  	 * Wake-up device prior to save.  PM registers default to D0 after
> @@ -5191,6 +5193,8 @@ static void pci_dev_restore(struct pci_dev *dev)
>  	 */
>  	if (err_handler && err_handler->reset_done)
>  		err_handler->reset_done(dev);
> +	else if (dev->driver)
> +		pci_warn(dev, "reset done");
>  }
>  
>  /* dev->reset_methods[] is a 0-terminated list of indices into this array */

For what it's worth on s390 I think the previous proposal of having the
attribute on the pci_bus would have been better in principle. On s390
the PCI bus probing is done by firmware and Linux doesn't see a pci_dev
for bridges but we do create struct pci_bus for example for a PF and
its child VFs.

Then again we can't really do a reset on this level, other than
manually going through the PCI functions and resetting them one by one.
In fact we may see PCI functions on their own bus while another Linux
instance (LPAR) sees other functions from that bus. So yeah, I guess
it's fair not to have this attribute but still wanted to offer these
thoughts.

Thanks,
Niklas

  parent reply	other threads:[~2024-10-29 11:27 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-25 22:27 [PATCHv2 1/2] pci: provide bus reset attribute Keith Busch
2024-10-25 22:27 ` [PATCHv2 2/2] pci: warn if a running device is unaware of reset Keith Busch
2024-10-28 19:35   ` Alex Williamson
2024-10-29 11:27   ` Niklas Schnelle [this message]
2024-11-01 19:21     ` Keith Busch
2024-11-04  9:44       ` Niklas Schnelle
2024-11-04 17:01         ` Keith Busch
2024-11-05 12:28           ` Niklas Schnelle
2024-11-05 15:46             ` Keith Busch
2024-10-29 15:06   ` ameynarkhede03
2024-10-28 19:35 ` [PATCHv2 1/2] pci: provide bus reset attribute Alex Williamson
2024-10-29 15:05 ` ameynarkhede03
2024-11-04 21:28 ` Keith Busch
2024-11-04 21:53   ` Krzysztof Wilczyński
2024-11-04 21:58     ` Keith Busch
2024-11-04 22:42       ` Krzysztof Wilczy´nski
2024-11-12 19:12 ` Keith Busch
2024-11-12 23:16 ` Bjorn Helgaas
2024-11-13 17:38   ` Keith Busch

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=471500804dff90f31320a2a53a48724fffe318b6.camel@linux.ibm.com \
    --to=schnelle@linux.ibm.com \
    --cc=alex.williamson@redhat.com \
    --cc=ameynarkhede03@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=kbusch@kernel.org \
    --cc=kbusch@meta.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=raphael.norwitz@nutanix.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