Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH] drm/xe: Drop trace_xe_hw_fence_free
Date: Mon, 8 Jul 2024 21:39:39 +0000	[thread overview]
Message-ID: <Zoxcm6gSL0wGUHpW@DUT025-TGLU.fm.intel.com> (raw)
In-Reply-To: <ZoxbZxhZs6_KbMZQ@intel.com>

On Mon, Jul 08, 2024 at 05:34:31PM -0400, Rodrigo Vivi wrote:
> On Mon, Jul 08, 2024 at 02:10:08PM -0700, Matthew Brost wrote:
> > fence->ctx may be stale memory when trace_xe_hw_fence_free is called
> > resuling UAF bug when deriving the device name. This tracepoint is not
> > all that useful, so just drop it.
> 
> the placement of it seems strange anyway, but if it is not useful,
> let's indeed drop it.
> 

Yes, the lifetime of fence can outlive anything it is attached to (in
this case the LRCs hw fence ctx) as the fence cleanup is quite lazy in
places (e.g. in syncobjs, dma-resvs, etc...) where it can be installed.

I think the only reason I added this in the first place was very early
in the driver coding I had ref counting problems where xe_hw_fences were
getting leaked and used ftrace to debug that issue. We have this correct
now so not all that useful. I'd rather have the device id in hw fence
tracepoints and I'd rather not special case this tracepoint to not try
to get the device id.

Matt 

> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> 
> > 
> > Fixes: 501c4255c409 ("drm/xe/trace: Print device_id in xe_trace events")
> > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > Cc: Lucas De Marchi <lucas.demarchi@intel.com>
> > Cc: Gustavo Sousa <gustavo.sousa@intel.com>
> > Cc: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
> > Cc: Matt Roper <matthew.d.roper@intel.com>
> > Signed-off-by: Matthew Brost <matthew.brost@intel.com>
> > ---
> >  drivers/gpu/drm/xe/xe_hw_fence.c | 1 -
> >  drivers/gpu/drm/xe/xe_trace.h    | 5 -----
> >  2 files changed, 6 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/xe/xe_hw_fence.c b/drivers/gpu/drm/xe/xe_hw_fence.c
> > index 35c0063a831a..45a9789cf501 100644
> > --- a/drivers/gpu/drm/xe/xe_hw_fence.c
> > +++ b/drivers/gpu/drm/xe/xe_hw_fence.c
> > @@ -187,7 +187,6 @@ static void xe_hw_fence_release(struct dma_fence *dma_fence)
> >  {
> >  	struct xe_hw_fence *fence = to_xe_hw_fence(dma_fence);
> >  
> > -	trace_xe_hw_fence_free(fence);
> >  	XE_WARN_ON(!list_empty(&fence->irq_link));
> >  	call_rcu(&dma_fence->rcu, fence_free);
> >  }
> > diff --git a/drivers/gpu/drm/xe/xe_trace.h b/drivers/gpu/drm/xe/xe_trace.h
> > index 09ca1ad057b0..baba14fb1e32 100644
> > --- a/drivers/gpu/drm/xe/xe_trace.h
> > +++ b/drivers/gpu/drm/xe/xe_trace.h
> > @@ -341,11 +341,6 @@ DEFINE_EVENT(xe_hw_fence, xe_hw_fence_try_signal,
> >  	     TP_ARGS(fence)
> >  );
> >  
> > -DEFINE_EVENT(xe_hw_fence, xe_hw_fence_free,
> > -	     TP_PROTO(struct xe_hw_fence *fence),
> > -	     TP_ARGS(fence)
> > -);
> > -
> >  TRACE_EVENT(xe_reg_rw,
> >  	TP_PROTO(struct xe_gt *gt, bool write, u32 reg, u64 val, int len),
> >  
> > -- 
> > 2.34.1
> > 

  reply	other threads:[~2024-07-08 21:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-08 21:10 [PATCH] drm/xe: Drop trace_xe_hw_fence_free Matthew Brost
2024-07-08 21:22 ` ✓ CI.Patch_applied: success for " Patchwork
2024-07-08 21:22 ` ✓ CI.checkpatch: " Patchwork
2024-07-08 21:23 ` ✓ CI.KUnit: " Patchwork
2024-07-08 21:34 ` [PATCH] " Rodrigo Vivi
2024-07-08 21:39   ` Matthew Brost [this message]
2024-07-08 21:35 ` ✓ CI.Build: success for " Patchwork
2024-07-08 21:37 ` ✓ CI.Hooks: " Patchwork
2024-07-08 21:39 ` ✓ CI.checksparse: " Patchwork
2024-07-08 22:04 ` ✓ CI.BAT: " Patchwork
2024-07-09  2:43 ` ✓ 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=Zoxcm6gSL0wGUHpW@DUT025-TGLU.fm.intel.com \
    --to=matthew.brost@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox