linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: dhowells@redhat.com, linux-arch@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH 1/7] Add assertion support with annotated oopsing
Date: Wed, 12 Oct 2011 18:23:09 +0100	[thread overview]
Message-ID: <1362.1318440189@redhat.com> (raw)
In-Reply-To: <20111012165719.GA18407@elte.hu>

Ingo Molnar <mingo@elte.hu> wrote:

> Looks useful, but i'd suggest to make this a variant of the standard 
> BUG_ON()/WARN_ON() checks we already have, not an explicit assert().
> 
> BUG_ON_VERBOSE() or such.

I personally prefer the positive check (ASSERT() saying that this expression
must be true) as opposed to the negative check (BUG_ON() saying that this must
be false).  I find it easier to think about the logic (I expect value X to be
like this, value Y to be like that, etc.).

That said, I could make the base bit BUG_VERBOSE(FMT, ...) and wrap ASSERT*()
around that.

However, I'd _much_ rather make it so that I can post the "cut here" message
early - but, IIRC, Linus hated that idea.

> I find assert()'s inversion confusing when mixed with WARN_ON()/BUG_ON().

Why did we do it this way originally, rather than using assert, I wonder?
Especially since the concept of assert already exists in userspace.

> Likewise, the message of:
> 
>        	ASSERTION FAILED at fs/dcache.c:863!
> 
> is rather confusing to me (i never know how the condition printed is 
> to be interpreted) - why not use the usual 'BUG: ...' message 
> convention?

I don't see why it should be confusing.  Something bad happened at file:line.

I could make it print "BUG" instead.  That's a minor matter.  The ASSERT
macros in patch 2 could then generate a report that looks like this:

	------------[ cut here ]------------
	kernel BUG at fs/fscache/main.c:109!
	Assertion failed: 2 > c is false
	invalid opcode: 0000 [#1] SMP

David

  parent reply	other threads:[~2011-10-12 17:23 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-12 16:47 [PATCH 1/7] Add assertion support with annotated oopsing David Howells
2011-10-12 16:47 ` [PATCH 2/7] Add assertion checking macros David Howells
2011-10-12 16:47   ` David Howells
2011-10-12 17:43   ` Jiri Slaby
2011-10-12 20:36   ` David Howells
2011-10-12 16:47 ` [PATCH 3/7] Make shrink_dcache_for_umount_subtree() use the core assertion code David Howells
2011-10-12 16:47   ` David Howells
2011-10-12 16:47 ` [PATCH 4/7] FS-Cache: Use new core assertion macros David Howells
2011-10-12 16:47   ` David Howells
2011-10-12 16:47 ` [PATCH 5/7] CacheFiles: " David Howells
2011-10-12 16:47   ` David Howells
2011-10-12 16:48 ` [PATCH 6/7] AFS: " David Howells
2011-10-12 16:48   ` David Howells
2011-10-12 16:48 ` [PATCH 7/7] RxRPC: " David Howells
2011-10-12 16:48   ` David Howells
2011-10-12 16:57 ` [PATCH 1/7] Add assertion support with annotated oopsing Ingo Molnar
2011-10-12 16:57   ` Ingo Molnar
2011-10-12 17:23 ` David Howells [this message]
2011-10-12 17:23   ` David Howells

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=1362.1318440189@redhat.com \
    --to=dhowells@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).