linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>,
	Jiri Slaby <jslaby@suse.cz>, Ingo Molnar <mingo@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>, Michal Marek <mmarek@suse.cz>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] x86: dumpstack: eliminate some #ifdefs
Date: Wed, 7 Oct 2015 09:03:21 +0200	[thread overview]
Message-ID: <20151007070321.GB7837@gmail.com> (raw)
In-Reply-To: <1444165543-2209-2-git-send-email-linux@rasmusvillemoes.dk>


* Rasmus Villemoes <linux@rasmusvillemoes.dk> wrote:

> +	static const char build_flags[] = ""
> +		CHOOSE_EXPR(CONFIG_PREEMPT, " PREEMPT")
> +		CHOOSE_EXPR(CONFIG_SMP, " SMP")
> +		CHOOSE_EXPR(CONFIG_DEBUG_PAGEALLOC, " DEBUG_PAGEALLOC")
> +		CHOOSE_EXPR(CONFIG_KASAN, " KASAN");
> +
>  	printk(KERN_DEFAULT
> -	       "%s: %04lx [#%d] ", str, err & 0xffff, ++die_counter);
> -#ifdef CONFIG_PREEMPT
> -	printk("PREEMPT ");
> -#endif
> -#ifdef CONFIG_SMP
> -	printk("SMP ");
> -#endif
> -#ifdef CONFIG_DEBUG_PAGEALLOC
> -	printk("DEBUG_PAGEALLOC ");
> -#endif
> -#ifdef CONFIG_KASAN
> -	printk("KASAN");
> -#endif
> -	printk("\n");
> +	       "%s: %04lx [#%d]%s\n", str, err & 0xffff, ++die_counter,
> +	       build_flags);
> +
>  	if (notify_die(DIE_OOPS, str, regs, err,
>  			current->thread.trap_nr, SIGSEGV) == NOTIFY_STOP)
>  		return 1;

Looks cleaner than what we had before, but I have a naming nit: CHOOSE_EXPR() is 
not something I'd be able to remember, I'd have to look it up again all the time, 
because it does not have 'config' in its name, and because 'choose' is usually 
associated with different constructs.

So how about something more intuitive, like:

		COND_CONFIG(CONFIG_PREEMPT,		" PREEMPT")
		COND_CONFIG(CONFIG_SMP,			" SMP")
		COND_CONFIG(CONFIG_DEBUG_PAGEALLOC,	" DEBUG_PAGEALLOC")
		COND_CONFIG(CONFIG_KASAN,		" KASAN");

or:

		IF_CONFIG(CONFIG_PREEMPT,		" PREEMPT")
		IF_CONFIG(CONFIG_SMP,			" SMP")
		IF_CONFIG(CONFIG_DEBUG_PAGEALLOC,	" DEBUG_PAGEALLOC")
		IF_CONFIG(CONFIG_KASAN,			" KASAN");

?

Both names are still unused in the kernel repo.

Thanks,

	Ingo

  reply	other threads:[~2015-10-07  7:03 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-06 12:29 [PATCH 1/2] x86: dumpstack, use pr_cont Jiri Slaby
2015-10-06 12:29 ` [PATCH 2/2] x86: text_poke, check if text_mutex is held Jiri Slaby
2015-10-06 16:00 ` [PATCH 1/2] x86: dumpstack, use pr_cont Rasmus Villemoes
2015-10-06 16:16   ` Jiri Slaby
2015-10-06 21:05     ` [PATCH 1/2] linux/kconfig.h: generalize IS_ENABLED logic Rasmus Villemoes
2015-10-06 21:05       ` [PATCH 2/2] x86: dumpstack: eliminate some #ifdefs Rasmus Villemoes
2015-10-07  7:03         ` Ingo Molnar [this message]
2016-03-26 20:40         ` [PATCH] x86: dumpstack: combine some printks Rasmus Villemoes
2016-04-01  6:37           ` [tip:x86/debug] x86/dumpstack: Combine some printk()s tip-bot for Rasmus Villemoes
2015-10-07  6:57       ` [PATCH 1/2] linux/kconfig.h: generalize IS_ENABLED logic Ingo Molnar
2015-10-07  8:15       ` Michal Marek
2015-10-07 21:33         ` Rasmus Villemoes
2015-10-08 11:40           ` Michal Marek
2015-11-16  8:00       ` using IS_ENABLED(CONFIG_xyz) effectively Vineet Gupta
2015-11-16  8:28         ` Geert Uytterhoeven
2015-11-16  8:35           ` Vineet Gupta
2015-11-16  8:52             ` Arnd Bergmann
2015-11-16 10:03               ` Vineet Gupta

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=20151007070321.GB7837@gmail.com \
    --to=mingo@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=mingo@redhat.com \
    --cc=mmarek@suse.cz \
    --cc=paul.gortmaker@windriver.com \
    --cc=tglx@linutronix.de \
    /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).