Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: Ohad Sharabi <osharabi@habana.ai>, intel-xe@lists.freedesktop.org
Subject: Re: [Intel-xe] [CI 1/3] drm/xe: proper setting of irq enabled flag
Date: Fri, 22 Sep 2023 17:05:06 -0400	[thread overview]
Message-ID: <ZQ4Bgj2ltddIq8eq@intel.com> (raw)
In-Reply-To: <ZQ2OcWIPhJZiPzx3@intel.com>

On Fri, Sep 22, 2023 at 03:54:09PM +0300, Ville Syrjälä wrote:
> On Fri, Sep 22, 2023 at 08:11:05AM -0400, Rodrigo Vivi wrote:
> > On Fri, Sep 22, 2023 at 11:18:37AM +0300, Ville Syrjälä wrote:
> > > On Thu, Sep 21, 2023 at 05:07:58PM -0400, Rodrigo Vivi wrote:
> > > > From: Dani Liberman <dliberman@habana.ai>
> > > >
> > > > IRQ enabled flag should be set only after request irq succeeds.
> > > >
> > > > Reviewed-by: Ohad Sharabi <osharabi@habana.ai>
> > > > Signed-off-by: Dani Liberman <dliberman@habana.ai>
> > > > Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > > > ---
> > > >  drivers/gpu/drm/xe/xe_irq.c | 8 +++-----
> > > >  1 file changed, 3 insertions(+), 5 deletions(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/xe/xe_irq.c b/drivers/gpu/drm/xe/xe_irq.c
> > > > index ccb934f8fa34..f98aa1f06c8f 100644
> > > > --- a/drivers/gpu/drm/xe/xe_irq.c
> > > > +++ b/drivers/gpu/drm/xe/xe_irq.c
> > > > @@ -590,16 +590,14 @@ int xe_irq_install(struct xe_device *xe)
> > > >  		return -EINVAL;
> > > >  	}
> > > >
> > > > -	xe->irq.enabled = true;
> > > > -
> > > >  	xe_irq_reset(xe);
> > > >
> > > >  	err = request_irq(irq, irq_handler,
> > > >  			  IRQF_SHARED, DRIVER_NAME, xe);
> > > > -	if (err < 0) {
> > > > -		xe->irq.enabled = false;
> > > > +	if (err < 0)
> > > >  		return err;
> > > > -	}
> > > > +
> > > > +	xe->irq.enabled = true;
> > >
> > > Why does this even exist?
> > 
> > I had tried to kill this, but then I noticed it was needed
> > for i915-display.
> > 
> > @drivers/gpu/drm/xe/display/ext/i915_irq.c:
> > 
> > bool intel_irqs_enabled(struct xe_device *xe)
> > {
> >  	/*
> >          * XXX: i915 has a racy handling of the irq.enabled, since it doesn't
> >          * lock its transitions. Because of that, the irq.enabled sometimes
> >          * is not read with the irq.lock in place.
> >          * However, the most critical cases like vblank and page flips are
> >          * properly using the locks.
> >          * We cannot take the lock in here or run any kind of assert because
> >          * of i915 inconsistency.
> >          * But at this point the xe irq is better protected against races,
> >          * although the full solution would be protecting the i915 side.
> >          */
> 
> None of that really makes sense to me. It's a single boolean so locking
> is pointless.
> 
> Hmm, I guess we are using it for runtime pm to make sure we don't
> try to access the device when it's asleep. But that should only
> really happen if we would be using a shared legacy interrupt.

hmmm.. should we change those cases to use pm_runtime_suspended kind
of check then?

> 
> And the other user is the power well pipe IER/IMR initialization stuff,
> where I suppose we are trying to not unmask/enable the per-pipe
> interrupts if interrupts in general are supposed to be off. Though
> the higher level interrupts should still be masked off anyway
> so not sure that is actually required except to maintain 100% state
> in all irq registers.

hmm... good point. should we then ensure we are only checking that
for legacy?

> 
> Everything else just looks like asserts to make sure we haven't
> screwed the init/resume/etc. order too badly.

yeap, I honestly couldn't make sense on why in many of them, but
it looks the case.

But with all of this in mind, the comment here indeed is not good.

But anyway, it is not related to this series. While we don't change
or remove the need for that check, this series looks correct to me,
so I just went ahead and pushed it.

Any modification on the irq.enabled should be a follow-up.

> 
> > 	return xe->irq.enabled;
> > }
> > 
> > 
> > >
> > > >
> > > >  	xe_irq_postinstall(xe);
> > > >
> > > > --
> > > > 2.41.0
> > >
> > > --
> > > Ville Syrjälä
> > > Intel
> 
> -- 
> Ville Syrjälä
> Intel

      reply	other threads:[~2023-09-22 21:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-21 21:07 [Intel-xe] [CI 1/3] drm/xe: proper setting of irq enabled flag Rodrigo Vivi
2023-09-21 21:07 ` [Intel-xe] [CI 2/3] drm/xe: change old msi irq api to a new one Rodrigo Vivi
2023-09-21 21:08 ` [Intel-xe] [CI 3/3] drm/xe: add msix support Rodrigo Vivi
2023-09-21 21:54 ` [Intel-xe] ✓ CI.Patch_applied: success for series starting with [CI,1/3] drm/xe: proper setting of irq enabled flag Patchwork
2023-09-21 21:54 ` [Intel-xe] ✓ CI.checkpatch: " Patchwork
2023-09-21 21:56 ` [Intel-xe] ✓ CI.KUnit: " Patchwork
2023-09-21 22:03 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-09-21 22:03 ` [Intel-xe] ✓ CI.Hooks: " Patchwork
2023-09-21 22:04 ` [Intel-xe] ✓ CI.checksparse: " Patchwork
2023-09-21 22:39 ` [Intel-xe] ✓ CI.BAT: " Patchwork
2023-09-22  8:18 ` [Intel-xe] [CI 1/3] " Ville Syrjälä
2023-09-22 12:11   ` Rodrigo Vivi
2023-09-22 12:54     ` Ville Syrjälä
2023-09-22 21:05       ` Rodrigo Vivi [this message]

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=ZQ4Bgj2ltddIq8eq@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=osharabi@habana.ai \
    --cc=ville.syrjala@linux.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