linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: fix link error for !PM_SLEEP
@ 2025-07-14  8:16 Arnd Bergmann
  2025-07-14 14:59 ` Limonciello, Mario
  0 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2025-07-14  8:16 UTC (permalink / raw)
  To: Alex Deucher, Christian König, David Airlie, Simona Vetter,
	Mario Limonciello, Lijo Lazar, Samuel Zhang
  Cc: Arnd Bergmann, Marek Olšák, amd-gfx, dri-devel,
	linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

When power management is not enabled in the kernel build, the newly
added hibernation changes cause a link failure:

arm-linux-gnueabi-ld: drivers/gpu/drm/amd/amdgpu/amdgpu_drv.o: in function `amdgpu_pmops_thaw':
amdgpu_drv.c:(.text+0x1514): undefined reference to `pm_hibernate_is_recovering'

Make the power management code in this driver conditional on
CONFIG_PM and CONFIG_PM_SLEEP

Fixes: 530694f54dd5 ("drm/amdgpu: do not resume device in thaw for normal hibernation")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 021defca9b61..66b5b3260fb9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -2963,15 +2963,15 @@ long amdgpu_drm_ioctl(struct file *filp,
 }
 
 static const struct dev_pm_ops amdgpu_pm_ops = {
-	.prepare = amdgpu_pmops_prepare,
-	.complete = amdgpu_pmops_complete,
-	.suspend = amdgpu_pmops_suspend,
-	.suspend_noirq = amdgpu_pmops_suspend_noirq,
-	.resume = amdgpu_pmops_resume,
-	.freeze = amdgpu_pmops_freeze,
-	.thaw = amdgpu_pmops_thaw,
-	.poweroff = amdgpu_pmops_poweroff,
-	.restore = amdgpu_pmops_restore,
+	.prepare = pm_sleep_ptr(amdgpu_pmops_prepare),
+	.complete = pm_sleep_ptr(amdgpu_pmops_complete),
+	.suspend = pm_sleep_ptr(amdgpu_pmops_suspend),
+	.suspend_noirq = pm_sleep_ptr(amdgpu_pmops_suspend_noirq),
+	.resume = pm_sleep_ptr(amdgpu_pmops_resume),
+	.freeze = pm_sleep_ptr(amdgpu_pmops_freeze),
+	.thaw = pm_sleep_ptr(amdgpu_pmops_thaw),
+	.poweroff = pm_sleep_ptr(amdgpu_pmops_poweroff),
+	.restore = pm_sleep_ptr(amdgpu_pmops_restore),
 	.runtime_suspend = amdgpu_pmops_runtime_suspend,
 	.runtime_resume = amdgpu_pmops_runtime_resume,
 	.runtime_idle = amdgpu_pmops_runtime_idle,
@@ -3116,7 +3116,7 @@ static struct pci_driver amdgpu_kms_pci_driver = {
 	.probe = amdgpu_pci_probe,
 	.remove = amdgpu_pci_remove,
 	.shutdown = amdgpu_pci_shutdown,
-	.driver.pm = &amdgpu_pm_ops,
+	.driver.pm = pm_ptr(&amdgpu_pm_ops),
 	.err_handler = &amdgpu_pci_err_handler,
 	.dev_groups = amdgpu_sysfs_groups,
 };
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/amdgpu: fix link error for !PM_SLEEP
  2025-07-14  8:16 [PATCH] drm/amdgpu: fix link error for !PM_SLEEP Arnd Bergmann
@ 2025-07-14 14:59 ` Limonciello, Mario
  2025-07-14 15:01   ` Arnd Bergmann
  0 siblings, 1 reply; 5+ messages in thread
From: Limonciello, Mario @ 2025-07-14 14:59 UTC (permalink / raw)
  To: Arnd Bergmann, Deucher, Alexander, Koenig, Christian,
	David Airlie, Simona Vetter, Lazar, Lijo, Zhang, GuoQing (Sam)
  Cc: Arnd Bergmann, Olsak, Marek, amd-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org

On 7/14/25 3:16 AM, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> When power management is not enabled in the kernel build, the newly
> added hibernation changes cause a link failure:
> 
> arm-linux-gnueabi-ld: drivers/gpu/drm/amd/amdgpu/amdgpu_drv.o: in function `amdgpu_pmops_thaw':
> amdgpu_drv.c:(.text+0x1514): undefined reference to `pm_hibernate_is_recovering'
> 
> Make the power management code in this driver conditional on
> CONFIG_PM and CONFIG_PM_SLEEP
> 
> Fixes: 530694f54dd5 ("drm/amdgpu: do not resume device in thaw for normal hibernation")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

We're going to fix it using this stub instead.

https://lore.kernel.org/linux-pm/20250712233715.821424-1-superm1@kernel.org/

It's in drm-misc-next as of this weekend and it should show up in 
linux-next in the next day or two.

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 20 ++++++++++----------
>   1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 021defca9b61..66b5b3260fb9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -2963,15 +2963,15 @@ long amdgpu_drm_ioctl(struct file *filp,
>   }
>   
>   static const struct dev_pm_ops amdgpu_pm_ops = {
> -	.prepare = amdgpu_pmops_prepare,
> -	.complete = amdgpu_pmops_complete,
> -	.suspend = amdgpu_pmops_suspend,
> -	.suspend_noirq = amdgpu_pmops_suspend_noirq,
> -	.resume = amdgpu_pmops_resume,
> -	.freeze = amdgpu_pmops_freeze,
> -	.thaw = amdgpu_pmops_thaw,
> -	.poweroff = amdgpu_pmops_poweroff,
> -	.restore = amdgpu_pmops_restore,
> +	.prepare = pm_sleep_ptr(amdgpu_pmops_prepare),
> +	.complete = pm_sleep_ptr(amdgpu_pmops_complete),
> +	.suspend = pm_sleep_ptr(amdgpu_pmops_suspend),
> +	.suspend_noirq = pm_sleep_ptr(amdgpu_pmops_suspend_noirq),
> +	.resume = pm_sleep_ptr(amdgpu_pmops_resume),
> +	.freeze = pm_sleep_ptr(amdgpu_pmops_freeze),
> +	.thaw = pm_sleep_ptr(amdgpu_pmops_thaw),
> +	.poweroff = pm_sleep_ptr(amdgpu_pmops_poweroff),
> +	.restore = pm_sleep_ptr(amdgpu_pmops_restore),
>   	.runtime_suspend = amdgpu_pmops_runtime_suspend,
>   	.runtime_resume = amdgpu_pmops_runtime_resume,
>   	.runtime_idle = amdgpu_pmops_runtime_idle,
> @@ -3116,7 +3116,7 @@ static struct pci_driver amdgpu_kms_pci_driver = {
>   	.probe = amdgpu_pci_probe,
>   	.remove = amdgpu_pci_remove,
>   	.shutdown = amdgpu_pci_shutdown,
> -	.driver.pm = &amdgpu_pm_ops,
> +	.driver.pm = pm_ptr(&amdgpu_pm_ops),
>   	.err_handler = &amdgpu_pci_err_handler,
>   	.dev_groups = amdgpu_sysfs_groups,
>   };


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/amdgpu: fix link error for !PM_SLEEP
  2025-07-14 14:59 ` Limonciello, Mario
@ 2025-07-14 15:01   ` Arnd Bergmann
  2025-07-14 15:49     ` Limonciello, Mario
  0 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2025-07-14 15:01 UTC (permalink / raw)
  To: Mario Limonciello, Arnd Bergmann, Alex Deucher,
	Christian König, Dave Airlie, Simona Vetter, Lijo Lazar,
	Zhang, GuoQing (Sam)
  Cc: Olsak, Marek, amd-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org

On Mon, Jul 14, 2025, at 16:59, Limonciello, Mario wrote:
> On 7/14/25 3:16 AM, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@arndb.de>
>> 
>> When power management is not enabled in the kernel build, the newly
>> added hibernation changes cause a link failure:
>> 
>> arm-linux-gnueabi-ld: drivers/gpu/drm/amd/amdgpu/amdgpu_drv.o: in function `amdgpu_pmops_thaw':
>> amdgpu_drv.c:(.text+0x1514): undefined reference to `pm_hibernate_is_recovering'
>> 
>> Make the power management code in this driver conditional on
>> CONFIG_PM and CONFIG_PM_SLEEP
>> 
>> Fixes: 530694f54dd5 ("drm/amdgpu: do not resume device in thaw for normal hibernation")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> We're going to fix it using this stub instead.
>
> https://lore.kernel.org/linux-pm/20250712233715.821424-1-superm1@kernel.org/
>
> It's in drm-misc-next as of this weekend and it should show up in 
> linux-next in the next day or two.

That patch makes sense as well, but I think mine is useful as an
improvement even if it doesn't address a link failure but only
reduces the object size by reducing the amount of dead code.

      Arnd

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/amdgpu: fix link error for !PM_SLEEP
  2025-07-14 15:01   ` Arnd Bergmann
@ 2025-07-14 15:49     ` Limonciello, Mario
  2025-07-14 16:52       ` Limonciello, Mario
  0 siblings, 1 reply; 5+ messages in thread
From: Limonciello, Mario @ 2025-07-14 15:49 UTC (permalink / raw)
  To: Arnd Bergmann, Arnd Bergmann, Deucher, Alexander,
	Koenig, Christian, Dave Airlie, Simona Vetter, Lazar, Lijo,
	Zhang, GuoQing (Sam)
  Cc: Olsak, Marek, amd-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org

On 7/14/25 10:01 AM, Arnd Bergmann wrote:
> On Mon, Jul 14, 2025, at 16:59, Limonciello, Mario wrote:
>> On 7/14/25 3:16 AM, Arnd Bergmann wrote:
>>> From: Arnd Bergmann <arnd@arndb.de>
>>>
>>> When power management is not enabled in the kernel build, the newly
>>> added hibernation changes cause a link failure:
>>>
>>> arm-linux-gnueabi-ld: drivers/gpu/drm/amd/amdgpu/amdgpu_drv.o: in function `amdgpu_pmops_thaw':
>>> amdgpu_drv.c:(.text+0x1514): undefined reference to `pm_hibernate_is_recovering'
>>>
>>> Make the power management code in this driver conditional on
>>> CONFIG_PM and CONFIG_PM_SLEEP
>>>
>>> Fixes: 530694f54dd5 ("drm/amdgpu: do not resume device in thaw for normal hibernation")
>>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>>
>> We're going to fix it using this stub instead.
>>
>> https://lore.kernel.org/linux-pm/20250712233715.821424-1-superm1@kernel.org/
>>
>> It's in drm-misc-next as of this weekend and it should show up in
>> linux-next in the next day or two.
> 
> That patch makes sense as well, but I think mine is useful as an
> improvement even if it doesn't address a link failure but only
> reduces the object size by reducing the amount of dead code.
> 
>        Arnd

Thanks for pointing it out.  You're right.  I'll get it picked up.

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/amdgpu: fix link error for !PM_SLEEP
  2025-07-14 15:49     ` Limonciello, Mario
@ 2025-07-14 16:52       ` Limonciello, Mario
  0 siblings, 0 replies; 5+ messages in thread
From: Limonciello, Mario @ 2025-07-14 16:52 UTC (permalink / raw)
  To: Arnd Bergmann, Arnd Bergmann, Ho, Kenny
  Cc: Olsak, Marek, amd-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Deucher, Alexander, Koenig, Christian, Dave Airlie, Simona Vetter,
	Lazar, Lijo, Zhang, GuoQing (Sam)

On 7/14/25 10:49 AM, Mario Limonciello wrote:
> On 7/14/25 10:01 AM, Arnd Bergmann wrote:
>> On Mon, Jul 14, 2025, at 16:59, Limonciello, Mario wrote:
>>> On 7/14/25 3:16 AM, Arnd Bergmann wrote:
>>>> From: Arnd Bergmann <arnd@arndb.de>
>>>>
>>>> When power management is not enabled in the kernel build, the newly
>>>> added hibernation changes cause a link failure:
>>>>
>>>> arm-linux-gnueabi-ld: drivers/gpu/drm/amd/amdgpu/amdgpu_drv.o: in 
>>>> function `amdgpu_pmops_thaw':
>>>> amdgpu_drv.c:(.text+0x1514): undefined reference to 
>>>> `pm_hibernate_is_recovering'
>>>>
>>>> Make the power management code in this driver conditional on
>>>> CONFIG_PM and CONFIG_PM_SLEEP
>>>>
>>>> Fixes: 530694f54dd5 ("drm/amdgpu: do not resume device in thaw for 
>>>> normal hibernation")
>>>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>>>
>>> We're going to fix it using this stub instead.
>>>
>>> https://lore.kernel.org/linux-pm/20250712233715.821424-1- 
>>> superm1@kernel.org/
>>>
>>> It's in drm-misc-next as of this weekend and it should show up in
>>> linux-next in the next day or two.
>>
>> That patch makes sense as well, but I think mine is useful as an
>> improvement even if it doesn't address a link failure but only
>> reduces the object size by reducing the amount of dead code.
>>
>>        Arnd
> 
> Thanks for pointing it out.  You're right.  I'll get it picked up.
> 
> Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>

The internal AMD CI raised a problem on a dGPU (details below).  I think 
that the diff might be a little overzealous, perhaps on the poweroff() 
callback?

Here is the assertion that got raised.

https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/blob/master/lib/amdgpu/amd_pci_unplug.c#L376

Failed test(s)
==============

igt@amdgpu/amd_pci_unplug@amdgpu_hotunplug_with_exported_bo
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   Error message
   -------------
Starting subtest: amdgpu_hotunplug_with_exported_bo
(amd_pci_unplug:981) amdgpu/amd_pci_unplug-CRITICAL: Test assertion 
failure function amdgpu_hotunplug_with_exported_bo, file 
../lib/amdgpu/amd_pci_unplug.c:344:
(amd_pci_unplug:981) amdgpu/amd_pci_unplug-CRITICAL: Failed assertion: r 
== 1
(amd_pci_unplug:981) amdgpu/amd_pci_unplug-CRITICAL: Last errno: 2, No 
such file or directory
(amd_pci_unplug:981) amdgpu/amd_pci_unplug-CRITICAL: error: 0 != 1
Subtest amdgpu_hotunplug_with_exported_bo failed.
**** DEBUG ****
(amd_pci_unplug:981) amdgpu/amd_pci_unplug-CRITICAL: Test assertion 
failure function amdgpu_hotunplug_with_exported_bo, file 
../lib/amdgpu/amd_pci_unplug.c:344:
(amd_pci_unplug:981) amdgpu/amd_pci_unplug-CRITICAL: Failed assertion: r 
== 1
(amd_pci_unplug:981) amdgpu/amd_pci_unplug-CRITICAL: Last errno: 2, No 
such file or directory
(amd_pci_unplug:981) amdgpu/amd_pci_unplug-CRITICAL: error: 0 != 1
(amd_pci_unplug:981) igt_core-INFO: Stack trace:
(amd_pci_unplug:981) igt_core-INFO:   #0 ../lib/igt_core.c:2075 
__igt_fail_assert()
(amd_pci_unplug:981) igt_core-INFO:   #1 
../lib/amdgpu/amd_pci_unplug.c:377 amdgpu_hotunplug_with_exported_bo()
(amd_pci_unplug:981) igt_core-INFO:   #2 
../tests/amdgpu/amd_pci_unplug.c:50 __igt_unique____real_main34()
(amd_pci_unplug:981) igt_core-INFO:   #3 
../tests/amdgpu/amd_pci_unplug.c:34 main()
(amd_pci_unplug:981) igt_core-INFO:   #4 
../sysdeps/nptl/libc_start_call_main.h:58 __libc_start_call_main()
(amd_pci_unplug:981) igt_core-INFO:   #5 ../csu/libc-start.c:128 
__libc_start_main@@GLIBC_2.34()
(amd_pci_unplug:981) igt_core-INFO:   #6 [_start+0x25]
****  END  ****
Subtest amdgpu_hotunplug_with_exported_bo: FAIL (0.033s)


   Dmesg output
   ------------
<6> [701.429516] [IGT] amd_pci_unplug: executing
<6> [701.434258] [IGT] amd_pci_unplug: starting subtest 
amdgpu_hotunplug_with_exported_bo
<6> [701.475508] [IGT] amd_pci_unplug: finished subtest 
amdgpu_hotunplug_with_exported_bo, FAIL
<6> [701.483839] [IGT] amd_pci_unplug: exiting, ret=98

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-07-14 16:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-14  8:16 [PATCH] drm/amdgpu: fix link error for !PM_SLEEP Arnd Bergmann
2025-07-14 14:59 ` Limonciello, Mario
2025-07-14 15:01   ` Arnd Bergmann
2025-07-14 15:49     ` Limonciello, Mario
2025-07-14 16:52       ` Limonciello, Mario

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).