Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Coelho, Luciano" <luciano.coelho@intel.com>
To: "ville.syrjala@linux.intel.com" <ville.syrjala@linux.intel.com>,
	"tvrtko.ursulin@linux.intel.com" <tvrtko.ursulin@linux.intel.com>
Cc: "intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>,
	"Ursulin, Tvrtko" <tvrtko.ursulin@intel.com>,
	"intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>,
	"Vivi,  Rodrigo" <rodrigo.vivi@intel.com>
Subject: Re: [Intel-gfx] [Intel-xe] [PATCH] drm/i915: don't use uncore spinlock to protect critical section in vblank
Date: Wed, 29 Nov 2023 08:20:29 +0000	[thread overview]
Message-ID: <0f2aae072ab2772293f45ffdb2f21ab781806dd8.camel@intel.com> (raw)
In-Reply-To: <9d09f2e0-fcaf-4519-8661-5c4d7ca41693@linux.intel.com>

On Fri, 2023-11-17 at 12:46 +0000, Tvrtko Ursulin wrote:
> On 17/11/2023 12:21, Coelho, Luciano wrote:
> > Adding Tvrtko, for some reason he didn't get CCed before.
> > 
> > 
> > On Fri, 2023-11-17 at 11:26 +0200, Ville Syrjälä wrote:
> > > On Fri, Nov 17, 2023 at 10:41:43AM +0200, Ville Syrjälä wrote:
> > > > On Fri, Nov 17, 2023 at 08:05:21AM +0000, Coelho, Luciano wrote:
> > > > > Thanks for your comments, Ville!
> > > > > 
> > > > > On Fri, 2023-11-17 at 09:19 +0200, Ville Syrjälä wrote:
> > > > > > On Thu, Nov 16, 2023 at 01:27:00PM +0200, Luca Coelho wrote:
> > > > > > > Since we're abstracting the display code from the underlying driver
> > > > > > > (i.e. i915 vs xe), we can't use the uncore's spinlock to protect
> > > > > > > critical sections of our code.
> > > > > > > 
> > > > > > > After further inspection, it seems that the spinlock is not needed at
> > > > > > > all and this can be handled by disabling preemption and interrupts
> > > > > > > instead.
> > > > > > 
> > > > > > uncore.lock has multiple purposes:
> > > > > > 1. serialize all register accesses to the same cacheline as on
> > > > > >     certain platforms that can hang the machine
> > > > > 
> > > > > Okay, do you remember which platforms?
> > > > 
> > > > HSW is the one I remember for sure being affected.
> > > > Althoguh I don't recall if I ever managed to hang it
> > > > using display registers specifically. intel_gpu_top
> > > > certainly was very good at reproducing the problem.
> > > > 
> > > > > I couldn't find any reference to
> > > > > this reason.
> > > > 
> > > > If all else fails git log is your friend.
> > > 
> > > It seems to be documented in intel_uncore.h. Though that one
> > > mentions IVB instead of HSW for some reason. I don't recall
> > > seeing it on IVB myself, but I suppose it might have been an
> > > issue there as well. How long the problem remained after HSW
> > > I have no idea.
> > 
> > Oh, somehow I missed that.  Thanks.
> > 
> > So, it seems that the locking is indeed needed.  I think there are two
> > options, then:
> > 
> > 1. Go back to my previous version of the patch, where I had the wrapper
> > that didn't lock anything on Xe and implement the display part when we
> > get a similar implementation of the uncore.lock on Xe (if ever needed).
> > 
> > 2. Implement a display-local lock for this, as suggested at some point,
> > including the other intel_de*() accesses.  But can we be sure that it's
> > enough to protect only the registers accessed by the display? I.e.
> > won't accessing display registers non-serially in relation to non-
> > display registers?
> > 
> > 
> > Preferences?
> 
> AFAIR my initial complaint was the naming which was along the lines of 
> intel_spin_lock(uncore). How to come up with a clean and logical name is 
> the question...

You're right, that was your first comment, and now we're back to it. :)


> On Xe you don't need a lock since HSW/IVB/cacheline angle does not exist 
> but you need a name which does not clash with either.
> 
> Assuming you still need the preempt off (or irq off) on Xe for better 
> timings, maybe along the lines of intel_vblank_section_enter/exit(i915)?

I like this name, because it's indeed this vblank section we're trying
to protect here, and this is not used anywhere else.

 
> Although I am not up to speed with what object instead of i915 would you 
> be passing in from Xe ie. how exactly polymorphism is implemented in 
> shared code.

AFAICT we are still using the i915 structure for most things inside the
display code, so I guess we should use that for now.

I'll send a new version of my original patch in a bit.

--
Cheers,
Luca.

  reply	other threads:[~2023-11-29  8:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-16 11:27 [Intel-gfx] [PATCH] drm/i915: don't use uncore spinlock to protect critical section in vblank Luca Coelho
2023-11-16 16:03 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for " Patchwork
2023-11-17  7:19 ` [Intel-gfx] [Intel-xe] [PATCH] " Ville Syrjälä
2023-11-17  8:05   ` Coelho, Luciano
2023-11-17  8:41     ` Ville Syrjälä
2023-11-17  8:46       ` Coelho, Luciano
2023-11-17  9:26       ` Ville Syrjälä
2023-11-17 12:21         ` Coelho, Luciano
2023-11-17 12:46           ` Tvrtko Ursulin
2023-11-29  8:20             ` Coelho, Luciano [this message]
2023-11-17 16:50         ` Rodrigo Vivi
2023-11-17 17:15           ` Zanoni, Paulo R
2023-11-29  8:22             ` Coelho, Luciano

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=0f2aae072ab2772293f45ffdb2f21ab781806dd8.camel@intel.com \
    --to=luciano.coelho@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=rodrigo.vivi@intel.com \
    --cc=tvrtko.ursulin@intel.com \
    --cc=tvrtko.ursulin@linux.intel.com \
    --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