From: Jason Wessel <jason.wessel@windriver.com>
To: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: <linux-kernel@vger.kernel.org>, <mingo@redhat.com>,
<rusty@rustcorp.com.au>, Steven Rostedt <rostedt@goodmis.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
<yrl.pp-manager.tt@hitachi.com>
Subject: Re: [RFC PATCH 0/8] backtrace/oops with source/line information
Date: Mon, 23 Apr 2012 07:04:47 -0500 [thread overview]
Message-ID: <4F95455F.2040602@windriver.com> (raw)
In-Reply-To: <4F9540A0.6090805@hitachi.com>
On 04/23/2012 06:44 AM, Masami Hiramatsu wrote:
> (2012/04/21 6:29), Jason Wessel wrote:
>> Call to panic() with the patch set
>> ----------------------------------
>> Call Trace:
>> [<ffffffff815f3003>] panic+0xbd/0x14 panic.c:111
>> [<ffffffff815f31f4>] ? printk+0x68/0xd printk.c:765
>> [<ffffffffa0000175>] panic_write+0x25/0x30 [test_panic] test_panic.c:189
>> [<ffffffff8118aa96>] proc_file_write+0x76/0x21 generic.c:226
>> [<ffffffff8118aa20>] ? __proc_create+0x130/0x21 generic.c:211
>> [<ffffffff81185678>] proc_reg_write+0x88/0x21 inode.c:218
>> [<ffffffff81125718>] vfs_write+0xc8/0x20 read_write.c:435
>> [<ffffffff811258d1>] sys_write+0x51/0x19 read_write.c:457
>> [<ffffffff815f84d9>] ia32_do_call+0x13/0xc ia32entry.S:427
>
>
> This can be also useful for kprobes, users can put new events on the
> specified lines not address! Ofcourse, I'd like to use this interface
> for the disassembler patch too. ;)
The eventual goal would be to use this for kdb and kprobes as well.
Really it is nothing more than a few more functions to access the data
tables. I thought the first logical step would be to use this in
backtrace and oops because that affects the widest scope of users of
this feature.
>
>> The key difference here is that you get the source line information in
>> any kind of oops/panic/backtrace, including inside kernel modules. Of
>> course this comes at the expense of some memory you do not get to use
>> because these tables have to get stored in a place that is accessible
>> after a crash. On a system with 4 gigs of ram however, the cost is
>> nearly insignificant when you have to give up a few megs for the
>> capability. The idea is to make it a bit easier to just jump into a
>> source tree without having to use any tools to decode the dump (which
>> I know every kernel developer out there already has anwyay :-)
>
> By the way, it seems that source file doesn't include directries,
> is that possible to expand it? Since there are many files which have
> same name but in different directries, it would be better to
> print those path informations too.
For now I didn't want to increase the kernel size any further, and it
was not directly needed by the backtrace due to screen size
constraints. It will not be hard to add the directories into the
database tables. At the moment, the readelf code is just trowing the
information away.
I also had noticed from my random sampling of functions / line
locations that you end up with unique values if you use the function
name + file name + line number. Obviously that is not the same thing
as simply knowing the line number and file location, but if the
memory footprint becomes too great a problem this is a possible
compromise.
>
>>
>> Using this patch is fairly straight forward. From a developer / end
>> user perspective here are the steps:
>> * set CONFIG_KALLSYMS_LINE_LOCATIONS=y
>
> I've found this config under Kallsyms resources, but I think
> it is better to put it under CONFIG_DEBUG_INFO, because you
> may need to enable CONFIG_DEBUG_INFO for build kernel with
> .debug_* stuffs, and that will increase on-memory kernel
> footprint.
At the moment the line locations feature is tied to the kallsyms code.
I thought I had made it depend on the debug info, but it depends only
on DEBUG_KERNEL at the moment so that will need to get fixed.
>>
>> Finally the symbol lookup used by printk was changed to request the
>> lines for location data when it exists.
>
> Ah, that's really what I want! :)
> I think ftrace also can use this for pretty printing ip address.
>
Because the address printing was generically changed, if the ftrace ip
address print is using a sym_address lookup it should automatically
appear.
>>
>> If you are wondering why I pulled in an modified readelf? It is
>> because most of the pre-built versions of readelf I tried were not
>> working properly on 32 or 64 bit combinations of machines.
>
> Maybe you can report it to the readelf upstream.
It is entirely possible this has been fixed a long time ago. I used
readelf 2.14 for all the work for the kernel because I needed a
version with a GPL v2 license. All I had to go on was just trying the
pre-built binaries from binutils from several host OS systems and
cross compilers I had laying around. It was enough to tell me that we
would need our own readelf in the tree if we wanted this feature to
work reliably.
>> git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb.git
> lines_for_locations
>
> BTW, correct git url is here, isn't it? :)
> git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/kgdb.git
>
Thanks for pointing this out. It will also be corrected should this
series get posted again. :-)
Cheers,
Jason.
next prev parent reply other threads:[~2012-04-23 12:05 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-20 21:29 [RFC PATCH 0/8] backtrace/oops with source/line information Jason Wessel
2012-04-20 21:29 ` [RFC PATCH 1/8] readelf: check in a direct copy of readelf.c from binutils 2.14 Jason Wessel
2012-04-20 21:29 ` [RFC PATCH 2/8] readelf: remove code unrelated to .debug_line section processing Jason Wessel
2012-04-20 21:29 ` [RFC PATCH 3/8] readelf: emit simple to parse line .debug_line data Jason Wessel
2012-04-20 21:29 ` [RFC PATCH 4/8] readelf: Fix dumping a 64 bit elf file on a 32 bit host Jason Wessel
2012-04-20 21:29 ` [RFC PATCH 5/8] kallsyms: convert the kallsyms storage to store the type separately Jason Wessel
2012-04-20 21:29 ` [RFC PATCH 6/8] kallsyms: Add kallsyms kallsyms_line_loc_lookup and print function Jason Wessel
2012-04-20 21:29 ` [RFC PATCH 7/8] modules: decode .debug_line sections if provided by insmod Jason Wessel
2012-04-20 21:29 ` [RFC PATCH 8/8] kallsyms,modules: add module_address_line_lookup() to kallsyms_line_loc_lookup() Jason Wessel
2012-04-23 11:44 ` [RFC PATCH 0/8] backtrace/oops with source/line information Masami Hiramatsu
2012-04-23 12:04 ` Jason Wessel [this message]
2012-04-27 5:54 ` Masami Hiramatsu
2012-04-27 6:48 ` Cong Wang
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=4F95455F.2040602@windriver.com \
--to=jason.wessel@windriver.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
--cc=rusty@rustcorp.com.au \
--cc=yrl.pp-manager.tt@hitachi.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