All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Li,Rongqing" <lirongqing@baidu.com>
To: Farhan Ali <alifm@linux.ibm.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Niklas Schnelle <schnelle@linux.ibm.com>,
	Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>,
	Frank Li <Frank.Li@nxp.com>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: 答复: [外部邮件] Re: [PATCH] PCI: Only restore state that was successfully saved around a reset
Date: Thu, 12 Nov 2026 02:31:46 +0000	[thread overview]
Message-ID: <286a648d13724bafa9daa2797fd44f83@baidu.com> (raw)
In-Reply-To: <04e0b460-da19-458b-a042-753608e67c68@linux.ibm.com>


> > pci_dev_save_and_disable() returns early when config space is
> > inaccessible, without saving anything, but pci_dev_restore() calls
> > pci_restore_state() unconditionally and pci_restore_state() does not
> > look at state_saved. After the reset makes config space accessible
> > again, the all-zero or stale saved_config_space[] array is written
> > back to the device, clearing Command, BARs and, for bridges, the bus number
> registers.
> >
> > Clear state_saved when the save is skipped and only restore when a
> > state was saved.
> 
> We should always have a valid state of the device saved at enumeration due to
> commit a2f1e22390ac ("PCI/ERR: Ensure error recoverability at all times"). In
> pci_dev_save_disable(), if the device is inaccessible then we want to avoid
> storing a state that can corrupt the device on restore.
> Since we always have a valid state, we would restore to the last good state.
> 
You're right, please disregard this patch.

I missed that a2f1e22390ac ("PCI/ERR: Ensure error recoverability at
all times") already saves a valid state at enumeration and deliberately
drops the state_saved check in pci_restore_state(). Skipping the save
when config space is inaccessible keeps that last good state, and the
unconditional restore writes it back after the reset. Gating
pci_dev_restore() on state_saved would instead leave the device at its
power-on defaults. This came from code inspection of the reset path, not 
from a failure on a specific device or driver.

Sorry for the noise.

[Li,Rongqing] 


      reply	other threads:[~2026-11-12  2:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10  5:33 [PATCH] PCI: Only restore state that was successfully saved around a reset lirongqing
2026-11-10  5:33 ` [PATCH] PCI: Save the Root Port state before a platform-specific reset lirongqing
2026-11-10  5:55   ` sashiko-bot
2026-11-10  8:19     ` 答复: [外部邮件] " Li,Rongqing
2026-11-10 10:16   ` Lukas Wunner
2026-11-12  2:47     ` 答复: [????] " Li,Rongqing
2026-11-10  5:51 ` [PATCH] PCI: Only restore state that was successfully saved around a reset sashiko-bot
2026-11-10  8:17   ` 答复: [外部邮件] " Li,Rongqing
2026-11-10 10:13 ` Lukas Wunner
2026-11-10 18:09 ` Farhan Ali
2026-11-12  2:31   ` Li,Rongqing [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=286a648d13724bafa9daa2797fd44f83@baidu.com \
    --to=lirongqing@baidu.com \
    --cc=Frank.Li@nxp.com \
    --cc=alifm@linux.ibm.com \
    --cc=bhelgaas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=manivannan.sadhasivam@oss.qualcomm.com \
    --cc=schnelle@linux.ibm.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 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.