Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but switch_power_state remains permanently stuck in DRM_SWITCH_POWER_CHANGING on suspend/resume failure.
--
--- Patch [2]: [PATCH 2/3] drm/amdgpu: add Apple GMUX runtime PM support ---
commit 2067ef2b3a267308c80f88d728f87fe7fad945a3
Author: Andre Eikmeyer <[email protected]>
drm/amdgpu: add Apple GMUX runtime PM support
The MacBookPro15,1 uses Apple GMUX to control power to the discrete GPU,
but it does not expose the ATPX or ACPI power-resource interfaces currently
recognized by amdgpu. The driver therefore leaves runtime PM disabled even
though vga_switcheroo can switch the GPU reliably.
[ ... ]
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 0ab380ca7e645..a231a002831bb 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
[ ... ]
> @@ -2872,7 +2875,8 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)
> }
>
> adev->in_runpm = true;
> - if (adev->pm.rpm_mode == AMDGPU_RUNPM_PX)
> + if (adev->pm.rpm_mode == AMDGPU_RUNPM_PX ||
> + adev->pm.rpm_mode == AMDGPU_RUNPM_GMUX)
> drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
[Severity: High]
This is a pre-existing issue, but I noticed that switch_power_state can be
left permanently stuck in DRM_SWITCH_POWER_CHANGING if a failure occurs here.
Looking at amdgpu_pmops_runtime_suspend(), if amdgpu_device_suspend() fails,
it returns early:
ret = amdgpu_device_suspend(drm_dev, false);
if (ret) {
adev->in_runpm = false;
if (adev->pm.rpm_mode == AMDGPU_RUNPM_BOCO)
adev->mp1_state = PP_MP1_STATE_NONE;
return ret;
}
Because switch_power_state is never reset on this error path, drm_open()
will explicitly reject new opens by returning -EINVAL. Does this mean a
failed runtime suspend renders the GPU completely unusable for new clients
until reboot?
[ ... ]
> @@ -2947,10 +2952,11 @@ static int amdgpu_pmops_runtime_resume(struct device *dev)
> if (!pci_device_is_present(adev->pdev))
> adev->no_hw_access = true;
>
> - if (adev->pm.rpm_mode == AMDGPU_RUNPM_PX) {
> + if (adev->pm.rpm_mode == AMDGPU_RUNPM_PX ||
> + adev->pm.rpm_mode == AMDGPU_RUNPM_GMUX) {
> drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
[Severity: High]
This is also a pre-existing issue, but the same state machine corruption can
occur during resume.
If either pci_enable_device() or amdgpu_device_resume() fails, the function
returns without resetting switch_power_state from DRM_SWITCH_POWER_CHANGING:
ret = amdgpu_device_resume(drm_dev, false);
if (ret) {
if (adev->pm.rpm_mode == AMDGPU_RUNPM_PX ||
adev->pm.rpm_mode == AMDGPU_RUNPM_GMUX)
pci_disable_device(pdev);
return ret;
}
Would it be safer to restore switch_power_state on these error paths so
that the state isn't permanently stuck?
--
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.