From: sashiko-bot@kernel.org
To: "Jonathan Cavitt" <jonathan.cavitt@intel.com>
Cc: intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v6 2/2] drm/xe/vm: Add srcid to xe_vm_get_property_ioctl fault report
Date: Wed, 02 Sep 2026 21:37:13 +0000 [thread overview]
Message-ID: <20260902213713.725041F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260902212549.347805-3-jonathan.cavitt@intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Logical OR (`||`) is incorrectly used instead of bitwise OR (`|`) when squashing ASID and SRCID into `pf.consumer.id`, corrupting both values.
--
commit 307b4c2649f6f7d7b3a698b8e497542ed1a82f2f
Author: Jonathan Cavitt <jonathan.cavitt@intel.com>
drm/xe/vm: Add srcid to xe_vm_get_property_ioctl fault report
This commit adds the SRCID of the faulting hardware unit to the return
of the xe_vm_get_property_ioctl fault report.
> diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
> index 19b3d0be79282..753a5fc55baa0 100644
> --- a/drivers/gpu/drm/xe/xe_vm.c
> +++ b/drivers/gpu/drm/xe/xe_vm.c
> @@ -655,6 +655,7 @@ void xe_vm_add_fault_entry_pf(struct xe_vm *vm, struct xe_pagefault *pf)
> pf->consumer.fault_type_level);
> e->fault_level = FIELD_GET(XE_PAGEFAULT_LEVEL_MASK,
> pf->consumer.fault_type_level);
> + e->srcid = FIELD_GET(XE_PAGEFAULT_SRCID_MASK, pf->consumer.id);
[Severity: High]
Will this always read a zero SRCID due to a logical OR in
xe_guc_pagefault_handler()?
When squashing ASID and SRCID into pf.consumer.id, the code uses a logical OR
(||) instead of a bitwise OR (|):
drivers/gpu/drm/xe/xe_guc_pagefault.c:xe_guc_pagefault_handler() {
...
pf.consumer.id = FIELD_PREP(XE_PAGEFAULT_ASID_MASK,
FIELD_GET(PFD_ASID, msg[1])) ||
FIELD_PREP(XE_PAGEFAULT_SRCID_MASK,
FIELD_GET(PFD_SRC_ID, msg[0]));
...
}
Because the logical OR evaluates to a boolean (0 or 1), the actual bitmasks
are destroyed. This means FIELD_GET(XE_PAGEFAULT_SRCID_MASK, pf->consumer.id)
will always evaluate to 0 here. Additionally, this silently corrupts the ASID
to 0 or 1, which may cause xe_pagefault_asid_to_vm() to look up the wrong VM
or fail entirely.
Could the logical OR (||) in xe_guc_pagefault_handler() be replaced with a
bitwise OR (|) to prevent this data loss?
>
> list_add_tail(&e->list, &vm->faults.list);
> vm->faults.len++;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260902212549.347805-1-jonathan.cavitt@intel.com?part=2
prev parent reply other threads:[~2026-09-02 21:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-02 21:25 [PATCH v6 0/2] drm/xe/pagefault: Add SRCID to pagefault reporting Jonathan Cavitt
2026-09-02 21:25 ` [PATCH v6 1/2] drm/xe/pagefault: Add SRCID to pagefault struct Jonathan Cavitt
2026-09-02 21:44 ` sashiko-bot
2026-09-02 21:25 ` [PATCH v6 2/2] drm/xe/vm: Add srcid to xe_vm_get_property_ioctl fault report Jonathan Cavitt
2026-09-02 21:37 ` sashiko-bot [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=20260902213713.725041F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=jonathan.cavitt@intel.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