FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor


 
 
LinkBack Thread Tools
 
Old 11-18-2009, 07:00 PM
Darrin Thompson
 
Default kmap

I'm finding a problem struct page in a kdump. I want to trace down
what that page is referring to. For instance, if I could execute
kmap(page), and run rd the pointer returned, what would I find there?
I realize that this may not always be possible. What is the right way
to attempt it? This is x86_64 if it matters.

--
Darrin

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 
Old 11-18-2009, 07:21 PM
Dave Anderson
 
Default kmap

----- "Darrin Thompson" <darrinth@gmail.com> wrote:

> I'm finding a problem struct page in a kdump. I want to trace down
> what that page is referring to. For instance, if I could execute
> kmap(page), and run rd the pointer returned, what would I find there?
> I realize that this may not always be possible. What is the right way
> to attempt it? This is x86_64 if it matters.

If it's an x86_64, then calling kmap(page) ends up doing this
on the page struct address:

__va(page_to_pfn(page) << PAGE_SHIFT);

So, I'm presuming that you know the page structure address, but you
want to know how to access the page data via its kmap'd virtual
address.

So for example, suppose I know that the page structure address
is ffff8100006ef680, then "kmem -p <page-address> shows the
physical address of the referenced page:

crash> kmem -p ffff8100006ef680
PAGE PHYSICAL MAPPING INDEX CNT FLAGS
ffff8100006ef680 2b0000 0 0 1 400
crash>

For x86_64, then it's simply a matter of changing the physical
address into its unity-mapped kernel virtual address (i.e. as
returned by the __va() macro):

crash> ptov 2b0000
VIRTUAL PHYSICAL
ffff8100002b0000 2b0000
crash>

So kmap(0xffff8100006ef680) would return ffff8100002b0000, which
you can "rd":

crash> rd ffff8100002b0000 10
ffff8100002b0000: 0100c70000080805 fff0db31fb000000 ............1...
ffff8100002b0010: 8b485500313e6b05 c931c03145302454 .k>1.UH.T$0E1.1.
ffff8100002b0020: 03f8ba046a0c7a8b 8d4c2c24748b0000 .z.j.......t$,L.
ffff8100002b0030: f5e800000090248c fffffb37e9ffffe4 .$..........7...
ffff8100002b0040: 03398330244c8b48 798300000156860f H.L$0.9...V....y
crash>

Or for what it's worth, you can just read the data using the physical
address:

crash> rd -p 2b0000 10
2b0000: 0100c70000080805 fff0db31fb000000 ............1...
2b0010: 8b485500313e6b05 c931c03145302454 .k>1.UH.T$0E1.1.
2b0020: 03f8ba046a0c7a8b 8d4c2c24748b0000 .z.j.......t$,L.
2b0030: f5e800000090248c fffffb37e9ffffe4 .$..........7...
2b0040: 03398330244c8b48 798300000156860f H.L$0.9...V....y
crash>

I *think* that's what's your asking...

Dave

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 
Old 11-18-2009, 07:33 PM
Darrin Thompson
 
Default kmap

On Wed, Nov 18, 2009 at 3:21 PM, Dave Anderson <anderson@redhat.com> wrote:
> Or for what it's worth, you can just read the data using the physical
> address:
>
> *crash> rd -p 2b0000 10
> * * * * * *2b0000: *0100c70000080805 fff0db31fb000000 * ............1...
> * * * * * *2b0010: *8b485500313e6b05 c931c03145302454 * .k>1.UH.T$0E1.1.

That's exactly what I'm looking for.

When I'm looking at:

kmem -p ffff810104ffd258
PAGE PHYSICAL MAPPING INDEX CNT FLAGS
ffff810104ffd258 16da9d000 0 0 1 168100000000061

How do I get the translation of the flags? I've seen something useful
in vtop but I can never tell if it's giving me flags for the page
struct at the pointer I give or the page struct that would have
pointed the address I gave.

Thanks for the quick help.

--
Darrin

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 
Old 11-18-2009, 07:47 PM
Dave Anderson
 
Default kmap

----- "Darrin Thompson" <darrinth@gmail.com> wrote:

> On Wed, Nov 18, 2009 at 3:21 PM, Dave Anderson <anderson@redhat.com>
> wrote:
> > Or for what it's worth, you can just read the data using the
> physical
> > address:
> >
> > *crash> rd -p 2b0000 10
> > * * * * * *2b0000: *0100c70000080805 fff0db31fb000000 ............1...
> > * * * * * *2b0010: *8b485500313e6b05 c931c03145302454 .k>1.UH.T$0E1.1.
>
> That's exactly what I'm looking for.
>
> When I'm looking at:
>
> kmem -p ffff810104ffd258
> PAGE PHYSICAL MAPPING INDEX CNT FLAGS
> ffff810104ffd258 16da9d000 0 0 1 168100000000061
>
> How do I get the translation of the flags? I've seen something useful
> in vtop but I can never tell if it's giving me flags for the page
> struct at the pointer I give or the page struct that would have
> pointed the address I gave.

The flags you see in the "vtop" output are PTE flags and not page flags.

For the page flags, you'll have to look at the kernel source code
in "include/linux/page-flags.h". The usage of that bit-field changes
way too much for it to be hardwired into the crash utility.

Dave


--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 

Thread Tools




All times are GMT. The time now is 09:53 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org