Daniel P. Berrangé <[email protected]> writes: > Introduce a new subsystem "tldr" aka "thrifty live data recorder" > that will be able to continuously collect certain information at > runtime and dump that in a crash report when QEMU exits abnormally. > As a second use case, it will support manual triggering on interesting > events such as guest OS panic.
What's manual about that? > Initially the framework does nothing except print the signal > information. Later commits will introduce broader data collection. > This relies on the dummy siginfo_t struct for portability to Windows. > > Signed-off-by: Daniel P. Berrangé <[email protected]> [...] > diff --git a/qapi/qom.json b/qapi/qom.json > index 49f222796ab..1c9031fba9a 100644 > --- a/qapi/qom.json > +++ b/qapi/qom.json > @@ -1233,6 +1233,19 @@ > 'data': { '*pretty': 'bool', > '*close-action': 'MonitorQMPCloseAction' } } > > +## > +# @QTLDRConfigProperties: > +# Configuration for data recorder > +# > +# @crash-target: fully qualified path to perserve data recorder > +# contents on QEMU crash What's a "fully qualified path"? Do you mean what POSIX calls "absolute pathname"? Please format member descriptions like this: # @crash-target: fully qualified path to perserve data recorder # contents on QEMU crash > +# > +# Since: 11.2.0 > +## > +{ 'struct': 'QTLDRConfigProperties', > + 'data': { '*crash-target': 'str' } > +} > + > ## > # @ObjectType: > # > @@ -1302,6 +1315,7 @@ > 's390-pv-guest', > 'tdx-guest', > 'throttle-group', > + 'tldr-config', > 'tls-creds-anon', > 'tls-creds-psk', > 'tls-creds-x509', > @@ -1379,6 +1393,7 @@ > 'tdx-guest': 'TdxGuestProperties', > 'thread-context': 'ThreadContextProperties', > 'throttle-group': 'ThrottleGroupProperties', > + 'tldr-config': 'QTLDRConfigProperties', > 'tls-creds-anon': 'TlsCredsAnonProperties', > 'tls-creds-psk': 'TlsCredsPskProperties', > 'tls-creds-x509': 'TlsCredsX509Properties', > diff --git a/qemu-options.hx b/qemu-options.hx > index 2f6863180b0..2f63d86b635 100644 > --- a/qemu-options.hx > +++ b/qemu-options.hx > @@ -6682,6 +6682,20 @@ SRST > :: > > (qemu) qom-set /objects/iothread1 poll-max-ns 100000 > + > + > + ``-object tldr-config,id=id,crash-target=path`` > + Creating the ``tldr-config`` object enables the thrifty live data > + recorder, which continuously captures important information about > + the operation of the QEMU process. When a SIGSEGV, SIGBUS, > + SIGILL, SIGFPE or SIGABRT are seen the contents of the data > + recorder will be dumped to the stderr stream. If the > + ``crash-target`` parameter was given, that specifies a fully > + qualified file path to write the dump to instead of stderr. > + > + The ``tldr-config`` object can be added at initial startup > + or via QMP at runtime. Once created, however, it is not > + permitted to disable it. Call the object "tldr"? > ERST > > [...] > diff --git a/util/tldr-internal.h b/util/tldr-internal.h > new file mode 100644 > index 00000000000..193d8425eee > --- /dev/null > +++ b/util/tldr-internal.h > @@ -0,0 +1,21 @@ > +/* > + * SPDX-License-Identifier: GPL-2.0-or-later > + * > + * TL;DR: Thrifty Live Data Recorder > + * > + * Copyright (C) 2026 Red Hat Inc. > + */ > + > +#ifndef QEMU_TLDR_INTERNAL_H__ > +#define QEMU_TLDR_INTERNAL_H__ > + > +#include "qemu/tldr.h" > + > +#define QTLDR_DUMP_LEADER "\n🚨🚨🚨 QEMU Data Recorder Start 🚨🚨🚨\n" > +#define QTLDR_DUMP_TRAILER "\n🚨🚨🚨 QEMU Data Recorder End 🚨🚨🚨\n\n" > +#define QTLDR_DUMP_TRIGGER_PREFIX "\n🔍 Trigger:" > +#define QTLDR_DUMP_OPEN_ERROR "🔥 Unable to dump to '" The emojis make the dump file UTF-8. Fine, I guess? > + > +void qtldr_crash_dump_internal(int fd, siginfo_t *si); > + > +#endif /* QEMU_TLDR_INTERNAL_H__ */ [...]
