[Crash-utility] x86 remap allocator in kernel 3.0
Petr Tesarik
ptesarik at suse.cz
Thu Jan 12 09:44:19 UTC 2012
Dne St 11. ledna 2012 15:37:50 Dave Anderson napsal(a):
> ----- Original Message -----
>
> > Dne St 11. ledna 2012 00:37:50 Petr Tesarik napsal(a):
> > > [...]
> > > I can see now that this is unnecessarily complicated, because the
> > > node_remap_* variables are static arrays of MAX_NUMNODES elements, so I
> > > can get their size from the debuginfo at POST_GDB init and initialize a
> > > machine-specific data type with it. I'll post another patch tomorrow.
> >
> > And here we go. Tested on my system and seems to work just fine.
> >
> > Petr Tesarik
> > SUSE Linux
>
> Hi Petr,
>
> This looks pretty good to me. However, just to clarify the
> chicken-and-egg situation here...
>
> When remap_init() does these 3 readmem() calls, they will pass
> through x86_kvtop_remap() -- which I guess would fail because
> the arrays would still be at least partially uninitialized?:
Hi Dave,
first of all, it's not a real issue, because kernel static data is always
below the remapped addresses, but I agree, it's ugly and making non-obvious
assumptions about memory layout. To make things clean, I can simply set
machdep->machspec->max_numnodes as the last thing, so the loop in
x86_kvtop_remap() cannot be executed until everything is initialized.
> + readmem(start_vaddr, KVADDR, ms->remap_start_vaddr,
> + ms->max_numnodes * sizeof(ulong), "node_remap_start_vaddr",
> + FAULT_ON_ERROR);
> + readmem(end_vaddr, KVADDR, ms->remap_end_vaddr,
> + ms->max_numnodes * sizeof(ulong), "node_remap_end_vaddr",
> + FAULT_ON_ERROR);
> + readmem(start_pfn, KVADDR, ms->remap_start_pfn,
> + ms->max_numnodes * sizeof(ulong), "node_remap_end_vaddr",
> + FAULT_ON_ERROR);
>
> To fortify this (and put my mind at ease), can we also set a "remap_state"
> flag in the machdep structure that describes the remap data structures in
> maybe two states:
>
> UNINITIALIZED - set at SETUP_ENV time, then cleared in x86_init() before
> remap_init() is called
Denoted by max_numnodes == 0
> NOT_USED - if remap_init() fails
Denoted by max_numnodes < 0
> Then have x86_kvtop_remap() -- which will get called on every readmem() or
> kvtop() for the rest of time, check for (UNINITIALIZED|NOT_USED), and
> return FALSE immediately if either are set?
>
> What do you think?
Patch attached.
Petr Tesarik
SUSE Linux
-------------- next part --------------
A non-text attachment was scrubbed...
Name: crash-x86-remap-allocator.patch
Type: text/x-patch
Size: 6139 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/crash-utility/attachments/20120112/86d45458/attachment.bin>
More information about the Crash-utility
mailing list