[bug report] drm/xe/pxp: Add PXP queue tracking and session start
Dan Carpenter
dan.carpenter at linaro.org
Thu Feb 6 08:15:51 UTC 2025
Hello Daniele Ceraolo Spurio,
Commit f8caa80154c4 ("drm/xe/pxp: Add PXP queue tracking and session
start") from Jan 29, 2025 (linux-next), leads to the following Smatch
static checker warning:
drivers/gpu/drm/xe/xe_vm.c:286 xe_vm_remove_compute_exec_queue()
warn: sleeping in atomic context
drivers/gpu/drm/xe/xe_vm.c
281 void xe_vm_remove_compute_exec_queue(struct xe_vm *vm, struct xe_exec_queue *q)
282 {
283 if (!xe_vm_in_preempt_fence_mode(vm))
284 return;
285
--> 286 down_write(&vm->lock);
287 if (!list_empty(&q->lr.link)) {
288 list_del_init(&q->lr.link);
289 --vm->preempt.num_exec_queues;
290 }
291 if (q->lr.pfence) {
292 dma_fence_enable_sw_signaling(q->lr.pfence);
293 dma_fence_put(q->lr.pfence);
294 q->lr.pfence = NULL;
295 }
296 up_write(&vm->lock);
297 }
pxp_invalidate_queues() <- disables preempt
-> xe_exec_queue_kill()
-> xe_vm_remove_compute_exec_queue()
drivers/gpu/drm/xe/xe_pxp.c
699 static void pxp_invalidate_queues(struct xe_pxp *pxp)
700 {
701 struct xe_exec_queue *tmp, *q;
702
703 spin_lock_irq(&pxp->queues.lock);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
704
705 /*
706 * Removing a queue from the PXP list requires a put of the RPM ref that
707 * the queue holds to keep the PXP session alive, which can't be done
708 * under spinlock. Since it is safe to kill a queue multiple times, we
709 * can leave the invalid queue in the list for now and postpone the
710 * removal and associated RPM put to when the queue is destroyed.
711 */
712 list_for_each_entry(tmp, &pxp->queues.list, pxp.link) {
713 q = xe_exec_queue_get_unless_zero(tmp);
714
715 if (!q)
716 continue;
717
718 xe_exec_queue_kill(q);
We can't call xe_exec_queue_kill() while holding a spin_lock.
719 xe_exec_queue_put(q);
720 }
721
722 spin_unlock_irq(&pxp->queues.lock);
723 }
regards,
dan carpenter
More information about the Intel-xe
mailing list