From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
To: Lukas Wunner <lukas@wunner.de>
Cc: Bjorn Helgaas <helgaas@kernel.org>,
Brian Norris <briannorris@chromium.org>,
Bjorn Helgaas <bhelgaas@google.com>,
Krzysztof Wilczy??ski <kwilczynski@kernel.org>,
Krishna chaitanya chundru <quic_krichai@quicinc.com>,
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>,
linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
Jon Hunter <jonathanh@nvidia.com>,
Saurabh Sengar <ssengar@linux.microsoft.com>
Subject: Re: [PATCH 6.13] PCI/pwrctrl: Skip NULL of_node when unregistering
Date: Mon, 9 Dec 2024 23:16:20 +0530 [thread overview]
Message-ID: <20241209174620.6a53t5k2qgmgleix@thinkpad> (raw)
In-Reply-To: <Z0xAdQ2ozspEnV5g@wunner.de>
On Sun, Dec 01, 2024 at 11:54:45AM +0100, Lukas Wunner wrote:
> On Sun, Dec 01, 2024 at 01:51:08PM +0530, Manivannan Sadhasivam wrote:
> > The idea of pci_pwrctrl_unregister() is to remove the pwrctl device when the
> > associated PCI device gets removed. When this happens, the pwrctl driver will
> > turn off the power to the corresponding PCI device
>
> After pci_pwrctrl_unregister() is called from pci_stop_dev(),
> the device may be accessed by one of the calls in pci_destroy_dev().
>
> E.g. pci_doe_destroy() may set the DOE Abort bit in the DOE Control
> Register if a DOE exchange is ongoing. One cannot assume that no
> such exchange is ongoing merely because the device was unbound from
> its driver. The PCI core may have legitimate reasons to perform a DOE
> exchange or generally access config space even after the device has been
> unbound. And IIUC, those accesses will fail if pwrctrl has powered the
> device down.
>
> Another example is pcie_aspm_exit_link_state(), which will adjust ASPM
> settings on device removal.
>
> So it seems to me that the call to pci_pwrctrl_unregister() needs to be
> moved to pci_doe_destroy(). However I'm worried that will break the
> symmetry with pci_pwrctrl_create_devices(), which is only called in the
> !pci_dev_is_added() case.
>
So I took a stab at both of your suggestions:
1. Moving the pwrctrl devices creation to pci_scan_device()
2. Moving the pwrctrl devices unregister to pci_destroy_dev()
Both seems to be working fine and it also allows creating pwrctrl devices for
the PCI bridges without any change (for which I was planning to add one more
patch earlier). But the devlink creation still needs to happen in
pci_bus_add_device(), which I think is fine.
Will post the patches tomorrow, thanks!
- Mani
--
மணிவண்ணன் சதாசிவம்
next prev parent reply other threads:[~2024-12-09 17:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-26 21:04 [PATCH 6.13] PCI/pwrctrl: Skip NULL of_node when unregistering Brian Norris
2024-11-27 5:52 ` Manivannan Sadhasivam
2024-11-27 19:55 ` Jon Hunter
2024-11-29 19:28 ` Bjorn Helgaas
2024-12-01 8:21 ` Manivannan Sadhasivam
2024-12-01 10:54 ` Lukas Wunner
2024-12-09 17:46 ` Manivannan Sadhasivam [this message]
2024-12-01 16:13 ` Lukas Wunner
2024-11-30 18:23 ` Bjorn Helgaas
2024-12-01 8:22 ` Manivannan Sadhasivam
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=20241209174620.6a53t5k2qgmgleix@thinkpad \
--to=manivannan.sadhasivam@linaro.org \
--cc=bartosz.golaszewski@linaro.org \
--cc=bhelgaas@google.com \
--cc=briannorris@chromium.org \
--cc=helgaas@kernel.org \
--cc=jonathanh@nvidia.com \
--cc=kwilczynski@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=quic_krichai@quicinc.com \
--cc=ssengar@linux.microsoft.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.