mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: Marco Crivellari <marco.crivellari@suse.com>
Cc: <linux-kernel@vger.kernel.org>, <intel-xe@lists.freedesktop.org>,
	<dri-devel@lists.freedesktop.org>, Tejun Heo <tj@kernel.org>,
	Lai Jiangshan <jiangshanlai@gmail.com>,
	Frederic Weisbecker <frederic@kernel.org>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Michal Hocko <mhocko@suse.com>,
	Lucas De Marchi <lucas.demarchi@intel.com>,
	"Thomas Hellstrom" <thomas.hellstrom@linux.intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>
Subject: Re: [PATCH] drm/xe: Replace use of system_wq with system_percpu_wq
Date: Tue, 30 Dec 2025 18:25:00 -0800	[thread overview]
Message-ID: <aVSJfKkE0SiKrPDz@lstrano-desk.jf.intel.com> (raw)
In-Reply-To: <CAAofZF7H_sPKh=oG7C=fN-mtevZjZ038DjOL0rwDVuOib9p4Dw@mail.gmail.com>

On Tue, Dec 30, 2025 at 04:42:51PM +0100, Marco Crivellari wrote:
> On Wed, Dec 24, 2025 at 7:28 PM Matthew Brost <matthew.brost@intel.com> wrote:
> > [...]
> > >  drivers/gpu/drm/xe/xe_tlb_inval.c | 6 +++---
> > >  1 file changed, 3 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/xe/xe_tlb_inval.c b/drivers/gpu/drm/xe/xe_tlb_inval.c
> > > index 918a59e686ea..b2cf6e17fbc5 100644
> > > --- a/drivers/gpu/drm/xe/xe_tlb_inval.c
> > > +++ b/drivers/gpu/drm/xe/xe_tlb_inval.c
> > > @@ -94,7 +94,7 @@ static void xe_tlb_inval_fence_timeout(struct work_struct *work)
> > >               xe_tlb_inval_fence_signal(fence);
> > >       }
> > >       if (!list_empty(&tlb_inval->pending_fences))
> > > -             queue_delayed_work(system_wq, &tlb_inval->fence_tdr,
> > > +             queue_delayed_work(system_percpu_wq, &tlb_inval->fence_tdr,
> >
> > Actually system_wq or system_percpu_wq doesn't work here as this is the
> > fence signaling path. We should use one Xe's ordered work queues which
> > is properly setup to be reclaim same.
> 
> Hi,
> 
> So only for this specific workqueue we should use for example this, instead:
> 
> 462     /** @ordered_wq: used to serialize compute mode resume */
> 463     struct workqueue_struct *ordered_wq;
> 
> I noticed this has been allocated using:
> 
>  490     xe->ordered_wq = alloc_ordered_workqueue("xe-ordered-wq", 0);
> 
> Using alloc_ordered_workqueue() makes this workqueue to be unbound.
> 
> 569 #define alloc_ordered_workqueue(fmt, flags, args...)            \
> 570     alloc_workqueue(fmt, WQ_UNBOUND | __WQ_ORDERED | (flags), 1, ##args)
> 
> So this patch should be split in 2:
> - 1 patch with Xe's ordered workqueue, changing the behavior to
> unbound "implicitly"
> - 1 patch changing system_wq with the new per-cpu wq (system_percpu_wq).
> 
> To keep this workqueue per-cpu we can use xe->unordered_wq, that makes use of
> alloc_workqueue() without specifying flags (eg. WQ_UNBOUND or the new
> WQ_PERCPU),
> making this workqueue per-cpu.
> 
> Would this sound reasonable to you?
> 

What I'd probably do here is store a WQ pointer in 'struct
xe_tlb_inval' and update all calls in xe_tlb_inval to use that work
queue.

Since these are tied to a GT currently - see xe_gt_tlb_inval_init_early,
I'd set the WQ pointer in 'struct xe_tlb_inval' to 'gt->ordered_wq'.
'gt->ordered_wq' is the per-GT WQ for resets, jobs timeouts, VF
migrations (all operations in reclaim path), so this seems to fit here
as well.

Matt

> Thanks!
> -- 
> 
> Marco Crivellari
> 
> L3 Support Engineer

  reply	other threads:[~2025-12-31  2:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-24 16:00 Marco Crivellari
2025-12-24 18:28 ` Matthew Brost
2025-12-30 15:42   ` Marco Crivellari
2025-12-31  2:25     ` Matthew Brost [this message]
2026-01-07  9:04       ` Marco Crivellari

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=aVSJfKkE0SiKrPDz@lstrano-desk.jf.intel.com \
    --to=matthew.brost@intel.com \
    --cc=airlied@gmail.com \
    --cc=bigeasy@linutronix.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=frederic@kernel.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jiangshanlai@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lucas.demarchi@intel.com \
    --cc=marco.crivellari@suse.com \
    --cc=mhocko@suse.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=simona@ffwll.ch \
    --cc=thomas.hellstrom@linux.intel.com \
    --cc=tj@kernel.org \
    /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

all inboxes | Powered by JetHome®