From: Paul Jackson <pj@sgi.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: hpa@zytor.com, yhlu.kernel@gmail.com, akpm@linux-foundation.org,
mingo@elte.hu, tglx@linutronix.de, steiner@sgi.com,
travis@sgi.com, linux-kernel@vger.kernel.org,
ying.huang@intel.com, andi@firstfloor.org
Subject: Re: [PATCH 4/5 v2] x86 boot: show pfn addresses in hex not decimal in some kernel info printks
Date: Wed, 25 Jun 2008 03:04:56 -0500 [thread overview]
Message-ID: <20080625030456.cab9ec3e.pj@sgi.com> (raw)
In-Reply-To: <alpine.LFD.1.10.0806242101460.20369@hp.linux-foundation.org>
Linux, replying to pj:
> > I'd be inclined instead to use "%P" for symbolic addrs.
>
> That doesn't work - gcc warns about it.
>
> That turns out to be a problem with %#p too.
Ah so.
How about the following "sym(addr, buf)" macro? This could make it
more practical to include kernel symbols within ordinary printk's.
On a silly little test with:
{
char b1[32], b2[32], b3[32];
printk(">>>>>> Testing sym(): A. %s, B. %s, C. %s\n",
sym(&pid_max, b1),
sym(0xffffffff80615750, b2), /* an addr in my System.map */
sym(0, b3));
}
the kernel printed:
>>>>>> Testing sym(): A. pid_max+0x0/0x4, B. trampoline_base+0x0/0x10, C. 0x0
===========================================================================
--- linux.orig/include/linux/kallsyms.h 2008-06-23 15:16:49.885666712 -0700
+++ linux/include/linux/kallsyms.h 2008-06-25 00:48:09.446807842 -0700
@@ -32,6 +32,12 @@ extern int sprint_symbol(char *buffer, u
/* Look up a kernel symbol and print it to the kernel messages. */
extern void __print_symbol(const char *fmt, unsigned long address);
+/* Convert address to kernel symbol; can printk result with "%s" format */
+#define sym(address, namebuf) ({ \
+ sprint_symbol((namebuf), (unsigned long)(address)); \
+ (namebuf); \
+})
+
int lookup_symbol_name(unsigned long addr, char *symname);
int lookup_symbol_attrs(unsigned long addr, unsigned long *size, unsigned long *offset, char *modname, char *name);
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.940.382.4214
next prev parent reply other threads:[~2008-06-25 8:05 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 [this message]
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
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=20080625030456.cab9ec3e.pj@sgi.com \
--to=pj@sgi.com \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--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