From: Omar Sandoval <osandov@osandov.com>
To: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: "Petr Tesařík" <petr@tesarici.cz>,
linux-s390@vger.kernel.org,
"Ilya Leoshkevich" <iii@linux.ibm.com>,
linux-debuggers@vger.kernel.org
Subject: Re: Incorrect vmcoreinfo KERNELOFFSET after "s390/boot: Rework deployment of the kernel image"
Date: Thu, 11 Jul 2024 16:30:22 -0700 [thread overview]
Message-ID: <ZpBrDvUpn4SzaqND@telecaster> (raw)
In-Reply-To: <Zo5L9xZtIs4dCf0E@li-008a6a4c-3549-11b2-a85c-c5cc2836eea2.ibm.com>
On Wed, Jul 10, 2024 at 10:53:11AM +0200, Alexander Gordeev wrote:
> On Tue, Jul 09, 2024 at 09:21:41PM +0200, Petr Tesařík wrote:
>
> Hi Petr,
> ...
> > > I would say to some degree there is also inconsisten with regard
> > > to /proc/ files existence:
> > > /proc/kcore is enabled by CONFIG_PROC_KCORE option, while
> > > /proc/kallsyms is enabled by CONFIG_KALLSYMS option.
> > > I assume drgn expects both files exist and does not work otherwise.
> > >
> > > Nevertheless, it is still possible to refer to only one file for
> > > symbol resolution and use an always-present symbol. E.g _stext
> > > could be leveraged like this:
> > >
> > > # grep -w init_task /proc/kallsyms
> > > 000003ffe13e9400 D init_task
> > > # grep -w _stext /proc/kallsyms
> > > 000003ffe0000000 T _stext
> > >
> > > 0x3ffe13e9400 - 0x3ffe0000000 == 0x13e9400
> > >
> > > # eu-readelf -s vmlinux | grep -w _stext
> > > 178112: 0000000000100000 0 NOTYPE GLOBAL DEFAULT 1 _stext
> > >
> > > 0x13e9400 + 0x100000 == 0x14e9400
> > >
> > > # eu-readelf -s vmlinux | grep -w init_task
> > > 498: 0000000000000000 0 FILE LOCAL DEFAULT ABS init_task.c
> > > 182344: 00000000014e9400 8960 OBJECT GLOBAL DEFAULT 28 init_task
> > >
> > > I guess, the above holds true for all architectures.
> > > If so, I would suggest consider using that approach.
> > >
> > > Having said that, we will try to turn KERNELOFFSET from a synthetic
> > > value "Used to compute the page offset" to what drgn expects it to be.
> >
> > Thinking about it now, I'm not sure it makes life easier. Because then
> > we'll have some old kernels with the current (unexpected) definition of
> > KERNELOFFSET and some new kernels with a more standard definition of
> > it, but if I read vmcoreinfo, how do I know if the value has the old or
> > the new meaning?
>
> The approach I suggested to consider would not use KERNELOFFSET at all.
Hi,
Unfortunately, using kallsyms isn't feasible for a few reasons:
1) /proc/kallsyms is not available when debugging a core dump.
2) As you pointed out, /proc/kallsyms is not necessarily enabled
together with /proc/kcore.
3) Reading /proc/kallsyms is slow. On my system, drgn starts up in about
250ms, and reading /proc/kallsyms takes about 110 ms. This would
slow down startup too much.
drgn intentionally avoids kallsyms for these reasons. (There is one
corner case on old < 4.11 kernels where we need kallsyms, but that will
go away eventually.)
I'd be really grateful if KERNELOFFSET was always the difference between
addresses in the kernel image and in memory like it is on other
architectures, or even if there was another, s390x-specific field in
vmcoreinfo for that.
Thanks,
Omar
next prev parent reply other threads:[~2024-07-11 23:30 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-20 23:34 Incorrect vmcoreinfo KERNELOFFSET after "s390/boot: Rework deployment of the kernel image" Omar Sandoval
2024-06-24 13:29 ` Alexander Gordeev
2024-06-27 13:51 ` Alexander Gordeev
2024-07-09 19:21 ` Petr Tesařík
2024-07-09 20:55 ` Omar Sandoval
2024-07-10 5:02 ` Petr Tesařík
2024-07-10 8:56 ` Alexander Gordeev
2024-07-11 23:55 ` Omar Sandoval
2024-07-10 8:53 ` Alexander Gordeev
2024-07-11 23:30 ` Omar Sandoval [this message]
2024-07-12 13:42 ` Alexander Gordeev
2024-07-12 14:17 ` Omar Sandoval
2024-07-15 10:06 ` Alexander Gordeev
2024-08-26 8:22 ` Alexander Gordeev
2024-08-27 19:38 ` Omar Sandoval
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=ZpBrDvUpn4SzaqND@telecaster \
--to=osandov@osandov.com \
--cc=agordeev@linux.ibm.com \
--cc=iii@linux.ibm.com \
--cc=linux-debuggers@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=petr@tesarici.cz \
/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