All of lore.kernel.org
 help / color / mirror / Atom feed
From: Josh Triplett <josh@joshtriplett.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: kbuild test robot <fengguang.wu@intel.com>,
	Ingo Molnar <mingo@kernel.org>,
	kbuild-all@01.org, linux-sparse@vger.kernel.org,
	sparse@chrisli.org
Subject: Re: [tip:sched/core 16/27] fs/jbd/commit.c:105:12: sparse: context imbalance in 'inverted_lock' - wrong count at exit
Date: Mon, 30 Sep 2013 08:25:51 -0700	[thread overview]
Message-ID: <20130930152550.GA1269@leaf> (raw)
In-Reply-To: <20130930134434.GC12926@twins.programming.kicks-ass.net>

On Mon, Sep 30, 2013 at 03:44:34PM +0200, Peter Zijlstra wrote:
> On Wed, Sep 25, 2013 at 02:47:20PM -0700, Josh Triplett wrote:
> > That's expressible in Sparse; look at how spin_trylock and _cond_lock,
> > and write a _cond_unlock.
> 
> Yeah, I know about __cond_lock() its an abomination that should die.

Can't argue with that.

> I
> did take a stab at teach sparse something saner but got stuck.. was
> years ago, can't remember more.

I only see two obvious ways to extend Sparse to remove the need for
__cond_lock, and only one makes sense.

First, you could add an attribute for conditional context changes, which
takes an expression; however, that would require an expression
evaluator, which internally would construct code a lot like __cond_lock,
and it would require some syntax to reference the return value.  That
seems excessively painful, and not significantly better than
__cond_lock.

Second, the real solution: teach Sparse to do whole-program
analysis, similar to GCC LTO.

Alternatively, someone could write a GCC plugin that understands the
context attribute and __context__ statement, and then does whole-program
context analysis using GCC; that seems easiest, relatively speaking.

- Josh Triplett

  reply	other threads:[~2013-09-30 15:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <52432bed.WfPoNUw4qxmYeQy4%fengguang.wu@intel.com>
2013-09-25 18:59 ` [tip:sched/core 16/27] fs/jbd/commit.c:105:12: sparse: context imbalance in 'inverted_lock' - wrong count at exit Peter Zijlstra
2013-09-25 21:47   ` Josh Triplett
2013-09-30 13:44     ` Peter Zijlstra
2013-09-30 15:25       ` Josh Triplett [this message]
2013-09-30 15:35         ` Peter Zijlstra
2013-09-25 21:58   ` Josh Triplett

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=20130930152550.GA1269@leaf \
    --to=josh@joshtriplett.org \
    --cc=fengguang.wu@intel.com \
    --cc=kbuild-all@01.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=sparse@chrisli.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.