Linux USB
 help / color / mirror / Atom feed
From: "Francisco Beltrán Millalén" <fbeltranmillalen@gmail.com>
To: helgaas@kernel.org
Cc: bhelgaas@google.com, linux-pci@vger.kernel.org,
	stern@rowland.harvard.edu, gregkh@linuxfoundation.org,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	lukas@wunner.de, alifm@linux.ibm.com, andreas.noever@gmail.com,
	westeri@kernel.org, YehezkelShB@gmail.com
Subject: Re: [PATCH v2 2/3] PCI/PM: Do not save the config space of an inaccessible device
Date: Thu,  8 Oct 2026 23:41:04 -0300	[thread overview]
Message-ID: <20261009024104.14995-1-fbeltranmillalen@gmail.com> (raw)
In-Reply-To: <20261008225825.GA936610@bhelgaas>

Hi Bjorn,

Thanks for the review, and for suggesting a simpler way to do this.

On Thu, Oct 08, 2026 at 05:58:25PM -0500, Bjorn Helgaas wrote:
> Apparently this is a reproducible issue on MacBookPro14,3.  That makes
> me a little hesitant because we're not actually dealing with the fact
> that the Thunderbolt controller isn't responsive during suspend.
>
> It seems worthwhile to me to skip pci_save_state() if the device isn't
> accessible, but I don't think it's a real solution to whatever is
> going on with Thunderbolt, and I don't think we should mention it here
> as though it is.

You're right that this patch doesn't fix the Thunderbolt problem
itself; that is what the Alpine Ridge quirk is for.  This patch only
makes sure that, when a device stops responding, the PCI core doesn't
save garbage and write it back later.  I'll rewrite the commit message
in v3 to say just that, and mention the MacBook only as the machine
where I found it.

> Maybe we should remove the check in pci_dev_save_and_disable() and
> make it check the return value of pci_save_state()?  I don't think
> checking twice adds anything.

Yes, I'll change it that way in v3.  While looking at it I found one
small corner case worth mentioning: pci_save_state() can also fail when
the kernel couldn't allocate memory for part of the saved state, back
when the device was first found.  The device itself works fine then,
but with this change the reset would no longer disable it first.  It is
very unlikely to happen, so I don't think it matters much, but if you
prefer, I can make the reset stop only when the device isn't
responding.

> I bet we get 99% of the usefulness here by just adding the first
> accessibility check above.
>
> This second check only helps if the device becomes inaccessible during
> the tiny window while we're saving its state, and I'm not sure that
> the extra complexity here and being able to restore a valid config
> header with junk in the capabilities is really a benefit.

I'll drop it in v3, so pci_save_state() goes back to what it was, plus
the one check at the start.

I also wanted to see how your version behaves before sending it, so I
built it and tested it on the MacBook today.  It went through four
suspend/resume cycles, three of them with a USB disk attached, with no
warnings, and it skipped the controller that wasn't responding, just
like v2 did.  I also reset a USB controller by hand to try the
pci_dev_save_and_disable() change, and that worked as before too.

Thanks again,
Francisco

  reply	other threads:[~2026-10-09  2:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-30 14:19 [PATCH v2 0/3] PCI/PM: Do not save the config space of an inaccessible device Francisco Beltrán Millalén
2026-09-30 14:19 ` [PATCH v2 1/3] usb: hcd-pci: Honour pci_save_state() failure Francisco Beltrán Millalén
2026-09-30 14:19 ` [PATCH v2 2/3] PCI/PM: Do not save the config space of an inaccessible device Francisco Beltrán Millalén
2026-10-08 22:58   ` Bjorn Helgaas
2026-10-09  2:41     ` Francisco Beltrán Millalén [this message]
2026-09-30 14:19 ` [PATCH v2 3/3] PCI: Do not mistake an absent device for an active link Francisco Beltrán Millalén
2026-10-08 18:55 ` [PATCH v2 0/3] PCI/PM: Do not save the config space of an inaccessible device Darrell Gum
2026-10-08 22:34 ` Bjorn Helgaas
2026-10-09  2:40   ` Francisco Beltrán Millalén

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=20261009024104.14995-1-fbeltranmillalen@gmail.com \
    --to=fbeltranmillalen@gmail.com \
    --cc=YehezkelShB@gmail.com \
    --cc=alifm@linux.ibm.com \
    --cc=andreas.noever@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=helgaas@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=stern@rowland.harvard.edu \
    --cc=westeri@kernel.org \
    /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