psys_suspend: do graceful teardown instead of returning -EBUSY#66
Open
jibsta210 wants to merge 1 commit intointel:mainfrom
Open
psys_suspend: do graceful teardown instead of returning -EBUSY#66jibsta210 wants to merge 1 commit intointel:mainfrom
jibsta210 wants to merge 1 commit intointel:mainfrom
Conversation
The original psys_suspend() refused system suspend with -EBUSY whenever psys->ready was set (which happens after any first camera use, until runtime PM idle path tears it down). This made s2idle suspend fail on every Panther Lake system after a single camera use, even after the camera userspace had finished. Replace with a tail-call to psys_runtime_pm_suspend(), which performs the proper teardown sequence (close FW ABI, stop FW, power down subdomains, MMU cleanup). On resume, runtime PM re-initializes PSYS lazily on next access via psys_runtime_pm_resume(). Note: This patch must be paired with the staging ipu7 ordering fix in ipu7_pci_remove (companion patch submitted to linux-media for kernel staging tree). Otherwise the MMU cleanup triggered by this graceful teardown will later cause a NULL pointer dereference in find_iova() when isys_remove runs. Tested-by: Jake Steinman <j@metarealtyinc.ca> Signed-off-by: Jake Steinman <j@metarealtyinc.ca>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The current
psys_suspend()refuses system-wide s2idle suspend with-EBUSYwheneverpsys->readyis set. Once a camera client has used PSYS even once (psys->readybecomes 1 inpsys_runtime_pm_resume()), the only way it gets cleared is via the runtime-PM idle path. In practice this means s2idle suspend permanently fails after the first camera use on every Panther Lake laptop.Reproducer (Dell XPS 16 PB16250, Lenovo ThinkPad X9, Latitude 9440, etc.):
dmesg shows:
Fix
Tail-call
psys_runtime_pm_suspend()frompsys_suspend(). The runtime suspend path already performs the correct teardown sequence (close FW ABI, stop FW, power down subdomains, MMU cleanup). On resume, runtime PM re-initializes PSYS lazily on next access.Important caveat
This patch must be paired with a companion patch to
drivers/staging/media/ipu7/ipu7.cthat reordersipu7_pci_remove()soipu7_bus_del_devices()runs beforeipu7_mmu_cleanup(). Without that companion fix, the MMU cleanup triggered here will later cause a NULL pointer dereference infind_iova()whenisys_remove()runs.The staging companion patch will be posted to linux-media@vger.kernel.org. I'm happy to submit it under your maintainership too if that's preferred.
Verification
Tested on Dell XPS 16 (Panther Lake, IPU7 + Synaptics SVP7500 CVS + ov08x40):
systemctl suspendfails with -EBUSY after first camera usePM: suspend entry (s2idle)→PM: suspend exitcleanly, ~5s cycle, camera survives, libcamera re-enumerates after resume.Tested-by: Jake Steinman j@metarealtyinc.ca
Signed-off-by: Jake Steinman j@metarealtyinc.ca