Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Lahtinen, Joonas" <joonas.lahtinen@intel.com>
To: "joonas.lahtinen@linux.intel.com"
	<joonas.lahtinen@linux.intel.com>,
	"Upadhyay, Tejas" <tejas.upadhyay@intel.com>,
	"De Marchi, Lucas" <lucas.demarchi@intel.com>
Cc: "intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>,
	"Brost,  Matthew" <matthew.brost@intel.com>,
	"Kumar, Janga Rahul" <janga.rahul.kumar@intel.com>,
	"andi.shyti@linux.intel.com" <andi.shyti@linux.intel.com>
Subject: Re: [PATCH] [RFC]drm/xe: Introduce active ccs tracking
Date: Mon, 23 Sep 2024 06:52:43 +0000	[thread overview]
Message-ID: <0ffcb1dfeff83970d753a6dc68e973e5b8f7584a.camel@intel.com> (raw)
In-Reply-To: <wscurb6v4mzxoitxpb2mqr3olgpp5sahqssq3s6izccbl2mq43@eq2yo7txrv4m>

(Adding Andi, Swapping to my @linux.intel.com address)

On Fri, 2024-09-20 at 08:54 -0500, Lucas De Marchi wrote:
> On Fri, Sep 20, 2024 at 07:05:14PM GMT, Tejas Upadhyay wrote:
> > Current ccs_mode setting is allowed when no client has
> > actively opened device. Instead it should be restricted
> > if there is any active ccs engine in use.
> > 
> > Closing device fd is always a async and may lead to show
> > client present even after fd is closed from user perspective.
> > 
> > Signed-off-by: Tejas Upadhyay <tejas.upadhyay@intel.com>

<SNIP>

> > +++ b/drivers/gpu/drm/xe/xe_gt_ccs_mode.c
> > @@ -69,6 +69,7 @@ static void __xe_gt_apply_ccs_mode(struct xe_gt
> > *gt, u32 num_engines)
> > 	}
> > 
> > 	xe_mmio_write32(&gt->mmio, CCS_MODE, mode);
> > +	gt->ccs_active = mode;
> > 
> > 	xe_gt_dbg(gt, "CCS_MODE=%x config:%08x, num_engines:%d,
> > num_slices:%d\n",
> > 		  mode, config, num_engines, num_slices);
> > @@ -132,10 +133,9 @@ ccs_mode_store(struct device *kdev, struct
> > device_attribute *attr,
> > 		return -EINVAL;
> > 	}
> > 
> > -	/* CCS mode can only be updated when there are no drm
> > clients */
> > -	spin_lock(&xe->clients.lock);
> > -	if (xe->clients.count) {
> > -		spin_unlock(&xe->clients.lock);
> > +	/* CCS mode can only be updated when there is no active
> > ccs_mode */
> 
> same question as before:  what happens if userspace cached the available
> engines from a query (like it normally does) and then decide to submit
> later?

How this was handled in downstream for PVC was that different clients
did have a different view of the hardware, and there is an indefinite
wait loop at batchbuffer submission time until the hardware is in the
right mode. It was based on first come first serve (until yielding).

It was specifically decided that for upstream we want a sysfs or
modparam to explicitly choose the mode for all clients for i915 and xe.

> CCS being idle doesn't mean we can change it. I think what we
> really want is to track the userspace clients (i.e. ignore kernel
> clients since those don't do anything with CCS, but probably add an
> assert somewhere to guarantee it).

Right, the in-kernel clients indeed need to be excluded. I thought that
was already solved problem in Andi's series for i915?

> AFAIK it's not expected from umd point of view to have dynamic
> changes on available engines. +Joonas, +Matthew Brost

Correct. While this can be partially hacked around, it leads to
multiple ugly corner cases and some workloads even simply not working
when they execute with less EUs than expected (when CCS_MODE = 2, but
client expects CCS_MODE = 1 so it only gets 50% of EUs).

So we should stick to sysfs or modparam. Sysfs has the benefit that
compute workloads can change the mode before starting, modparam will of
course be simpler.

Regards, Joonas

> 
> Lucas De Marchi


  parent reply	other threads:[~2024-09-23  6:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-20 13:35 [PATCH] [RFC]drm/xe: Introduce active ccs tracking Tejas Upadhyay
2024-09-20 13:54 ` Lucas De Marchi
2024-09-21  0:27   ` Matthew Brost
2024-09-23  6:52   ` Lahtinen, Joonas [this message]
2024-09-20 14:01 ` ✓ CI.Patch_applied: success for drm/xe: " Patchwork
2024-09-20 14:02 ` ✓ CI.checkpatch: " Patchwork
2024-09-20 14:03 ` ✓ CI.KUnit: " Patchwork
2024-09-20 14:15 ` ✓ CI.Build: " Patchwork
2024-09-20 14:17 ` ✓ CI.Hooks: " Patchwork
2024-09-20 14:19 ` ✓ CI.checksparse: " Patchwork
2024-09-20 14:37 ` ✓ CI.BAT: " Patchwork
2024-09-20 19:36 ` ✗ CI.FULL: failure " 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=0ffcb1dfeff83970d753a6dc68e973e5b8f7584a.camel@intel.com \
    --to=joonas.lahtinen@intel.com \
    --cc=andi.shyti@linux.intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=janga.rahul.kumar@intel.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=lucas.demarchi@intel.com \
    --cc=matthew.brost@intel.com \
    --cc=tejas.upadhyay@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