lkml.org 
[lkml]   [2013]   [Jun]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v5 1/5] vmcore: Introduce ELF header in new memory feature
On Thu, Jun 27, 2013 at 03:32:02PM -0400, Vivek Goyal wrote:
> On Fri, Jun 21, 2013 at 04:17:03PM +0200, Michael Holzheu wrote:
> > On Fri, 14 Jun 2013 14:54:02 -0400
> > Vivek Goyal <vgoyal@redhat.com> wrote:
> >
> > > On Fri, Jun 07, 2013 at 06:55:57PM +0200, Michael Holzheu wrote:
> > >
> > > [..]
> > > > @@ -935,10 +967,17 @@ static int __init vmcore_init(void)
> > > > {
> > > > int rc = 0;
> > > >
> > > > - /* If elfcorehdr= has been passed in cmdline, then capture the dump.*/
> > > > - if (!(is_vmcore_usable()))
> > > > - return rc;
> > > > + /*
> > > > + * If elfcorehdr= has not been passed in cmdline, try to get the
> > > > + * header from 2nd kernel, then capture the dump.
> > > > + */
> > > > + if (!(is_vmcore_usable())) {
> > > > + rc = elfcorehdr_alloc();
> > > > + if (rc)
> > > > + return rc;
> > > > + }
> > >
> > > Hi Michael,
> > >
> > > Patch description says that elfcorehdr_alloc() returns the addr and
> > > size of elf headers. But that does not seem to be the case here. Has
> > > it been modified in later patches.
> >
> > Sorry, that is a relict of one of my previous experiments where I tried
> > to implement elfcorehdr_addr() similar to the way as you suggest it now.
> > Because elfcorehdr_addr is a global variable, I decided to not pass
> > it in the functions. But of course I can change that again if you prefer
> > that.
> >
> > > Also will it be better if we call elfcorehdr_alloc() always and then
> > > check for is_vmcore_usable().
> > >
> > > Something like.
> > >
> > > elfcorehdr_addr = elfcorehdr_alloc()
> > > if (elfcorehdr_addr < )
> > > return elfcorehdr_addr
> > >
> > > if (!(is_vmcore_usable()))
> > > return error
> >
> > Ok, but then I think elfcorehdr_alloc() should also return
> > the elfcorehdr_size.
> >
> > So what about the following patch:
>
> This patch looks good to me. There are little ugly pieces w.r.t not
> setting elfcorehdr_addr null after calling free() as there are other
> pieces depdendent on elfcorehdr_addr. I think sometime later we can
> have a separate variable to track track whether this is kdump kernel
> and remove dependency on elfcorehdr_addr being set.

Hi Michael,

Thinking more about it, I think let us cleanup with this little ugly
bit too so that future changes become easy.

Current convention is that elfcorehdr_addr and elfcorehdr_size are
already set by arch code by the time vmcore.c starts reading it. Can't
s390 allocate elf headers in early boot code and elfcorehdr_addr? Then
we don't have to call elfcorehdr_alloc().

And once we are done with reading headers, we can call elfcorehdr_free()
and s390 could free memory and set elfcorehdr_addr to ELFCORE_ADDR_ERR
and elfcorehdr_size=0. That would signify that one can not try to read
elf headers now and it must have been freed.

is_kdump_kernel() will continue to work as elfcorehdr_addr is
ELFCORE_ADDR_ERR. And that will mean that either elfcorehdr were not
readable/usable to begin with or they have been freed now.

Thanks
Vivek


\
 
 \ /
  Last update: 2013-06-27 23:01    [W:0.248 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site