dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Srinivasan Shanmugam" <srinivasan.shanmugam@amd.com>
Cc: dri-devel@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v8 2/3] drm: Add drm_user_fence helper
Date: Tue, 08 Sep 2026 08:58:09 +0000	[thread overview]
Message-ID: <20260908085809.8F0001F01559@smtp.kernel.org> (raw)
In-Reply-To: <20260908084627.352535-3-srinivasan.shanmugam@amd.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Unconditional use of mmput_async() breaks compilation and linking on NOMMU configurations.
--

commit 890c55fa04660dfbfe7364ac5c78b52162fca15b
Author: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>

drm: Add drm_user_fence helper

This commit introduces a common DRM user fence helper providing a
kref-managed, MM-borrowing dma-fence-callback-to-workqueue pattern.
It is used by drivers that must access userspace memory from a kthread
context when a GPU fence signals.

> diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> index 8895ca0476d89..3557e6a8d31c9 100644
> --- a/drivers/gpu/drm/Makefile
> +++ b/drivers/gpu/drm/Makefile
> @@ -69,6 +69,7 @@ drm-y := \
>  	drm_syncobj.o \
>  	drm_sysfs.o \
>  	drm_trace_points.o \
> +	drm_user_fence.o \
>  	drm_vblank.o \

[ ... ]

> diff --git a/drivers/gpu/drm/drm_user_fence.c b/drivers/gpu/drm/drm_user_fence.c
> new file mode 100644
> index 0000000000000..f7882208a8b73
> --- /dev/null
> +++ b/drivers/gpu/drm/drm_user_fence.c

[ ... ]

> +static void drm_user_fence_do_work(struct drm_work_fence *wfence)
> +{
> +	struct drm_user_fence *ufence =
> +		container_of(wfence, struct drm_user_fence, base);
> +	struct mm_struct *mm = NULL;
> +
> +	if (mmget_not_zero(ufence->mm)) {
> +		mm = ufence->mm;
> +		kthread_use_mm(mm);
> +	}
> +
> +	ufence->ops->writeback(ufence, !!mm);
> +
> +	if (mm) {
> +		kthread_unuse_mm(mm);
> +		mmput_async(mm);	/* requires CONFIG_MMU — GPU requires MMU */

[Severity: Low]
Does this unconditional call to mmput_async() break the build on systems
without CONFIG_MMU?

While the comment notes that the GPU requires an MMU, the drm_user_fence.o
file is added unconditionally to the core DRM build in
drivers/gpu/drm/Makefile. If the kernel is built with CONFIG_DRM enabled
but CONFIG_MMU disabled, this will result in an implicit function
declaration and an undefined reference to mmput_async() during linking.

> +	}
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260908084627.352535-1-srinivasan.shanmugam@amd.com?part=2

  reply	other threads:[~2026-09-08  8:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-08  8:46 [PATCH v8 0/3] drm: Extract dma-fence-to-workqueue pattern into common helpers Srinivasan Shanmugam
2026-09-08  8:46 ` [PATCH v8 1/3] drm: Add drm_work_fence helper Srinivasan Shanmugam
2026-09-08  8:58   ` sashiko-bot
2026-09-08 20:16     ` Matthew Brost
2026-09-09  3:00       ` SRINIVASAN SHANMUGAM
2026-09-09  5:20         ` SRINIVASAN SHANMUGAM
2026-09-08  8:46 ` [PATCH v8 2/3] drm: Add drm_user_fence helper Srinivasan Shanmugam
2026-09-08  8:58   ` sashiko-bot [this message]
2026-09-08  8:46 ` [PATCH v8 3/3] drm/xe: Convert xe_user_fence to drm_user_fence Srinivasan Shanmugam
2026-09-08  9:00   ` sashiko-bot
2026-09-08 20:22   ` Matthew Brost
2026-09-09  3:04     ` SRINIVASAN SHANMUGAM

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=20260908085809.8F0001F01559@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=srinivasan.shanmugam@amd.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox