[PATCH] drm/amdgpu: Avoid leaking PM domain on driver unbind

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jan 21, 2018 at 7:46 AM, Lukas Wunner <lukas at wunner.de> wrote:
> amdgpu_device_init() calls vga_switcheroo_init_domain_pm_ops() either
> if the device has the PowerXpress flag set or if the user has set the
> "runpm" module param to 1.
>
> However amdgpu_device_fini() calls vga_switcheroo_fini_domain_pm_ops()
> only under the first of those two conditions.

Good catch.  Forcing runpm=1 doesn't do anything useful anyway so just
remove it in device_init().  See the attached patch.

Alex


>
> (Note this issue isn't present in radeon.  It was introduced when the
> driver was forked.)
>
> Cc: stable at vger.kernel.org
> Cc: Alex Deucher <alexander.deucher at amd.com>
> Signed-off-by: Lukas Wunner <lukas at wunner.de>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index d09c4ee9f7e1..f07eedc53761 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -2083,7 +2083,7 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
>         adev->bios = NULL;
>         if (!pci_is_thunderbolt_attached(adev->pdev))
>                 vga_switcheroo_unregister_client(adev->pdev);
> -       if (adev->flags & AMD_IS_PX)
> +       if (adev->flags & AMD_IS_PX || amdgpu_runtime_pm == 1)
>                 vga_switcheroo_fini_domain_pm_ops(adev->dev);
>         vga_client_register(adev->pdev, NULL, NULL, NULL);
>         if (adev->rio_mem)
> --
> 2.15.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-drm-amdgpu-Avoid-leaking-PM-domain-on-driver-unbind-.patch
Type: text/x-patch
Size: 1385 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20180122/b3e54d1b/attachment.bin>


[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux