AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: ensure no_hw_access is visible before MMIO
@ 2026-01-28  6:23 Perry Yuan
  2026-01-28 13:57 ` Lazar, Lijo
  0 siblings, 1 reply; 3+ messages in thread
From: Perry Yuan @ 2026-01-28  6:23 UTC (permalink / raw)
  To: alexander.deucher, amd-gfx

Add a full memory barrier after clearing no_hw_access in
amdgpu_device_mode1_reset() so subsequent PCI state restore
access cannot observe stale state on other CPUs.

Fixes: 91ae0045130b ("drm/amd/pm: Disable MMIO access during SMU Mode 1 reset")
Signed-off-by: Perry Yuan <perry.yuan@amd.com>
Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index b2deb6a74eb2..e69ab8a923e3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -5735,6 +5735,9 @@ int amdgpu_device_mode1_reset(struct amdgpu_device *adev)
 	/* enable mmio access after mode 1 reset completed */
 	adev->no_hw_access = false;
 
+	/* ensure no_hw_access is updated before we access hw */
+	smp_mb();
+
 	amdgpu_device_load_pci_state(adev->pdev);
 	ret = amdgpu_psp_wait_for_bootloader(adev);
 	if (ret)
-- 
2.34.1


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

* Re: [PATCH] drm/amdgpu: ensure no_hw_access is visible before MMIO
  2026-01-28  6:23 [PATCH] drm/amdgpu: ensure no_hw_access is visible before MMIO Perry Yuan
@ 2026-01-28 13:57 ` Lazar, Lijo
  2026-01-28 14:40   ` Christian König
  0 siblings, 1 reply; 3+ messages in thread
From: Lazar, Lijo @ 2026-01-28 13:57 UTC (permalink / raw)
  To: Perry Yuan, alexander.deucher, amd-gfx



On 28-Jan-26 11:53 AM, Perry Yuan wrote:
> Add a full memory barrier after clearing no_hw_access in
> amdgpu_device_mode1_reset() so subsequent PCI state restore
> access cannot observe stale state on other CPUs.
> 

Just want to reiterate that this approach masks the original logical 
errors within amdgpu.

For ex: this is one such which would not have been caught in the first 
place with shortcuts like these.

12caf3b76150 drm/amdkfd: Handle GPU reset and drain retry fault race

Thanks,
Lijo

> Fixes: 91ae0045130b ("drm/amd/pm: Disable MMIO access during SMU Mode 1 reset")
> Signed-off-by: Perry Yuan <perry.yuan@amd.com>
> Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index b2deb6a74eb2..e69ab8a923e3 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -5735,6 +5735,9 @@ int amdgpu_device_mode1_reset(struct amdgpu_device *adev)
>   	/* enable mmio access after mode 1 reset completed */
>   	adev->no_hw_access = false;
>   
> +	/* ensure no_hw_access is updated before we access hw */
> +	smp_mb();
> +
>   	amdgpu_device_load_pci_state(adev->pdev);
>   	ret = amdgpu_psp_wait_for_bootloader(adev);
>   	if (ret)


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

* Re: [PATCH] drm/amdgpu: ensure no_hw_access is visible before MMIO
  2026-01-28 13:57 ` Lazar, Lijo
@ 2026-01-28 14:40   ` Christian König
  0 siblings, 0 replies; 3+ messages in thread
From: Christian König @ 2026-01-28 14:40 UTC (permalink / raw)
  To: Lazar, Lijo, Perry Yuan, alexander.deucher, amd-gfx

On 1/28/26 14:57, Lazar, Lijo wrote:
> On 28-Jan-26 11:53 AM, Perry Yuan wrote:
>> Add a full memory barrier after clearing no_hw_access in
>> amdgpu_device_mode1_reset() so subsequent PCI state restore
>> access cannot observe stale state on other CPUs.
>>
> 
> Just want to reiterate that this approach masks the original logical errors within amdgpu.

Yeah, completely agree. A single smp_mb() is actually forbidden by upstreaming rules.

So absolutely clear NAK from my side to this patch here.

Regards,
Christian.

> 
> For ex: this is one such which would not have been caught in the first place with shortcuts like these.
> 
> 12caf3b76150 drm/amdkfd: Handle GPU reset and drain retry fault race
> 
> Thanks,
> Lijo
> 
>> Fixes: 91ae0045130b ("drm/amd/pm: Disable MMIO access during SMU Mode 1 reset")
>> Signed-off-by: Perry Yuan <perry.yuan@amd.com>
>> Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> index b2deb6a74eb2..e69ab8a923e3 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> @@ -5735,6 +5735,9 @@ int amdgpu_device_mode1_reset(struct amdgpu_device *adev)
>>       /* enable mmio access after mode 1 reset completed */
>>       adev->no_hw_access = false;
>>   +    /* ensure no_hw_access is updated before we access hw */
>> +    smp_mb();
>> +
>>       amdgpu_device_load_pci_state(adev->pdev);
>>       ret = amdgpu_psp_wait_for_bootloader(adev);
>>       if (ret)
> 


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

end of thread, other threads:[~2026-01-28 14:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-28  6:23 [PATCH] drm/amdgpu: ensure no_hw_access is visible before MMIO Perry Yuan
2026-01-28 13:57 ` Lazar, Lijo
2026-01-28 14:40   ` Christian König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox