* Re: [PATCH] drm/syncobj: Fix xa_alloc allocation flags
2026-03-24 11:10 [PATCH] drm/syncobj: Fix xa_alloc allocation flags Tvrtko Ursulin
@ 2026-03-24 11:12 ` Thomas Hellström
2026-03-24 11:27 ` Girotra, Himanshu
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Thomas Hellström @ 2026-03-24 11:12 UTC (permalink / raw)
To: Tvrtko Ursulin, intel-xe, dri-devel; +Cc: Himanshu Girotra, Matthew Brost
On Tue, 2026-03-24 at 11:10 +0000, Tvrtko Ursulin wrote:
> The xarray conversion blindly and wrongly replaced idr_alloc with
> xa_alloc
> and kept the GFP_NOWAIT. It should have been GFP_KERNEL to account
> for
> idr_preload it removed. Fix it.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
> Fixes: fec2c3c01f1c ("drm/syncobj: Convert syncobj idr to xarray")
> Reported-by: Himanshu Girotra <himanshu.girotra@intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> ---
> drivers/gpu/drm/drm_syncobj.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_syncobj.c
> b/drivers/gpu/drm/drm_syncobj.c
> index 250734dee928..8d9fd1917c6e 100644
> --- a/drivers/gpu/drm/drm_syncobj.c
> +++ b/drivers/gpu/drm/drm_syncobj.c
> @@ -602,7 +602,7 @@ int drm_syncobj_get_handle(struct drm_file
> *file_private,
> drm_syncobj_get(syncobj);
>
> ret = xa_alloc(&file_private->syncobj_xa, handle, syncobj,
> xa_limit_32b,
> - GFP_NOWAIT);
> + GFP_KERNEL);
> if (ret)
> drm_syncobj_put(syncobj);
>
> @@ -716,7 +716,7 @@ static int drm_syncobj_fd_to_handle(struct
> drm_file *file_private,
> drm_syncobj_get(syncobj);
>
> ret = xa_alloc(&file_private->syncobj_xa, handle, syncobj,
> xa_limit_32b,
> - GFP_NOWAIT);
> + GFP_KERNEL);
> if (ret)
> drm_syncobj_put(syncobj);
>
^ permalink raw reply [flat|nested] 5+ messages in thread* RE: [PATCH] drm/syncobj: Fix xa_alloc allocation flags
2026-03-24 11:10 [PATCH] drm/syncobj: Fix xa_alloc allocation flags Tvrtko Ursulin
2026-03-24 11:12 ` Thomas Hellström
@ 2026-03-24 11:27 ` Girotra, Himanshu
2026-03-24 20:54 ` Claude review: " Claude Code Review Bot
2026-03-24 20:54 ` Claude Code Review Bot
3 siblings, 0 replies; 5+ messages in thread
From: Girotra, Himanshu @ 2026-03-24 11:27 UTC (permalink / raw)
To: Tvrtko Ursulin, intel-xe@lists.freedesktop.org,
dri-devel@lists.freedesktop.org
Cc: Brost, Matthew, Thomas Hellström
> -----Original Message-----
> From: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
> Sent: 24 March 2026 16:40
> To: intel-xe@lists.freedesktop.org; dri-devel@lists.freedesktop.org
> Cc: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>; Girotra, Himanshu
> <himanshu.girotra@intel.com>; Brost, Matthew <matthew.brost@intel.com>;
> Thomas Hellström <thomas.hellstrom@linux.intel.com>
> Subject: [PATCH] drm/syncobj: Fix xa_alloc allocation flags
>
> The xarray conversion blindly and wrongly replaced idr_alloc with xa_alloc and
> kept the GFP_NOWAIT. It should have been GFP_KERNEL to account for
> idr_preload it removed. Fix it.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
> Fixes: fec2c3c01f1c ("drm/syncobj: Convert syncobj idr to xarray")
> Reported-by: Himanshu Girotra <himanshu.girotra@intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Himanshu Girotra <himanshu.girotra@intel.com>
> ---
> drivers/gpu/drm/drm_syncobj.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
> index 250734dee928..8d9fd1917c6e 100644
> --- a/drivers/gpu/drm/drm_syncobj.c
> +++ b/drivers/gpu/drm/drm_syncobj.c
> @@ -602,7 +602,7 @@ int drm_syncobj_get_handle(struct drm_file
> *file_private,
> drm_syncobj_get(syncobj);
>
> ret = xa_alloc(&file_private->syncobj_xa, handle, syncobj,
> xa_limit_32b,
> - GFP_NOWAIT);
> + GFP_KERNEL);
> if (ret)
> drm_syncobj_put(syncobj);
>
> @@ -716,7 +716,7 @@ static int drm_syncobj_fd_to_handle(struct drm_file
> *file_private,
> drm_syncobj_get(syncobj);
>
> ret = xa_alloc(&file_private->syncobj_xa, handle, syncobj,
> xa_limit_32b,
> - GFP_NOWAIT);
> + GFP_KERNEL);
> if (ret)
> drm_syncobj_put(syncobj);
>
> --
> 2.52.0
^ permalink raw reply [flat|nested] 5+ messages in thread* Claude review: drm/syncobj: Fix xa_alloc allocation flags
2026-03-24 11:10 [PATCH] drm/syncobj: Fix xa_alloc allocation flags Tvrtko Ursulin
2026-03-24 11:12 ` Thomas Hellström
2026-03-24 11:27 ` Girotra, Himanshu
@ 2026-03-24 20:54 ` Claude Code Review Bot
2026-03-24 20:54 ` Claude Code Review Bot
3 siblings, 0 replies; 5+ messages in thread
From: Claude Code Review Bot @ 2026-03-24 20:54 UTC (permalink / raw)
To: dri-devel-reviews
Overall Series Review
Subject: drm/syncobj: Fix xa_alloc allocation flags
Author: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Patches: 3
Reviewed: 2026-03-25T06:54:12.925532
---
This is a single-patch fix for an incorrect GFP allocation flag in `drm_syncobj.c`. The analysis is correct and the fix is straightforward. When the IDR-to-xarray conversion was done (commit `fec2c3c01f1c`), the old pattern was `idr_preload(GFP_KERNEL)` followed by `idr_alloc(..., GFP_NOWAIT)`. The preload did the actual memory allocation with `GFP_KERNEL` (which can sleep), while the `idr_alloc` just used a pre-allocated node. When converting to `xa_alloc`, the `idr_preload` was correctly removed, but the `GFP_NOWAIT` was incorrectly preserved — `xa_alloc` does its own allocation inline, so it needs `GFP_KERNEL` to be able to sleep and retry allocations.
The fix looks correct and complete.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 5+ messages in thread
* Claude review: drm/syncobj: Fix xa_alloc allocation flags
2026-03-24 11:10 [PATCH] drm/syncobj: Fix xa_alloc allocation flags Tvrtko Ursulin
` (2 preceding siblings ...)
2026-03-24 20:54 ` Claude review: " Claude Code Review Bot
@ 2026-03-24 20:54 ` Claude Code Review Bot
3 siblings, 0 replies; 5+ messages in thread
From: Claude Code Review Bot @ 2026-03-24 20:54 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
**Correctness: Good.** Both call sites (`drm_syncobj_get_handle` at line 604 and `drm_syncobj_fd_to_handle` at line 718) are in process/ioctl context with no spinlocks held, so `GFP_KERNEL` is safe to use.
The commit message clearly explains the rationale: `idr_preload(GFP_KERNEL)` + `idr_alloc(..., GFP_NOWAIT)` was a standard IDR pattern where preload pre-allocated memory allowing the subsequent alloc to use `GFP_NOWAIT`. The xarray conversion removed `idr_preload` but kept `GFP_NOWAIT`, meaning `xa_alloc` could fail under memory pressure where the old code would have succeeded.
**Tags:** The `Fixes:` tag correctly references the commit that introduced the regression. `Reported-by` and `Cc` tags are present.
**Minor nit:** The `Fixes:` tag is placed after `Signed-off-by:`, which is unconventional — it's more common to place `Fixes:` before `Signed-off-by:`. This is a stylistic preference and doesn't affect anything functionally.
**No issues found.** The patch is clean, minimal, and correct.
**Reviewed-by worthy:** Yes.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 5+ messages in thread