lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <41ae6d5b-8b50-427b-a89e-d9c5df7779b8@damsy.net>
Date: Fri, 21 Nov 2025 16:12:38 +0100
From: Pierre-Eric Pelloux-Prayer <pierre-eric@...sy.net>
To: Christian König <christian.koenig@....com>,
 Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@....com>,
 Alex Deucher <alexander.deucher@....com>, David Airlie <airlied@...il.com>,
 Simona Vetter <simona@...ll.ch>
Cc: amd-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 18/28] drm/amdgpu: move sched status check inside
 amdgpu_ttm_set_buffer_funcs_status



Le 21/11/2025 à 16:08, Christian König a écrit :
> 
> 
> On 11/21/25 11:12, Pierre-Eric Pelloux-Prayer wrote:
>> It avoids duplicated code and allows to output a warning.
>>
>> Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@....com>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 13 ++++---------
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c    |  6 ++++++
>>   2 files changed, 10 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> index 54f7c81f287b..7167db54d722 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> @@ -3309,9 +3309,7 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)
>>   	if (r)
>>   		goto init_failed;
>>   
>> -	if (adev->mman.buffer_funcs_ring &&
>> -	    adev->mman.buffer_funcs_ring->sched.ready)
>> -		amdgpu_ttm_set_buffer_funcs_status(adev, true);
>> +	amdgpu_ttm_set_buffer_funcs_status(adev, true);
>>   
>>   	/* Don't init kfd if whole hive need to be reset during init */
>>   	if (adev->init_lvl->level != AMDGPU_INIT_LEVEL_MINIMAL_XGMI) {
>> @@ -4191,8 +4189,7 @@ static int amdgpu_device_ip_resume(struct amdgpu_device *adev)
>>   
>>   	r = amdgpu_device_ip_resume_phase2(adev);
>>   
>> -	if (adev->mman.buffer_funcs_ring->sched.ready)
>> -		amdgpu_ttm_set_buffer_funcs_status(adev, true);
>> +	amdgpu_ttm_set_buffer_funcs_status(adev, true);
>>   
>>   	if (r)
>>   		return r;
>> @@ -5321,8 +5318,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool notify_clients)
>>   	return 0;
>>   
>>   unwind_evict:
>> -	if (adev->mman.buffer_funcs_ring->sched.ready)
>> -		amdgpu_ttm_set_buffer_funcs_status(adev, true);
>> +	amdgpu_ttm_set_buffer_funcs_status(adev, true);
>>   	amdgpu_fence_driver_hw_init(adev);
>>   
>>   unwind_userq:
>> @@ -6050,8 +6046,7 @@ int amdgpu_device_reinit_after_reset(struct amdgpu_reset_context *reset_context)
>>   				if (r)
>>   					goto out;
>>   
>> -				if (tmp_adev->mman.buffer_funcs_ring->sched.ready)
>> -					amdgpu_ttm_set_buffer_funcs_status(tmp_adev, true);
>> +				amdgpu_ttm_set_buffer_funcs_status(tmp_adev, true);
>>   
>>   				r = amdgpu_device_ip_resume_phase3(tmp_adev);
>>   				if (r)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> index 489880b2fb8e..9024dde0c5a7 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> @@ -2233,6 +2233,12 @@ u32 amdgpu_ttm_set_buffer_funcs_status(struct amdgpu_device *adev, bool enable)
>>   	    adev->mman.buffer_funcs_enabled == enable || adev->gmc.is_app_apu)
>>   		return reserved_windows;
>>   
>> +	if ((!adev->mman.buffer_funcs_ring || !adev->mman.buffer_funcs_ring->sched.ready) &&
>> +	    enable) {
>> +		dev_warn(adev->dev, "Not enabling DMA transfers for in kernel use");
>> +		return 0;
>> +	}
>> +
> 
> Only check that when enabling the functions. Could be that when disabling them we have sched.ready set to false already.

The check already has a "&& enable" condition. Are you suggesting something 
different?

PE


> 
> Apart from that looks good to me.
> 
> Regards,
> Christian.
> 
>>   	if (enable) {
>>   		struct amdgpu_ring *ring;
>>   		struct drm_gpu_scheduler *sched;


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ