dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Maíra Canal" <mcanal@igalia.com>
To: Melissa Wen <mwen@igalia.com>,
	Iago Toral Quiroga <itoral@igalia.com>,
	 Jose Maria Casanova Crespo <jmcasanova@igalia.com>,
	 David Airlie <airlied@gmail.com>,
	Simona Vetter <simona@ffwll.ch>
Cc: kernel-dev@igalia.com, dri-devel@lists.freedesktop.org,
	"Maíra Canal" <mcanal@igalia.com>
Subject: [PATCH v2 0/6] drm/v3d: General job locking improvements + race-condition fixes
Date: Fri, 15 Aug 2025 16:58:39 -0300	[thread overview]
Message-ID: <20250815-v3d-queue-lock-v2-0-ce37258ffb53@igalia.com> (raw)

This patch series was initially motivated by a race condition (exposed
in PATCH 4/6) where we lacked synchronization for `job->file` access.
This led to use-after-free issues when a file descriptor was closed
while a job was still running.

However, beyond fixing this specific race, the series introduces
broader improvements to active job management and locking. While PATCH
1/6, 2/6, and 5/6 are primarily code refactors, PATCH 3/6 brings a
significant change to the locking scheme. Previously, all queues shared
the same spinlock, which caused unnecessary contention during high GPU
usage across different queues. PATCH 3/6 allows queues to operate more
independently.

Finally, PATCH 6/6 addresses a similar race condition to PATCH 4/6, but
this time, on the per-file descriptor reset counter.

Best Regards,
- Maíra

---
v1 -> v2:

- Rebase on top of drm-misc-next.
- Link to v1: https://lore.kernel.org/r/20250719-v3d-queue-lock-v1-0-bcc61210f1e5@igalia.com

---
Maíra Canal (6):
      drm/v3d: Store a pointer to `struct v3d_file_priv` inside each job
      drm/v3d: Store the active job inside the queue's state
      drm/v3d: Replace a global spinlock with a per-queue spinlock
      drm/v3d: Address race-condition between per-fd GPU stats and fd release
      drm/v3d: Synchronous operations can't timeout
      drm/v3d: Protect per-fd reset counter against fd release

 drivers/gpu/drm/v3d/v3d_drv.c    | 14 ++++++-
 drivers/gpu/drm/v3d/v3d_drv.h    | 22 ++++-------
 drivers/gpu/drm/v3d/v3d_fence.c  | 11 +++---
 drivers/gpu/drm/v3d/v3d_gem.c    | 10 ++---
 drivers/gpu/drm/v3d/v3d_irq.c    | 68 +++++++++++++-------------------
 drivers/gpu/drm/v3d/v3d_sched.c  | 83 +++++++++++++++++++++-------------------
 drivers/gpu/drm/v3d/v3d_submit.c |  2 +-
 7 files changed, 104 insertions(+), 106 deletions(-)
---
base-commit: f9c67b019bc3c0324ee42c0dbfbb2d55726d751e
change-id: 20250718-v3d-queue-lock-59babfb548bc


             reply	other threads:[~2025-08-15 19:59 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-15 19:58 Maíra Canal [this message]
2025-08-15 19:58 ` [PATCH v2 1/6] drm/v3d: Store a pointer to `struct v3d_file_priv` inside each job Maíra Canal
2025-08-25 19:56   ` Melissa Wen
2025-08-25 20:30     ` Maíra Canal
2025-08-25 20:33       ` Melissa Wen
2025-08-15 19:58 ` [PATCH v2 2/6] drm/v3d: Store the active job inside the queue's state Maíra Canal
2025-08-25 20:23   ` Melissa Wen
2025-08-15 19:58 ` [PATCH v2 3/6] drm/v3d: Replace a global spinlock with a per-queue spinlock Maíra Canal
2025-08-25 19:57   ` Melissa Wen
2025-08-25 20:35     ` Maíra Canal
2025-08-15 19:58 ` [PATCH v2 4/6] drm/v3d: Address race-condition between per-fd GPU stats and fd release Maíra Canal
2025-08-25 20:03   ` Melissa Wen
2025-08-25 20:53     ` Maíra Canal
2025-08-25 23:09       ` Melissa Wen
2025-08-26 12:03         ` Maíra Canal
2025-08-15 19:58 ` [PATCH v2 5/6] drm/v3d: Synchronous operations can't timeout Maíra Canal
2025-08-25 20:31   ` Melissa Wen
2025-08-15 19:58 ` [PATCH v2 6/6] drm/v3d: Protect per-fd reset counter against fd release Maíra Canal
2025-08-25 20:15   ` Melissa Wen
2025-08-25 20:50     ` Maíra Canal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250815-v3d-queue-lock-v2-0-ce37258ffb53@igalia.com \
    --to=mcanal@igalia.com \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=itoral@igalia.com \
    --cc=jmcasanova@igalia.com \
    --cc=kernel-dev@igalia.com \
    --cc=mwen@igalia.com \
    --cc=simona@ffwll.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).