[Crash-utility] [PATCH v4] Use register value in elf note NT_PRSTATUS to do backtrace

Wang Chao wang.chao at cn.fujitsu.com
Mon May 9 08:16:48 UTC 2011


Hi Dave and all,

Sent on 2011-5-7 0:11, Dave Anderson wrote:

>> 2) Dump notes related information including total number of notes, their
>>    buffers' pointer value and finally offset in the dump file.
>> 3) Move nt_prstatus_percpu and nt_prstatus_percpu to diskdump_data struct.
>>    However, bt command may need sp/ip from the notes later, so I guess
>>    the buffer should not be freed after diskdump_read_header().
> 
> I wish I had understood the s390x implementation a bit better when I
> reviewed your v2 patch.  Currently read_dump_header() malloc's a 
> single "notes_buf" buffer and copies the complete ELF notes section 
> from the dumpfile into it.  I believe (but am not completely sure) that
> the s390x code references pieces of that buffer, and that's why they
> originally kept the "notes_buf" buffer permanently allocated.  That
> being the case, the "notes_buf" pointer should be moved to the
> diskdump header.  
> 
> Anyway, in the case of x86/x86_64, your patch:
> 
> (1) malloc's dd->nt_prstatus_percpu as an array of pointers, 
> (2) malloc's a bunch of individual per-cpu ELF prstatus buffers, and
>     then copies the ELF data from the "notes_buf" buffer into
>     each per-cpu buffer.
> (4) puts a pointer to each per-cpu buffer into each dd->nt_prstatus_percpu
>     pointer.  
> 
> But given that the original "notes_buf" buffer is permanent, your patch
> should only have to store per-cpu pointers into the original note_buf
> buffer -- rather than redundantly malloc'ing a bunch of new buffers that
> contain copies of what's already permanently available.  So I would suggest
> setting it up like this:
> 
>   dd->nt_prstatus_percpu[cpu] => points into relevant "notes_buf" location
> 

Oh, sorry for my misunderstood.

Since we will later refer to ip/sp value in the notes_buf, we should keep the
notes_buf permanently and do not free them at the end of read_diskdump_header.
s390x don't have such problem because the notes are copied to the s390x_cpu_vec
when processing notes_buf.

So just as what you suggested, notes_buf was moved to diskdump header in the
attached v4 patch and nt_prstatus_percpu will store the address in notes_buf then.

Thanks,
Wang Chao
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0001-Use-register-value-in-elf-note-NT_PRSTATUS-to-do-bac.patch
URL: <http://listman.redhat.com/archives/crash-utility/attachments/20110509/3431d509/attachment.ksh>


More information about the Crash-utility mailing list