dump: Allow directly outputting raw kdump format
commitd43a01db285fd10f9c429476eb9c63fa5e00f3cc
authorStephen Brennan <stephen.s.brennan@oracle.com>
Mon, 18 Sep 2023 23:32:32 +0000 (18 16:32 -0700)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Thu, 2 Nov 2023 14:05:02 +0000 (2 18:05 +0400)
tree7681881c718c77c9bb9770a4b0cc74708ef354fa
parent4d7dd4ed4f42e659a214e4f81c1a15ee991352df
dump: Allow directly outputting raw kdump format

The flattened format (currently output by QEMU) is used by makedumpfile
only when it is outputting a vmcore to a file which is not seekable. The
flattened format functions essentially as a set of instructions of the
form "seek to the given offset, then write the given bytes out".

The flattened format can be reconstructed using makedumpfile -R, or
makedumpfile-R.pl, but it is a slow process because it requires copying
the entire vmcore. The flattened format can also be directly read by
crash, but still, it requires a lengthy reassembly phase.

To sum up, the flattened format is not an ideal one: it should only be
used on files which are actually not seekable. This is the exact
strategy which makedumpfile uses, as seen in the implementation of
"write_buffer()" in makedumpfile [1]. However, QEMU has always used the
flattened format. For compatibility it is best not to change the default
output format without warning. So, add a flag to DumpState which changes
the output to use the normal (i.e. raw) format. This flag will be added
to the QMP and HMP commands in the next change.

[1]: https://github.com/makedumpfile/makedumpfile/blob/f23bb943568188a2746dbf9b6692668f5a2ac3b6/makedumpfile.c#L5008-L5040

Signed-off-by: Stephen Brennan <stephen.s.brennan@oracle.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
[ Marc-André: replace loff_t with off_t ]
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20230918233233.1431858-3-stephen.s.brennan@oracle.com>
dump/dump.c
include/sysemu/dump.h