From: Matthew Brost <matthew.brost@intel.com>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 2/2] drm/xe: Remove redundant full pagefault queue check
Date: Tue, 11 Aug 2026 16:27:31 -0700 [thread overview]
Message-ID: <anuv40Vzbfe7pPwJ@gsse-cloud1.jf.intel.com> (raw)
In-Reply-To: <20260811200906.10400-3-michal.wajdeczko@intel.com>
On Tue, Aug 11, 2026 at 10:09:05PM +0200, Michal Wajdeczko wrote:
> There is no need to check the queue inside the pagefault handler
> as it is immediately checked later by the xe_pagefault_queue_add()
> function and we can just look for the NULL lpf entry. There will
> be also already a full WARN triggered, so no need keep drm_warn().
>
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
> ---
> drivers/gpu/drm/xe/xe_pagefault.c | 45 +++++++++++++------------------
> 1 file changed, 18 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_pagefault.c b/drivers/gpu/drm/xe/xe_pagefault.c
> index cfb65621baec..7e829c61387f 100644
> --- a/drivers/gpu/drm/xe/xe_pagefault.c
> +++ b/drivers/gpu/drm/xe/xe_pagefault.c
> @@ -864,41 +864,32 @@ static int xe_pagefault_work_index(struct xe_device *xe)
> int xe_pagefault_handler(struct xe_device *xe, struct xe_pagefault *pf)
> {
> struct xe_pagefault_queue *pf_queue = &xe->usm.pf_queue;
> - bool full;
> + struct xe_pagefault *lpf;
> + bool empty;
>
> guard(spinlock_irqsave)(&pf_queue->lock);
> - full = xe_pagefault_queue_full(pf_queue);
> - if (!full) {
> - struct xe_pagefault *lpf;
> - bool empty = xe_pagefault_queue_empty(pf_queue);
>
> - lpf = xe_pagefault_queue_add(pf_queue, pf);
> - if (lpf) {
> - lpf->consumer.next = NULL;
> + empty = xe_pagefault_queue_empty(pf_queue);
> + lpf = xe_pagefault_queue_add(pf_queue, pf);
> + if (!lpf)
> + return -ENOSPC;
>
> - if (xe_pagefault_try_chain(pf_queue, lpf)) {
> - xe_gt_stats_incr(pf->gt,
> - XE_GT_STATS_ID_CHAIN_IRQ_PAGEFAULT_COUNT,
> - 1);
> - if (empty) {
> - xe_gt_stats_incr(pf->gt,
> - XE_GT_STATS_ID_CHAIN_DRAIN_IRQ_PAGEFAULT_COUNT,
> - 1);
> - xe_pagefault_queue_advance(pf_queue);
> - }
> - } else {
> - int work_index = xe_pagefault_work_index(xe);
> -
> - queue_work(xe->usm.pagefault_wq,
> - &xe->usm.pf_workers[work_index].work);
> - }
> + lpf->consumer.next = NULL;
> + if (xe_pagefault_try_chain(pf_queue, lpf)) {
> + xe_gt_stats_incr(pf->gt, XE_GT_STATS_ID_CHAIN_IRQ_PAGEFAULT_COUNT, 1);
> + if (empty) {
> + xe_gt_stats_incr(pf->gt,
> + XE_GT_STATS_ID_CHAIN_DRAIN_IRQ_PAGEFAULT_COUNT, 1);
> + xe_pagefault_queue_advance(pf_queue);
> }
> } else {
> - drm_warn(&xe->drm,
> - "PageFault Queue full, shouldn't be possible\n");
> + int work_index = xe_pagefault_work_index(xe);
> +
> + queue_work(xe->usm.pagefault_wq,
> + &xe->usm.pf_workers[work_index].work);
> }
>
> - return full ? -ENOSPC : 0;
> + return 0;
> }
>
> /**
> --
> 2.47.1
>
next prev parent reply other threads:[~2026-08-11 23:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-11 20:09 [PATCH 0/2] drm/xe: small pagefault handler improvements Michal Wajdeczko
2026-08-11 20:09 ` [PATCH 1/2] drm/xe: Use guard(spinlock_irqsave) in pagefault handler Michal Wajdeczko
2026-08-11 23:26 ` Matthew Brost
2026-08-11 20:09 ` [PATCH 2/2] drm/xe: Remove redundant full pagefault queue check Michal Wajdeczko
2026-08-11 23:27 ` Matthew Brost [this message]
2026-08-11 20:20 ` ✓ CI.KUnit: success for drm/xe: small pagefault handler improvements Patchwork
2026-08-11 21:32 ` ✓ Xe.CI.BAT: " Patchwork
2026-08-11 23:58 ` ✓ Xe.CI.FULL: " Patchwork
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=anuv40Vzbfe7pPwJ@gsse-cloud1.jf.intel.com \
--to=matthew.brost@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=michal.wajdeczko@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox