On Thu, Sep 11, 2025 at 06:11:47PM +0000, Richard Henderson wrote:
> On 9/10/25 18:03, Daniel P. Berrangé wrote:
> > --- a/storage-daemon/qemu-storage-daemon.c
> > +++ b/storage-daemon/qemu-storage-daemon.c
> > @@ -47,6 +47,7 @@
> >   #include "qemu/cutils.h"
> >   #include "qemu/config-file.h"
> >   #include "qemu/error-report.h"
> > +#include "qemu/message.h"
> >   #include "qemu/help_option.h"
> >   #include "qemu/job.h"
> >   #include "qemu/log.h"
> > @@ -65,6 +66,10 @@ static const char *pid_file;
> >   static char *pid_file_realpath;
> >   static volatile bool exit_requested = false;
> > +#define QMESSAGE_FORMAT_DEFAULT \
> > +    (QMESSAGE_FORMAT_PROGRAM_NAME | \
> > +     QMESSAGE_FORMAT_THREAD_INFO)
> > +
> >   void qemu_system_killed(int signal, pid_t pid)
> >   {
> >       exit_requested = true;
> > @@ -399,6 +404,7 @@ int main(int argc, char *argv[])
> >   #endif
> >       error_init(argv[0]);
> > +    qmessage_set_format(QMESSAGE_FORMAT_DEFAULT);
> >       qemu_init_exec_dir(argv[0]);
> >       os_setup_signal_handling();
> > diff --git a/system/vl.c b/system/vl.c
> > index 9030212c50..20b655a7bc 100644
> > --- a/system/vl.c
> > +++ b/system/vl.c
> > @@ -145,6 +145,10 @@
> >   #define MAX_VIRTIO_CONSOLES 1
> > +#define QMESSAGE_FORMAT_DEFAULT \
> > +    (QMESSAGE_FORMAT_PROGRAM_NAME | \
> > +     QMESSAGE_FORMAT_THREAD_INFO)
> > +
> >   typedef struct BlockdevOptionsQueueEntry {
> >       BlockdevOptions *bdo;
> >       Location loc;
> > @@ -811,10 +815,9 @@ static void realtime_init(void)
> >       }
> >   }
> > -
> >   static void configure_msg(QemuOpts *opts)
> >   {
> > -    int flags = QMESSAGE_FORMAT_PROGRAM_NAME;
> > +    int flags = QMESSAGE_FORMAT_DEFAULT;
> >       if (qemu_opt_get_bool(opts, "timestamp", false)) {
> >           flags |= QMESSAGE_FORMAT_TIMESTAMP;
> >       }
> > @@ -2888,6 +2891,7 @@ void qemu_init(int argc, char **argv)
> >       module_call_init(MODULE_INIT_OPTS);
> >       error_init(argv[0]);
> > +    qmessage_set_format(QMESSAGE_FORMAT_DEFAULT);
> 
> Worth a static initial value of the variable, rather than require two other 
> startup calls?

NB, the qmessage stuff is linked into all our other binaries too,
and so I only wanted to turn on thread info for the subset of
binaries that are likely to be using multiple threads. Then
again, posibly both qemu-nbd and qemu-img might use threads
in some scenarios

> This also seems like it should be a separate patch from adding THREAD_INFO
> to qmessage_context_print.

Sure, I can do that.


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


Reply via email to