All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: sashiko-reviews@lists.linux.dev
Cc: Keith Busch <kbusch@meta.com>, linux-pci@vger.kernel.org
Subject: Re: [PATCH] vfio/pci: Restore standard PCI config space in .slot_reset()
Date: Tue, 18 Aug 2026 18:02:51 +0200	[thread overview]
Message-ID: <aoSCK2Sy0HeyX_la@wunner.de> (raw)
In-Reply-To: <20260817200404.BB3121F000E9@smtp.kernel.org>

On Mon, Aug 17, 2026 at 08:04:04PM +0000, sashiko-bot@kernel.org wrote:
> [Severity: High]
> Is this callback reachable under normal single-device circumstances?
> 
> In pcie_do_recovery(), the report_slot_reset broadcast is gated behind
> checking if the combined error status is PCI_ERS_RESULT_NEED_RESET.
> 
> However, vfio_pci_core_aer_err_detected() unconditionally returns
> PCI_ERS_RESULT_CAN_RECOVER. The PCI recovery state machine promotes
> CAN_RECOVER to RECOVERED during the mmio_enabled phase, so the
> condition to call slot_reset evaluates to false unless another driver
> on the same PCIe bridge votes for NEED_RESET.

I have a patch on my development branch so that ->reset_slot() is
also invoked if (state == pci_channel_io_frozen), i.e. on Fatal Errors.

I have another patch pending to allow error recovery for unbound devices.

Both patches are available for testing on this branch and I hope to
submit them in the upcoming cycle:

https://github.com/l1k/linux/commits/aer_unbound/

> [Severity: High]
> Can pci_restore_state() clobber userspace runtime configurations with
> an outdated probe-time snapshot?
> 
> For a VFIO device, pdev->saved_config_space contains the host kernel's
> baseline state captured during vfio_pci_core_enable(). Subsequent
> userspace modifications (like enabling bus master or setting up MSI)
> are recorded in VFIO's virtual cache (vdev->vconfig) but do not update
> pdev->saved_config_space.

I guess the right thing to do is to write vdev->vconfig to config space
after pci_restore_state()?

Thanks,

Lukas

  parent reply	other threads:[~2026-08-18 16:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-17 19:51 [PATCH] vfio/pci: Restore standard PCI config space in .slot_reset() Keith Busch
2026-08-17 20:04 ` sashiko-bot
2026-08-17 20:18   ` Keith Busch
2026-08-18 16:02   ` Lukas Wunner [this message]
2026-08-17 21:50 ` Alex Williamson
2026-08-17 23:21   ` Keith Busch
2026-08-18 14:37     ` Alex Williamson
2026-08-18 15:11       ` Shameer Kolothum Thodi

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=aoSCK2Sy0HeyX_la@wunner.de \
    --to=lukas@wunner.de \
    --cc=kbusch@meta.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.