[PATCH 1/5] drm/xe: Move part of xe_file cleanup to a helper
Umesh Nerlige Ramappa
umesh.nerlige.ramappa at intel.com
Mon Jul 8 22:12:33 UTC 2024
On Mon, Jul 08, 2024 at 09:21:01PM +0000, Matthew Brost wrote:
>On Mon, Jul 08, 2024 at 01:20:59PM -0700, Umesh Nerlige Ramappa wrote:
>> In order to make xe_file ref counted, move destruction of xe_file
>> members to a helper.
>>
>
>I don't see where xe_file_close is called in this patch but appears to
>called in .postclose later in the series. I'd move that change into this
>patch.
I don't follow this point. The series is not calling
xe_file_close/.postclose, so not sure what change I need to move.
Thanks,
Umesh
>
>Also I think the VM should ref count the xref too to be uniform and it
>appears this series is not doing that either. With a VM ref counting
>xref, the 'xe_vm_close_and_put' is going to need to be in xe_file_close
>too.
>
>Matt
>
>> Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa at intel.com>
>> ---
>> drivers/gpu/drm/xe/xe_device.c | 36 +++++++++++++++++++++-------------
>> 1 file changed, 22 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
>> index cfda7cb5df2c..babb697652d5 100644
>> --- a/drivers/gpu/drm/xe/xe_device.c
>> +++ b/drivers/gpu/drm/xe/xe_device.c
>> @@ -90,24 +90,12 @@ static int xe_file_open(struct drm_device *dev, struct drm_file *file)
>> return 0;
>> }
>>
>> -static void xe_file_close(struct drm_device *dev, struct drm_file *file)
>> +static void xe_file_destroy(struct xe_file *xef)
>> {
>> - struct xe_device *xe = to_xe_device(dev);
>> - struct xe_file *xef = file->driver_priv;
>> + struct xe_device *xe = xef->xe;
>> struct xe_vm *vm;
>> - struct xe_exec_queue *q;
>> unsigned long idx;
>>
>> - /*
>> - * No need for exec_queue.lock here as there is no contention for it
>> - * when FD is closing as IOCTLs presumably can't be modifying the
>> - * xarray. Taking exec_queue.lock here causes undue dependency on
>> - * vm->lock taken during xe_exec_queue_kill().
>> - */
>> - xa_for_each(&xef->exec_queue.xa, idx, q) {
>> - xe_exec_queue_kill(q);
>> - xe_exec_queue_put(q);
>> - }
>> xa_destroy(&xef->exec_queue.xa);
>> mutex_destroy(&xef->exec_queue.lock);
>> mutex_lock(&xef->vm.lock);
>> @@ -125,6 +113,26 @@ static void xe_file_close(struct drm_device *dev, struct drm_file *file)
>> kfree(xef);
>> }
>>
>> +static void xe_file_close(struct drm_device *dev, struct drm_file *file)
>> +{
>> + struct xe_file *xef = file->driver_priv;
>> + struct xe_exec_queue *q;
>> + unsigned long idx;
>> +
>> + /*
>> + * No need for exec_queue.lock here as there is no contention for it
>> + * when FD is closing as IOCTLs presumably can't be modifying the
>> + * xarray. Taking exec_queue.lock here causes undue dependency on
>> + * vm->lock taken during xe_exec_queue_kill().
>> + */
>> + xa_for_each(&xef->exec_queue.xa, idx, q) {
>> + xe_exec_queue_kill(q);
>> + xe_exec_queue_put(q);
>> + }
>> +
>> + xe_file_destroy(xef);
>> +}
>> +
>> static const struct drm_ioctl_desc xe_ioctls[] = {
>> DRM_IOCTL_DEF_DRV(XE_DEVICE_QUERY, xe_query_ioctl, DRM_RENDER_ALLOW),
>> DRM_IOCTL_DEF_DRV(XE_GEM_CREATE, xe_gem_create_ioctl, DRM_RENDER_ALLOW),
>> --
>> 2.38.1
>>
More information about the Intel-xe
mailing list