public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Alexander van Heukelum" <heukelum@fastmail.fm>
To: "Linus Torvalds" <torvalds@linux-foundation.org>,
	"Johannes Berg" <johannes@sipsolutions.net>
Cc: "Paul Jackson" <pj@sgi.com>, "H. Peter Anvin" <hpa@zytor.com>,
	yhlu.kernel@gmail.com,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Ingo Molnar" <mingo@elte.hu>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	steiner@sgi.com, travis@sgi.com, linux-kernel@vger.kernel.org,
	ying.huang@intel.com, "Andi Kleen" <andi@firstfloor.org>
Subject: Re: [PATCH 4/5 v2] x86 boot: show pfn addresses in hex not decimal in some kernel info printks
Date: Mon, 30 Jun 2008 09:58:28 +0200	[thread overview]
Message-ID: <1214812708.18086.1261039037@webmail.messagingengine.com> (raw)
In-Reply-To: <alpine.LFD.1.10.0806250813030.4733@hp.linux-foundation.org>

On Wed, 25 Jun 2008 08:19:13 -0700 (PDT), "Linus Torvalds"
<torvalds@linux-foundation.org> said:
> On Wed, 25 Jun 2008, Johannes Berg wrote:
> > 
> > In networking, we've gone through various incarnations of print_mac()
> > which is similar to the sym() macro Paul proposed, and it turned out to
> > be undesirable because of the way it interacts with static inlines that
> > only optionally contain code at all, the print_mac() function call is
> > still emitted by the compiler. People experimented with marking it
> > __pure but that had other problems.
> 
> You don't even have to go that esoteric.
> 
> Just printing things like "sector_t" or "u64" is painful, because the 
> exact type depends on config options and/or architecture.
> 
> > It would be nice to be able to say
> > 
> > u8 *eaddr;
> > 
> > printk(... %M ..., eaddr);
> 
> For special things, I do think we should extend the format more, and 
> forget about single-character names. It would be lovely to do them as
> %[mac], %[u64], %[symbol] or similar. Because once you don't rely on gcc 
> checking the string, you can do it.

That would confuse the gcc format string checking... A solution that
just crossed my mind is leaving the format string as is (i.e., "%p"),
but prepending it with a special linux-specific string which does not
confuse gcc. Like: "&mac%p"... for simplicity & can be considered always
special in printk, and && can stand for a literal &. (or pick any
other character that is not used frequently in format strings and is
not %, of course.)

> The problem is that right now we absolutely _do_ rely on gcc checking the 
> string, and as such we're forced to use standard patterns, and standard 
> patterns _only_. And that means that %M isn't an option, but also that if 
> we want symbolic names we'd have to use %p, and not some extension.

"&%p" could then be used for a symbol-lookup.

It doesn't help u64, though, but isn't it about time to unify u64 to
"unsigned long long" everywhere, anyhow? Is there any argument against
that except that a big sweep is necessary to clean up new warnings due
to printk format strings?

Greetings,
    Alexander

> But once you drop the 'standard patterns' requirement, I do think you 
> should drop it _entirely_, and not just extend it with some pissant 
> single-character unreadable mess.
> 
> 				Linus
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel"
> in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 
> 
-- 
  Alexander van Heukelum
  heukelum@fastmail.fm

-- 
http://www.fastmail.fm - IMAP accessible web-mail


  parent reply	other threads:[~2008-06-30  7:58 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-22 14:21 [PATCH 0/5 v2] x86 boot: various E820 & EFI related fixes - what changed in v2 Paul Jackson
2008-06-22 14:21 ` [PATCH 1/5 v2] x86 boot: e820 code indentation fix Paul Jackson
2008-06-22 14:22 ` [PATCH 2/5 v2] x86 boot: x86_64 efi compiler warning fix Paul Jackson
2008-06-22 14:22 ` [PATCH 3/5 v2] x86 boot: allow overlapping early reserve memory ranges Paul Jackson
2008-06-22 14:22 ` [PATCH 4/5 v2] x86 boot: show pfn addresses in hex not decimal in some kernel info printks Paul Jackson
2008-06-22 19:38   ` Yinghai Lu
2008-06-23 11:09     ` Paul Jackson
2008-06-24 21:29       ` Yinghai Lu
2008-06-25  1:32         ` Paul Jackson
2008-06-25  1:56           ` H. Peter Anvin
2008-06-25  2:17             ` Paul Jackson
2008-06-25  2:18               ` H. Peter Anvin
2008-06-25  2:58                 ` Linus Torvalds
2008-06-25  3:00                   ` Linus Torvalds
2008-06-25  3:08                   ` Paul Jackson
2008-06-25  4:04                     ` Linus Torvalds
2008-06-25  5:01                       ` H. Peter Anvin
2008-06-25 14:42                         ` Linus Torvalds
2008-06-25 15:29                           ` H. Peter Anvin
2008-06-25  8:04                       ` Paul Jackson
2008-06-25 14:53                       ` Ingo Molnar
2008-06-26 19:14                         ` Sam Ravnborg
2008-06-27 12:00                           ` Ingo Molnar
2008-06-27 21:25                             ` Sam Ravnborg
2008-06-25 15:00                       ` Johannes Berg
2008-06-25 15:19                         ` Linus Torvalds
2008-06-25 15:34                           ` Johannes Berg
2008-06-27 20:43                           ` Denys Vlasenko
2008-06-30  7:58                           ` Alexander van Heukelum [this message]
2008-06-25  5:05                   ` H. Peter Anvin
2008-06-22 14:22 ` [PATCH 5/5 v2] x86 boot: more consistently use type int for node ids Paul Jackson
2008-06-24 11:19 ` [PATCH 0/5 v2] x86 boot: various E820 & EFI related fixes - what changed in v2 Ingo Molnar
2008-06-24 11:30   ` Paul Jackson
2008-06-24 15:45     ` H. Peter Anvin
  -- strict thread matches above, loose matches on Subject: below --
2008-06-25  8:56 [PATCH 4/5 v2] x86 boot: show pfn addresses in hex not decimal in some kernel info printks Marco Cesati

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=1214812708.18086.1261039037@webmail.messagingengine.com \
    --to=heukelum@fastmail.fm \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=hpa@zytor.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=pj@sgi.com \
    --cc=steiner@sgi.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=travis@sgi.com \
    --cc=yhlu.kernel@gmail.com \
    --cc=ying.huang@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox