[CI 4/4] drm/xe/uapi: Support requesting unique MSI-X for exec queue

Lucas De Marchi lucas.demarchi at intel.com
Sat Dec 14 00:57:26 UTC 2024


On Fri, Dec 13, 2024 at 01:42:30PM -0500, Rodrigo Vivi wrote:
>On Fri, Dec 13, 2024 at 09:03:53AM +0200, Ilia Levi wrote:
>> From: Dani Liberman <dliberman at habana.ai>
>>
>> Unique MSI-X per exec queue will improve the performance of the
>> IRQ handler. In case no MSI-X is available, the uAPI will return
>> -EBUSY error and the user would be able to execute the uAPI again
>> without the flag (fallback to default MSI-X).
>
>Patches 1, 2 and 3 pushed to drm-xe-next. This patch here is on
>hold while we don't have the open source userspace for that ready
>
>https://dri.freedesktop.org/docs/drm/gpu/drm-uapi.html#open-source-userspace-requirements
>
>Thanks,
>Rodrigo.
>
>>
>> Co-developed-by: Ilia Levi <ilia.levi at intel.com>
>> Signed-off-by: Ilia Levi <ilia.levi at intel.com>
>> Signed-off-by: Dani Liberman <dliberman at habana.ai>
>> Reviewed-by: Piotr Piórkowski <piotr.piorkowski at intel.com>
>> ---
>>  drivers/gpu/drm/xe/xe_exec_queue.c       | 57 +++++++++++++++++++++---
>>  drivers/gpu/drm/xe/xe_exec_queue_types.h |  2 +
>>  drivers/gpu/drm/xe/xe_irq.c              | 18 ++++++++
>>  drivers/gpu/drm/xe/xe_irq.h              |  1 +
>>  include/uapi/drm/xe_drm.h                |  8 +++-
>>  5 files changed, 80 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_exec_queue.c b/drivers/gpu/drm/xe/xe_exec_queue.c
>> index 9c94be571900..35ef75f9919f 100644
>> --- a/drivers/gpu/drm/xe/xe_exec_queue.c
>> +++ b/drivers/gpu/drm/xe/xe_exec_queue.c
>> @@ -12,6 +12,7 @@
>>  #include <uapi/drm/xe_drm.h>
>>
>>  #include "xe_device.h"
>> +#include "xe_drv.h"
>>  #include "xe_gt.h"
>>  #include "xe_hw_engine_class_sysfs.h"
>>  #include "xe_hw_engine_group.h"
>> @@ -35,8 +36,46 @@ enum xe_exec_queue_sched_prop {
>>  static int exec_queue_user_extensions(struct xe_device *xe, struct xe_exec_queue *q,
>>  				      u64 extensions, int ext_number);
>>
>> +static int xe_exec_queue_msix_init(struct xe_device *xe, struct xe_exec_queue *q, bool unique_msix)
>> +{
>> +	u16 msix;
>> +	int err;
>> +
>> +	if (!xe_device_has_msix(xe))
>> +		return 0;
>> +
>> +	if (!unique_msix) {
>> +		q->msix_vec = XE_IRQ_DEFAULT_MSIX;
>> +		return 0;
>> +	}
>> +
>> +	err = xe_irq_msix_request_irq(xe, xe_irq_msix_hwe_handler, q,
>> +				      DRIVER_NAME "-exec-queue", true, &msix);
>> +	if (err < 0) {
>> +		drm_dbg(&xe->drm, "Can't allocate unique MSI-X to exec queue (%d)\n", err);
>> +		return err;
>> +	}
>> +
>> +	q->msix_vec = msix;
>> +
>> +	return 0;
>> +}
>> +
>> +static void xe_exec_queue_msix_fini(struct xe_exec_queue *q)
>> +{
>> +	struct xe_device *xe = gt_to_xe(q->gt);
>> +
>> +	if (!xe_device_has_msix(xe))
>> +		return;
>> +
>> +	if (q->msix_vec && q->msix_vec != XE_IRQ_DEFAULT_MSIX)
>> +		xe_irq_msix_free_irq(xe, q->msix_vec);
>> +}
>> +
>>  static void __xe_exec_queue_free(struct xe_exec_queue *q)
>>  {
>> +	xe_exec_queue_msix_fini(q);
>> +
>>  	if (q->vm)
>>  		xe_vm_put(q->vm);
>>
>> @@ -69,7 +108,12 @@ static struct xe_exec_queue *__xe_exec_queue_alloc(struct xe_device *xe,
>>  	q->gt = gt;
>>  	q->class = hwe->class;
>>  	q->width = width;
>> -	q->msix_vec = XE_IRQ_DEFAULT_MSIX;
>> +	err = xe_exec_queue_msix_init(xe, q, flags & EXEC_QUEUE_FLAG_UNIQUE_MSIX);

is it fine to allow any user to starve this resource?

Lucas De Marchi


More information about the Intel-xe mailing list