From: sashiko-bot@kernel.org
To: "Honglei Huang" <honghuan@amd.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v9 1/5] drm/gpusvm: split MM state flags out of drm_gpusvm_pages_flags
Date: Tue, 30 Jun 2026 08:46:16 +0000 [thread overview]
Message-ID: <20260630084616.F251D1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260630083307.381909-2-honghuan@amd.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Missing READ_ONCE() when reading the lockless bitfield `migrate_devmem` in `xe_svm_alloc_vram()` causes a data race.
--
commit e500b2422f5c84b340b191071b2b62f1ff1b58ca
Author: Honglei Huang <honghuan@amd.com>
drm/gpusvm: split MM state flags out of drm_gpusvm_pages_flags
This commit splits MM state flags from drm_gpusvm_pages_flags into a new
drm_gpusvm_range_flags structure. It introduces a union with a __flags
member to allow WRITE_ONCE and READ_ONCE for lockless readers, aiming
to keep concurrent bitfield access data-race free.
Link: https://gitlab.freedesktop.org/mbrost/xe-kernel-driver-svn-perf-6-15-2025/-/commit/623f6a50c037d9e44f6c9fbe6859a0ba7ad50177
> diff --git a/drivers/gpu/drm/xe/xe_svm.c b/drivers/gpu/drm/xe/xe_svm.c
> --- a/drivers/gpu/drm/xe/xe_svm.c
> +++ b/drivers/gpu/drm/xe/xe_svm.c
[ ... ]
> @@ -1621,7 +1629,7 @@ int xe_svm_alloc_vram(struct xe_svm_range *range, const struct drm_gpusvm_ctx *c
> int err, retries = 1;
> bool write_locked = false;
>
> - xe_assert(range_to_vm(&range->base)->xe, range->base.pages.flags.migrate_devmem);
> + xe_assert(range_to_vm(&range->base)->xe, range->base.flags.migrate_devmem);
[Severity: Medium]
Does this plain bitfield read trigger a KCSAN data race warning?
The commit message states that lockless readers should use READ_ONCE() on
the __flags member. However, xe_svm_alloc_vram() reads the migrate_devmem
bitfield directly without holding the notifier_lock.
Since drm_gpusvm_range_set_unmapped() modifies this overlapping memory using
WRITE_ONCE(range->flags.__flags, range_flags.__flags), could this concurrent
access trigger KCSAN warnings and violate the intended data-race free design?
> range_debug(range, "ALLOCATE VRAM");
>
> migration_state = drm_gpusvm_scan_mm(&range->base,
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260630083307.381909-1-honghuan@amd.com?part=1
next prev parent reply other threads:[~2026-06-30 8:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-30 8:33 [PATCH v9 0/5] drm/gpusvm: split MM and device state across gpusvm/range/pages Honglei Huang
2026-06-30 8:33 ` [PATCH v9 1/5] drm/gpusvm: split MM state flags out of drm_gpusvm_pages_flags Honglei Huang
2026-06-30 8:46 ` sashiko-bot [this message]
2026-06-30 8:33 ` [PATCH v9 2/5] drm/gpusvm: embed struct drm_device into drm_gpusvm_pages Honglei Huang
2026-06-30 8:33 ` [PATCH v9 3/5] drm/xe: have xe_svm_range embed one drm_gpusvm_pages Honglei Huang
2026-06-30 8:54 ` sashiko-bot
2026-06-30 8:33 ` [PATCH v9 4/5] drm/gpusvm: move struct drm_gpusvm_pages out of struct drm_gpusvm_range Honglei Huang
2026-06-30 10:48 ` sashiko-bot
2026-06-30 8:33 ` [PATCH v9 5/5] drm/gpusvm: let the drm_gpusvm core context purely MM level Honglei Huang
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=20260630084616.F251D1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=honghuan@amd.com \
--cc=sashiko-reviews@lists.linux.dev \
/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