[PATCH 3/3] drm/xe/oa: Destroy dangling oa streams when xe_file is removed
Lucas De Marchi
lucas.demarchi at intel.com
Thu Aug 15 18:17:05 UTC 2024
On Thu, Aug 15, 2024 at 09:27:58AM GMT, Jose Souza wrote:
>If an application opens an oa stream and for whatever reason it don't
>close the stream the oa unit associeted with it will never be release,
>so no other application can use it.
>The only workaround was to unload the driver or reboot.
>
>So here adding a list of oa stream and and when a xe_file is closed
>it will also destroy all oa stream with the same xe_file.
>
>Signed-off-by: José Roberto de Souza <jose.souza at intel.com>
>---
> drivers/gpu/drm/xe/xe_device.c | 2 ++
> drivers/gpu/drm/xe/xe_oa.c | 28 +++++++++++++++++++++++++++-
> drivers/gpu/drm/xe/xe_oa.h | 1 +
> drivers/gpu/drm/xe/xe_oa_types.h | 8 ++++++++
> 4 files changed, 38 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
>index 2063283871503..b098685ed3636 100644
>--- a/drivers/gpu/drm/xe/xe_device.c
>+++ b/drivers/gpu/drm/xe/xe_device.c
>@@ -158,6 +158,8 @@ static void xe_file_close(struct drm_device *dev, struct drm_file *file)
>
> xe_pm_runtime_get(xe);
>
>+ xe_oa_file_destroy_stream(xef);
I'm not sure about this impl giving xef for oa to delete from a list,
will leave the to Ashutosh. Comment below about a mistake though
> static int xe_oa_alloc_oa_buffer(struct xe_oa_stream *stream)
>@@ -1480,11 +1484,15 @@ static int xe_oa_stream_open_ioctl_locked(struct xe_oa *oa,
> goto exit;
> }
>
>+ stream->xef = param->xef;
if you keep a pointer to xef, you need to get a ref. Use
xe_file_get()/xe_file_put().
Lucas De Marchi
More information about the Intel-xe
mailing list