All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: "Mateo Lozano, Oscar" <oscar.mateo@intel.com>
Cc: Ben Widawsky <ben@bwidawsk.net>,
	"Widawsky, Benjamin" <benjamin.widawsky@intel.com>,
	Intel GFX <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH] drm/i915: Fix some NUM_RING iterators
Date: Mon, 7 Jul 2014 21:37:17 +0200	[thread overview]
Message-ID: <20140707193717.GH5821@phenom.ffwll.local> (raw)
In-Reply-To: <92648605EABDA246B775AAB04C95A7A3137E8A8A@IRSMSX103.ger.corp.intel.com>

On Mon, Jun 30, 2014 at 11:27:25AM +0000, Mateo Lozano, Oscar wrote:
> 
> 
> ---------------------------------------------------------------------
> Intel Corporation (UK) Limited
> Registered No. 1134945 (England)
> Registered Office: Pipers Way, Swindon SN3 1RJ
> VAT No: 860 2173 47
> 
> > -----Original Message-----
> > From: Intel-gfx [mailto:intel-gfx-bounces@lists.freedesktop.org] On Behalf
> > Of Ben Widawsky
> > Sent: Saturday, June 28, 2014 10:56 PM
> > To: Chris Wilson; Rodrigo Vivi; Widawsky, Benjamin; Intel GFX
> > Subject: Re: [Intel-gfx] [PATCH] drm/i915: Fix some NUM_RING iterators
> > 
> > On Sat, Jun 28, 2014 at 08:28:55PM +0100, Chris Wilson wrote:
> > > On Sat, Jun 28, 2014 at 08:26:15AM -0700, Ben Widawsky wrote:
> > > > On Sat, Jun 28, 2014 at 07:20:38AM +0100, Chris Wilson wrote:
> > > > > >      diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c
> > > > > >      b/drivers/gpu/drm/i915/i915_gpu_error.c
> > > > > >      index 86362de..6e5250d 100644
> > > > > >      --- a/drivers/gpu/drm/i915/i915_gpu_error.c
> > > > > >      +++ b/drivers/gpu/drm/i915/i915_gpu_error.c
> > > > > >      @@ -848,7 +848,7 @@ static uint32_t
> > i915_error_generate_code(struct
> > > > > >      drm_i915_private *dev_priv,
> > > > > >               * synchronization commands which almost always appear in
> > the
> > > > > >      case
> > > > > >               * strictly a client bug. Use instdone to differentiate those
> > > > > >      some.
> > > > > >               */
> > > > > >      -       for (i = 0; i < I915_NUM_RINGS; i++) {
> > > > > >      +       for (i = 0; i < I915_ACTIVE_RINGS(dev_priv->dev); i++) {
> > > > > >                      if (error->ring[i].hangcheck_action ==
> > HANGCHECK_HUNG) {
> > > > > >                              if (ring_id)
> > > > > >                                      *ring_id = i;
> > > > > >      diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h
> > > > > >      b/drivers/gpu/drm/i915/intel_ringbuffer.h
> > > > > >      index e72017b..67e2919 100644
> > > > > >      --- a/drivers/gpu/drm/i915/intel_ringbuffer.h
> > > > > >      +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
> > > > > >      @@ -90,6 +90,8 @@ struct  intel_engine_cs {
> > > > > >              } id;
> > > > > >       #define I915_NUM_RINGS 5
> > > > > >       #define LAST_USER_RING (VECS + 1)
> > > > > >      +#define I915_ACTIVE_RINGS(dev)
> > > > > > hweight8(INTEL_INFO(dev)->ring_mask)
> > > > >
> > > > > What does the popcount of the mask have to do with the validity of
> > > > > the arrays being iterated over in this patch?
> > > > > -Chris
> > > >
> > > > The popcount of the mask represents the number of rings available on
> > > > the specific SKU, as opposed to the total number of rings on any SKU
> > ever.
> > > > It is not always correct to iterate on all rings in the system.
> > > > Please note, the patch is incomplete. I have a couple of other,
> > > > perhaps more interesting, cases which I've missed.
> > >
> > > You still iterate over holes in the ring mask, and the iteration here
> > > is over a completely different array, not rings.
> > >  -Chris
> > 
> > For the holes, I mentioned that in the commit message of the yet to be
> > submitted v2; it's not really an issue in the way things are today.
> > When/if we add a new ring, it will be.
> > 
> > What you're asking for has already been submitted multiple times with
> > seemingly no traction. I do realize the fixes (with my v2) are due to bugs
> > introduced in patches I've not yet submitted, so I think for that reason, it's
> > fair to drop this patch.
> > 
> > I'd rather the other patch get in (for_each_active_ring), but it's tied up with
> > execlists atm, and I continue to think this is a useful way to iterate over the
> > rings in error conditions and during reset.
> 
> I dropped that patch, since it received some resistance and I couldn´t
> really justify it on the Execlists series anymore (on the latest
> versions we don´t introduce new for i < I915_NUM_RINGS). I imagine the
> patch could be sent again as a standalone?

With Chris' patch to no longer tear down ring structures over reset/system
suspend we should be able to always use ring_for_each. If not that means
we still have some fun to look at.

In any case I'm always happy to merge such drive-by cleanup patches, no
need to have a big patch series to justify it. Well as long as it's indeed
a step forward, which occasionally is a contentions topic ...
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

      reply	other threads:[~2014-07-07 19:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-27 22:09 [PATCH] drm/i915: Fix some NUM_RING iterators Ben Widawsky
2014-06-27 22:21 ` Rodrigo Vivi
2014-06-28  4:45   ` Ben Widawsky
2014-06-28  6:20   ` Chris Wilson
2014-06-28 15:26     ` Ben Widawsky
2014-06-28 19:28       ` Chris Wilson
2014-06-28 21:55         ` Ben Widawsky
2014-06-30 11:27           ` Mateo Lozano, Oscar
2014-07-07 19:37             ` Daniel Vetter [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=20140707193717.GH5821@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=ben@bwidawsk.net \
    --cc=benjamin.widawsky@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=oscar.mateo@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.