All of lore.kernel.org
 help / color / mirror / Atom feed
From: SRINIVASAN SHANMUGAM <srinivasan.shanmugam@amd.com>
To: matthew.brost@intel.com
Cc: dri-devel@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
	amd-gfx@lists.freedesktop.org,
	"Christian König" <christian.koenig@amd.com>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Thomas Hellström" <thomas.hellstrom@linux.intel.com>
Subject: Re: [PATCH v9 0/3] drm: Extract dma-fence-to-workqueue pattern into common helpers
Date: Tue, 22 Sep 2026 17:00:19 +0530	[thread overview]
Message-ID: <6c4f5c4b-8866-49e9-b693-678236233e8e@amd.com> (raw)
In-Reply-To: <20260909044454.399340-1-srinivasan.shanmugam@amd.com>

[-- Attachment #1: Type: text/plain, Size: 3641 bytes --]

Hi Matt,

Good morning!

Just a gentle follow-up on the remaining race issues in the |drm: Add 
drm_work_fence helper| patch.

After applying the previous fixes in v9 [1], Sashiko found two remaining 
race cases [2].

We are considering |schedule_work()| for the IRQ-context issue and an 
atomic flag for the timing gap around |disable_work_sync()|.

Could you please let us know if these approaches look reasonable before 
we prepare v10?

[1] v9 patch:
https://patchwork.freedesktop.org/patch/751979/?series=173582&rev=2

[2] Sashiko v9 review:
https://sashiko.dev/#/patchset/20260909044454.399340-1-srinivasan.shanmugam%40amd.com

We really appreciate all the time and effort you have put into reviewing 
this serie.

Thanks again,
Srini

On 9/9/2026 10:14 AM, Srinivasan Shanmugam wrote:

> This series extracts the dma-fence-callback-to-workqueue pattern shared
> between XE and AMDGPU into common DRM helpers.
>
> Patch 1 introduces drm_work_fence — a generic helper that queues a work
> item when a dma-fence signals, for work that cannot run in IRQ context.
>
> Patch 2 introduces drm_user_fence — extends drm_work_fence with
> kthread_use_mm() support for drivers that need to write completion
> status to userspace memory.
>
> Patch 3 converts XE's open-coded xe_user_fence to use drm_user_fence.
>
> Note: Patch 4 (per-signal compare functionality for AMDGPU's EOP
> eventfd path) is deferred pending resolution of the compare address
> read method (get_user() vs page-pinning), raised by Matthew Brost.
>
> v9:
> - Fix drm_work_fence_queue: drop ref if queue_work returns false,
>    closing the race between callback firing and queue_work() (Matt)
> - Fix drm_work_fence_cancel_sync: use disable_work_sync() to close
>    the UAF race window between callback and queue_work() (Matt)
> - Remove xe_sync_ufence_cancel_sync — no caller in this patch (Matt)
> - Remove xe_sync_ufence_cancel from xe_vma_destroy_late — unnecessary
>    behaviour change; xe_ufence_worker only accesses device-level
>    resources, safe to run after VMA teardown (Matt)
>
> v8:
> - Fix copyright: The Linux Foundation → Advanced Micro Devices, Inc.
> - Switch EXPORT_SYMBOL_GPL → EXPORT_SYMBOL for MIT-licensed code (Matt)
> - Rename drm_work_fence_ops callback: writeback → worker (Matt)
> - Rename drm_user_fence_ops callback: worker → writeback (Matt)
> - Fix xe_ufence_worker ordering: WRITE_ONCE before copy_to_user,
>    add smp_wmb() before wake_up_all (Matt, confirmed via 8ae04fe9ffc93)
> - Rename .worker → .writeback in xe_ufence_ops (Matt)
> - Drop Patch 4 pending design decision on compare address read method
>
> Suggested-by: Matthew Brost<matthew.brost@intel.com>
> Suggested-by: Christian König<christian.koenig@amd.com>
>
> Srinivasan Shanmugam (3):
>    drm: Add drm_work_fence helper
>    drm: Add drm_user_fence helper
>    drm/xe: Convert xe_user_fence to drm_user_fence
>
>   drivers/gpu/drm/Makefile           |   2 +
>   drivers/gpu/drm/drm_user_fence.c   |  70 +++++++++++
>   drivers/gpu/drm/drm_work_fence.c   | 186 +++++++++++++++++++++++++++++
>   drivers/gpu/drm/xe/xe_sync.c       | 141 +++++++++++-----------
>   drivers/gpu/drm/xe/xe_sync.h       |   1 +
>   drivers/gpu/drm/xe/xe_sync_types.h |   1 -
>   include/drm/drm_user_fence.h       | 123 +++++++++++++++++++
>   include/drm/drm_work_fence.h       |  69 +++++++++++
>   8 files changed, 524 insertions(+), 69 deletions(-)
>   create mode 100644 drivers/gpu/drm/drm_user_fence.c
>   create mode 100644 drivers/gpu/drm/drm_work_fence.c
>   create mode 100644 include/drm/drm_user_fence.h
>   create mode 100644 include/drm/drm_work_fence.h
>

[-- Attachment #2: Type: text/html, Size: 40561 bytes --]

      parent reply	other threads:[~2026-09-22 11:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-09  4:44 [PATCH v9 0/3] drm: Extract dma-fence-to-workqueue pattern into common helpers Srinivasan Shanmugam
2026-09-09  4:44 ` [PATCH v9 1/3] drm: Add drm_work_fence helper Srinivasan Shanmugam
2026-09-09  4:56   ` sashiko-bot
2026-09-09  4:44 ` [PATCH v9 2/3] drm: Add drm_user_fence helper Srinivasan Shanmugam
2026-09-09  4:54   ` sashiko-bot
2026-09-09  4:44 ` [PATCH v9 3/3] drm/xe: Convert xe_user_fence to drm_user_fence Srinivasan Shanmugam
2026-09-09  4:57   ` sashiko-bot
2026-09-09  4:51 ` ✗ CI.checkpatch: warning for drm: Extract dma-fence-to-workqueue pattern into common helpers (rev2) Patchwork
2026-09-09  4:53 ` ✓ CI.KUnit: success " Patchwork
2026-09-09  5:45 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-09 10:49 ` ✓ Xe.CI.FULL: " Patchwork
2026-09-22 11:30 ` SRINIVASAN SHANMUGAM [this message]

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=6c4f5c4b-8866-49e9-b693-678236233e8e@amd.com \
    --to=srinivasan.shanmugam@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@intel.com \
    --cc=thomas.hellstrom@linux.intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.