[PATCH] drm/xe: validate client of BO inside lock

Ghimiray, Himal Prasad himal.prasad.ghimiray at intel.com
Wed Jun 5 07:29:33 UTC 2024



On 05-06-2024 12:11, Ghimiray, Himal Prasad wrote:
> 
> 
> On 03-06-2024 19:58, Tejas Upadhyay wrote:
>> As client of BO getting referenced inside lock of BOs
>> list, its good practice to move these WARN_ONs also
>> under same lock to validate existance of bo->client.
> 
> Nit: Use Imperative language.
> %s/existance/existence
> 
> With these addressed:
> Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray at intel.com>

My Bad. This patch is not needed.
You dont need to protect bo->client or bo->client_link.



> 
>>
>> Signed-off-by: Tejas Upadhyay <tejas.upadhyay at intel.com>
>> ---
>>   drivers/gpu/drm/xe/xe_drm_client.c | 3 +--
>>   1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_drm_client.c 
>> b/drivers/gpu/drm/xe/xe_drm_client.c
>> index 4a19b771e3a0..7881b02fa117 100644
>> --- a/drivers/gpu/drm/xe/xe_drm_client.c
>> +++ b/drivers/gpu/drm/xe/xe_drm_client.c
>> @@ -131,10 +131,9 @@ void __xe_drm_client_free(struct kref *kref)
>>   void xe_drm_client_add_bo(struct xe_drm_client *client,
>>                 struct xe_bo *bo)
>>   {
>> +    spin_lock(&client->bos_lock);
>>       XE_WARN_ON(bo->client);
>>       XE_WARN_ON(!list_empty(&bo->client_link));
>> -
>> -    spin_lock(&client->bos_lock);
>>       bo->client = xe_drm_client_get(client);
>>       list_add_tail(&bo->client_link, &client->bos_list);
>>       spin_unlock(&client->bos_lock);


More information about the Intel-xe mailing list