From: "Souza, Jose" <jose.souza@intel.com>
To: "Roper, Matthew D" <matthew.d.roper@intel.com>
Cc: "intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>,
"Vivi, Rodrigo" <rodrigo.vivi@intel.com>
Subject: Re: [Intel-xe] [PATCH v3 1/3] drm/xe: Store xe_he_engine in xe_hw_engine_snapshot
Date: Thu, 12 Oct 2023 17:20:33 +0000 [thread overview]
Message-ID: <ff3e03acf78dda8cb52bde94de70f89a005596c7.camel@intel.com> (raw)
In-Reply-To: <20231012171628.GH21382@mdroper-desk1.amr.corp.intel.com>
On Thu, 2023-10-12 at 10:16 -0700, Matt Roper wrote:
> On Tue, Oct 10, 2023 at 11:41:49AM -0700, José Roberto de Souza wrote:
> > A future patch will require gt and xe device structs, so here
> > replacing class by hwe.
> >
> > Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > Cc: Matt Roper <matthew.d.roper@intel.com>
> > Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
> > ---
> > drivers/gpu/drm/xe/xe_hw_engine.c | 6 +++---
> > drivers/gpu/drm/xe/xe_hw_engine_types.h | 4 ++--
> > 2 files changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/xe/xe_hw_engine.c b/drivers/gpu/drm/xe/xe_hw_engine.c
> > index b5b0845908887..37b3ee1268090 100644
> > --- a/drivers/gpu/drm/xe/xe_hw_engine.c
> > +++ b/drivers/gpu/drm/xe/xe_hw_engine.c
> > @@ -684,7 +684,7 @@ xe_hw_engine_snapshot_capture(struct xe_hw_engine *hwe)
> > if (snapshot->name)
> > strscpy(snapshot->name, hwe->name, len);
> >
> > - snapshot->class = hwe->class;
> > + snapshot->hwe = hwe;
>
> I haven't really looked into the devcoredump stuff much, but it's not
> clear to me from a really quick skim whether it's safe to save away the
> hwe like this. Is there ever a case where the snapshot can persist
> after the engine itself has been destroyed (e.g., if we capture an error
> encountered during a device probe that results in the device being torn
> back down)? If so, then you'd probably need to make sure that the hwe
> field here only gets used during the capture, and the 'print' routine
> would still need a cached snapshot->class to avoid use-after-free
> errors.
Xe devcoredump dump is also removed with Xe module, so no problems with this.
>
> Rodrigo probably has better insight as to whether that's something that
> we need to worry about.
>
>
> Matt
>
> > snapshot->logical_instance = hwe->logical_instance;
> > snapshot->forcewake.domain = hwe->domain;
> > snapshot->forcewake.ref = xe_force_wake_ref(gt_to_fw(hwe->gt),
> > @@ -731,7 +731,7 @@ xe_hw_engine_snapshot_capture(struct xe_hw_engine *hwe)
> > hw_engine_mmio_read32(hwe, RING_DMA_FADD(0));
> > snapshot->reg.ipehr = hw_engine_mmio_read32(hwe, RING_IPEHR(0));
> >
> > - if (snapshot->class == XE_ENGINE_CLASS_COMPUTE)
> > + if (snapshot->hwe->class == XE_ENGINE_CLASS_COMPUTE)
> > snapshot->reg.rcu_mode = xe_mmio_read32(hwe->gt, RCU_MODE);
> >
> > return snapshot;
> > @@ -786,7 +786,7 @@ void xe_hw_engine_snapshot_print(struct xe_hw_engine_snapshot *snapshot,
> > snapshot->reg.ring_dma_fadd_udw,
> > snapshot->reg.ring_dma_fadd);
> > drm_printf(p, "\tIPEHR: 0x%08x\n\n", snapshot->reg.ipehr);
> > - if (snapshot->class == XE_ENGINE_CLASS_COMPUTE)
> > + if (snapshot->hwe->class == XE_ENGINE_CLASS_COMPUTE)
> > drm_printf(p, "\tRCU_MODE: 0x%08x\n",
> > snapshot->reg.rcu_mode);
> > }
> > diff --git a/drivers/gpu/drm/xe/xe_hw_engine_types.h b/drivers/gpu/drm/xe/xe_hw_engine_types.h
> > index 5d4ee29042407..71c0a0169e62a 100644
> > --- a/drivers/gpu/drm/xe/xe_hw_engine_types.h
> > +++ b/drivers/gpu/drm/xe/xe_hw_engine_types.h
> > @@ -156,8 +156,8 @@ struct xe_hw_engine {
> > struct xe_hw_engine_snapshot {
> > /** @name: name of the hw engine */
> > char *name;
> > - /** @class: class of this hw engine */
> > - enum xe_engine_class class;
> > + /** @hwe: hw engine */
> > + struct xe_hw_engine *hwe;
> > /** @logical_instance: logical instance of this hw engine */
> > u16 logical_instance;
> > /** @forcewake: Force Wake information snapshot */
> > --
> > 2.42.0
> >
>
next prev parent reply other threads:[~2023-10-12 17:20 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-10 18:41 [Intel-xe] [PATCH v3 1/3] drm/xe: Store xe_he_engine in xe_hw_engine_snapshot José Roberto de Souza
2023-10-10 18:41 ` [Intel-xe] [PATCH v3 2/3] drm/xe: Add misc functions to support read of specific DSS registers José Roberto de Souza
2023-10-12 17:28 ` Matt Roper
2023-10-10 18:41 ` [Intel-xe] [PATCH v3 3/3] drm/xe: Add INSTDONE registers to devcoredump José Roberto de Souza
2023-10-12 17:46 ` Matt Roper
2023-10-12 18:46 ` Souza, Jose
2023-10-12 19:07 ` Matt Roper
2023-10-12 19:21 ` Souza, Jose
2023-10-10 19:51 ` [Intel-xe] ✓ CI.Patch_applied: success for series starting with [v3,1/3] drm/xe: Store xe_he_engine in xe_hw_engine_snapshot Patchwork
2023-10-10 19:52 ` [Intel-xe] ✗ CI.checkpatch: warning " Patchwork
2023-10-10 19:53 ` [Intel-xe] ✓ CI.KUnit: success " Patchwork
2023-10-10 20:00 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-10-10 20:00 ` [Intel-xe] ✓ CI.Hooks: " Patchwork
2023-10-10 20:02 ` [Intel-xe] ✓ CI.checksparse: " Patchwork
2023-10-10 20:35 ` [Intel-xe] ✓ CI.BAT: " Patchwork
2023-10-12 17:16 ` [Intel-xe] [PATCH v3 1/3] " Matt Roper
2023-10-12 17:20 ` Souza, Jose [this message]
2023-10-12 17:30 ` Matt Roper
2023-10-13 20:40 ` Rodrigo Vivi
2023-10-13 21:07 ` Matt Roper
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=ff3e03acf78dda8cb52bde94de70f89a005596c7.camel@intel.com \
--to=jose.souza@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.d.roper@intel.com \
--cc=rodrigo.vivi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.