Re: [PATCH v5 23/24] util: add support for formatting thread info in messages

Richard Henderson <[email protected]> Mon, 12 Jan 2026 09:32:21 +1100
Newsgroups org.nongnu.qemu-rust,org.nongnu.qemu-devel
Message-ID <[email protected]>
On 1/9/26 04:03, Daniel P. Berrangé wrote:
> The message context is now extended to be able to include the
> thread ID and thread name, after the program name. On Linux
> the thread ID will match the process TID visible in /proc,
> while on other platforms it will merely be an integer repr
> of the system thread object address/ID.
> 
> This changes the output for both error_report and qemu_log,
> when running under the system emulators or the QEMU storage
> daemon. Other programs omit the thread information since
> they are largely single threaded, though potentially it
> would be useful to enable in all of them, given that the RCU
> thread will always get spawned by a constructor function.
> 
> Before:
> 
>    # qemu-system-x86_64 -object tls-creds-x509,id=t0,dir=fish -d 'trace:qcrypto*'
>    qemu-system-x86_64: qcrypto_tls_creds_x509_load TLS creds x509 load creds=0x560db818e080 dir=fish
>    qemu-system-x86_64: qcrypto_tls_creds_get_path TLS creds path creds=0x560db818e080 filename=ca-cert.pem path=<none>
>    qemu-system-x86_64: Unable to access credentials fish/ca-cert.pem: No such file or directory
> 
> After:
> 
>    # qemu-system-x86_64 -object tls-creds-x509,id=t0,dir=fish -d 'trace:qcrypto*'
>    qemu-system-x86_64: (772366:main): qcrypto_tls_creds_x509_load TLS creds x509 load creds=0x560db818e080 dir=fish
>    qemu-system-x86_64: (772366:main): qcrypto_tls_creds_get_path TLS creds path creds=0x560db818e080 filename=ca-cert.pem path=<none>
>    qemu-system-x86_64: (772366:main): Unable to access credentials fish/ca-cert.pem: No such file or directory
> 
> The '-msg thread-info=on|off' argument is introduced to allow this
> new default output to be supressed if desired.
> 
> Signed-off-by: Daniel P. BerrangĂ©<[email protected]>
> ---
>   include/qemu/message.h               |  1 +
>   qemu-options.hx                      | 10 +++++++---
>   storage-daemon/qemu-storage-daemon.c |  6 ++++++
>   system/vl.c                          | 17 +++++++++++++++--
>   tests/qemu-iotests/041               |  2 +-
>   tests/qemu-iotests/common.filter     |  2 +-
>   util/message.c                       |  7 +++++++
>   7 files changed, 38 insertions(+), 7 deletions(-)

Reviewed-by: Richard Henderson <[email protected]>

r~