All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Widawsky <ben@bwidawsk.net>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: Dumb down the semaphore logic
Date: Fri, 2 Sep 2011 14:02:54 +0000	[thread overview]
Message-ID: <20110902140254.GA30736@cloud01> (raw)
In-Reply-To: <d08817$1asrm7@azsmga001.ch.intel.com>

On Fri, Sep 02, 2011 at 09:54:32AM +0100, Chris Wilson wrote:
> On Thu,  1 Sep 2011 20:55:35 -0700, Ben Widawsky <ben@bwidawsk.net> wrote:
> > While I think the previous code is correct, it was hard to follow and
> > hard to debug. Since we already have a ring abstraction, might as well
> > use it to handle the semaphore updates and compares.
> > 
> > I don't expect this code to make semaphores better or worse, but you
> > never know...
> 
> So "dumbing it down" means using macros instead of small functions and
> putting magic values into the ring structure. I'm not sure if that's an
> improvement to readability at all.
> -Chris

The previous code for doing an update was non obvious to me. Obviously I
will be biased in thinking my code is easier to follow, but for the
existing code I had to map out exactly what it's doing every single time
I went through it to convince myself it is correct.

Using pointer arithmetic and then RING_SYNC_0 with math did not seem the
correct way to do it. As for the magic values, they started out as
non-magic, but got changed at some point during developing the patch. At
the end I went back to magic to reduce the LOC.  You'll notice the
comments there make them slightly less magic.

And although a lame argument... if a new ring comes along the previous code was
not very well equiped to handle it.

Ben

  reply	other threads:[~2011-09-02 13:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-02  3:55 [PATCH] drm/i915: Dumb down the semaphore logic Ben Widawsky
2011-09-02  8:54 ` Chris Wilson
2011-09-02 14:02   ` Ben Widawsky [this message]
2011-09-02 19:10 ` Eric Anholt
2011-09-03 20:09   ` Ben Widawsky
2011-09-04  2:55     ` Keith Packard
2011-09-05  3:52 Ben Widawsky
2011-09-05  6:54 ` Ben Widawsky

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=20110902140254.GA30736@cloud01 \
    --to=ben@bwidawsk.net \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /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.