524 Commits

Author SHA1 Message Date
Pierrick Bouvier
76b70dcb8f plugins/cpp: register callbacks using captureless lambda
We can now demonstrate what previous changes allow us to do. Since all
callbacks have a userdata pointer, we can use that mechanism to move an
object through all of them.

In other words, we can now have stateful plugins without resorting to
any global variable.

As an example, we implement tb counting plugin with our cpp plugin. It
produces an output similar to hotblocks, with same performance.

Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-27-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
2026-06-16 10:59:05 -07:00
Pierrick Bouvier
285c40aaac plugins: add userdata to qemu_plugin_vcpu_tb_trans_cb_t
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-17-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
2026-06-16 10:59:05 -07:00
Pierrick Bouvier
ab24e19b42 plugins: remove qemu_plugin_id from qemu_plugin_vcpu_tb_trans_cb_t
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-16-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
2026-06-16 10:59:05 -07:00
Pierrick Bouvier
65f399bce2 plugins: remove qemu_plugin_id from qemu_plugin_vcpu_discon_cb_t
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-15-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
2026-06-16 10:59:05 -07:00
Pierrick Bouvier
041dca1e1b plugins: add userdata to qemu_plugin_register_vcpu_discon_cb
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-14-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
2026-06-16 10:59:05 -07:00
Pierrick Bouvier
214d9c0e33 plugins: add userdata to qemu_plugin_register_vcpu_exit_cb
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-9-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
2026-06-16 10:59:05 -07:00
Pierrick Bouvier
7cb918441a plugins: add userdata to qemu_plugin_register_vcpu_init_cb
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-8-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
2026-06-16 10:59:05 -07:00
Pierrick Bouvier
6be156bd4d plugins: remove qemu_plugin_id_t from qemu_plugin_vcpu_simple_cb_t
Not used in all our plugins.
Future commits will remove qemu_plugin_vcpu_simple_cb_t completely, and
replace it with qemu_plugin_vcpu_udata_cb_t, so id information can be
passed using userdata if needed.

Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-7-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
2026-06-16 10:59:05 -07:00
Pierrick Bouvier
32a0ddf36a plugins: remove qemu_plugin_id_t from qemu_plugin_udata_cb_t
We can now rely on userdata being always available to pass down this id
if needed.

In our plugins, only tests/tcg/plugins/reset.c was using it.

Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-6-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
2026-06-16 10:59:05 -07:00
Pierrick Bouvier
d3b790036a plugins: add userdata for qemu_plugin_{uninstall, reset}
We do both at the same time because they internally use the same
implementation.

Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-3-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
2026-06-16 10:59:05 -07:00
Philippe Mathieu-Daudé
5505e1cd02 MAINTAINERS: Update PhilMD's email address
philmd@linaro.org will stop working starting 2026-06-01,
use my personal email instead. Update mailmap and gitdm
accordingly.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@mailo.com>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Message-Id: <20260527065943.92554-1-philmd@linaro.org>
2026-05-27 12:27:22 +02:00
Pierrick Bouvier
068076d4df contrib/plugins/uftrace_symbols.py: handle missing source line from addr2line
Some symbols have only a file information, and no line information. In
this case, addr2line reports '?'. Replace with 0 to guarantee consistent
data for consumers.

Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260424194451.1439316-3-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
2026-04-24 17:30:50 -07:00
Pierrick Bouvier
29d84c34a5 contrib/plugins/uftrace_symbols.py: fix symbols reading
When running this on hexagon binary, we observe some undefined symbols
without any address or size.

Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260424194451.1439316-2-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
2026-04-24 17:30:50 -07:00
Stefan Weil
b7ae542de4 Fix several typos in documentation (found by codespell)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
[Mjt: add 2 fixes suggested by Peter: "as a" and "deactivate"]
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2026-03-23 19:55:24 +03:00
Pierrick Bouvier
48221e3716 contrib/plugins/uftrace.c: fix depth for exit events
Uftrace plugin was recording wrong depth for exit events, resulting in
incoherent traces, especially for partial ones.

Thanks to Honggyu Kim, one of the original author of uftrace, who
spotted the issue.
https://github.com/namhyung/uftrace/pull/2031#issuecomment-4051762627

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260313063441.2048882-1-pierrick.bouvier@linaro.org
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
2026-03-16 16:19:18 -07:00
Akihiko Odaki
2d23a97631 contrib/elf2dmp: Grow PDB URL buffer
The buffers used to construct a PDB URL overflow when the "age" property
is greater than 0xf, so grow it. This also simplifies the logic of the
URL construction to use one buffer instead of two to avoid the chore to
synchronize the sizes of two buffers.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-ID: <20260305-nvme-v4-1-b65b9de1839f@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-03-09 16:45:24 +01:00
Akihiko Odaki
1a1cfc0a32 contrib/plugins/bbv.c: Check if file is NULL
The file pointer can be NULL when e.g., opening the file failed.
vcpu_interval_exec() already implements a NULL-pointer check, but
plugin_exit() misses it. Handle the condition by adding the missing
check to plugin_exit().

Fixes: 0d279bec0f ("contrib/plugins: Add a plugin to generate basic block vectors")
Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260307-bbv-v1-1-d5757d1deac8@rsg.ci.i.u-tokyo.ac.jp
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
2026-03-07 12:59:36 -08:00
Pierrick Bouvier
ca144c21dd contrib/plugins/uftrace_symbols.py: ignore zero sized symbols
When using llvm-addr2line in replacement of addr2line, it will output
zero sized symbols, which can shadow other binaries depending on where
their location is (happens with arm-trusted-firmware and its different
binaries). Thus, ignore those symbols.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260306051553.2778652-1-pierrick.bouvier@linaro.org
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
2026-03-07 12:59:36 -08:00
Pierrick Bouvier
bd3d912b77 contrib/plugins/uftrace_symbols.py: filter out some addr2line error messages
This was found when tracing Hafnium and SLOF binaries, and it's probably
related to a bug in toolchain used. It's safe to ignore those entries,
and related symbols will still be present in output, whether they can be
found or not.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260218172356.938236-1-pierrick.bouvier@linaro.org
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
2026-02-23 17:32:40 -08:00
Peter Maydell
1d893e5069 Merge tag 'for_upstream' of https://git.kernel.org/pub/scm/virt/kvm/mst/qemu into staging
virtio,pc,pci: features, fixes

cxl:
    RAS features
    Back-Invalidate
    Flit mode
    r3.2 spec event updates
    FM-API Physical Switch Command Set support
vhost-vdpa: allow GSO for SVQ

misc fixes, cleanups in intel_iommu, vhost, virtio, acpi

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

# -----BEGIN PGP SIGNATURE-----
#
# iQFDBAABCgAtFiEEXQn9CHHI+FuUyooNKB8NuNKNVGkFAmmYtvkPHG1zdEByZWRo
# YXQuY29tAAoJECgfDbjSjVRpiZ8IAKLpdkPW3mcYwlVgDLIBENu4S3ZzTAthEr+9
# 8qnk0H3eJ6f++OP9wMxwqZ0KcJbrfaB4iDSxd4d42bj6sVzdPhkaaIxnR45V7JiZ
# lQA1aOwhm8Z4vRS3nXBmNhkx6cngO0rzUabX5mzymUrYhtNNJ8HMuSKPU/V3vyW/
# lRXQc5toi2NQ4kbBy9kbPvx5ld5BXfnSmEEYbSsdBZ3Ifk/JCIZ0GWy53FxflbxZ
# FnffxNjy91uN7DVQvgWN0vNzp4r1txkZpoV8PkWqUB7BvtNESb6FXvv+skEG4cM8
# mNlhv0/LCLnyy4uMvSGUvI6IkFKA0WyVAm3O0i+yh1A6+c8VVxI=
# =iYn3
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri Feb 20 19:33:13 2026 GMT
# gpg:                using RSA key 5D09FD0871C8F85B94CA8A0D281F0DB8D28D5469
# gpg:                issuer "mst@redhat.com"
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" [full]
# gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>" [full]
# Primary key fingerprint: 0270 606B 6F3C DF3D 0B17  0970 C350 3912 AFBE 8E67
#      Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA  8A0D 281F 0DB8 D28D 5469

* tag 'for_upstream' of https://git.kernel.org/pub/scm/virt/kvm/mst/qemu: (33 commits)
  vhost: fix vhost_inflight_buffer_pre_load
  virtio-snd: tighten read amount in in_cb
  virtio-snd: fix max_size bounds check in input cb
  virtio-snd: handle 5.14.6.2 for PCM_INFO properly
  virtio-snd: remove TODO comments
  MAINTAINERS: add me as maintainer to virtio-snd
  hw/cxl: Add Physical Port Control FMAPI Command (Opcode 5102h)
  hw/cxl: Get Physical Port State - update for PCIe flit mode
  hw/cxl: Physical Port Info FMAPI - update to current spec and add defines.
  virtio-gpu-virgl: Add virtio-gpu-virgl-hostmem-region type
  intel_iommu: Do not report recoverable faults to host
  net/vhost-vdpa: Whitelist virtio-net GSO for shadow virtqueue
  hw/cxl: Remove register special_ops->read()
  hw/cxl: Support type3 HDM-DB
  tests/acpi/cxl: Update CEDT.cxl to allow BI in CFWMS
  hw/cxl: Update CXL Fixed Memory Window ACPI description to include Back Invalidate support.
  tests/bios-tables-test: Excluded CEDT.cxl for BI restriction relaxation.
  hw/cxl: Refactor component register initialization
  hw/pcie: Support enabling flit mode
  hw/cxl: Add emulation for memory sparing control feature
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2026-02-22 18:58:23 +00:00
Yodel Eldar
fa33e6815e contrib/vhost-user-bridge: Add UDP receive hexdump
vhost-user-bridge debug prints UDP TX hexdumps in its transmit handler,
but does not for receives, even though they are beneficial for testing.
Add an RX hexdump in the receive callback.

To delineate between transmits and receives, also add a debug print
indicating that the program is in the transmit handler.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Yodel Eldar <yodel.eldar@yodel.dev>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20260129133049.119829-4-yodel.eldar@yodel.dev>
2026-02-20 13:04:44 -05:00
Yodel Eldar
42d2c1cc9e tests/vhost-user-bridge: Move to contrib/vhost-user-bridge/
After the introduction of vhost-user-bridge and libvhost-user, we
formed the convention of placing vhost-user daemons in eponymous subdirs
of contrib/. Follow this convention.

Create a contrib/vhost-user-bridge/ directory and move vhost-user-bridge
into it. Extract its build target definition from tests/meson.build into
the new directory, and include its subdir in the root-level meson.build.

Add a section about it in the "vhost-user daemons in contrib" document.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Yodel Eldar <yodel.eldar@yodel.dev>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20260129133049.119829-2-yodel.eldar@yodel.dev>
2026-02-20 13:04:44 -05:00
Pierrick Bouvier
396d005e4b contrib/plugins/cpp: use __has_include
This make sure we can include all possible headers without breaking
build for environments missing them. It fixes compilation on openbsd.

We don't want to pollute configure script, as it's really a special case
here to make sure we don't have a compilation regression with
qemu-plugins header.

Tested-by: John Snow <jsnow@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260214061025.1239457-1-pierrick.bouvier@linaro.org
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
2026-02-19 12:34:11 -08:00
Pierrick Bouvier
e82d8af3da contrib/plugins/uftrace: add riscv64 support
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260210201344.1403613-5-pierrick.bouvier@linaro.org
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
2026-02-12 15:59:48 -08:00
Pierrick Bouvier
c3f8090605 contrib/plugins/uftrace: add ops for walking frame pointers chain
x86_64 and aarch64 use same stack layout. However, other architectures
might use different offset for return address and next frame pointer.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260210201344.1403613-3-pierrick.bouvier@linaro.org
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
2026-02-12 15:59:48 -08:00
Pierrick Bouvier
0b356560e2 contrib/plugins/uftrace: fix infinite stack unwind detection
So far, we were detecting infinite stacks but not stopping unwinding
since break only exited inner loop.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260210201344.1403613-2-pierrick.bouvier@linaro.org
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
2026-02-12 15:59:48 -08:00
Pierrick Bouvier
bed25f00d3 plugins: reduce source conflicts in plugins list
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Link: https://lore.kernel.org/qemu-devel/87cy2uat5e.fsf@draig.linaro.org
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
2026-01-29 09:34:14 -08:00
Pierrick Bouvier
20fc9c3f8b contrib/plugins: add empty cpp plugin
This plugin makes sure we can compile in C++ while including qemu-plugin
header. It includes all C++ standard headers, up to C++23 standard,
minus the ones that are missing in the oldest environments we need to
build for.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260124182921.531562-12-pierrick.bouvier@linaro.org
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
2026-01-29 09:34:14 -08:00
Pierrick Bouvier
ec48ee7866 plugins: use complete filename for defining plugins sources
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260124182921.531562-4-pierrick.bouvier@linaro.org
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
2026-01-29 09:34:14 -08:00
Pierrick Bouvier
e115d55110 plugins: factorize plugin dependencies and library details
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20260124182921.531562-3-pierrick.bouvier@linaro.org
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
2026-01-29 09:34:14 -08:00
Pierrick Bouvier
3b781315cc plugins: move win32_linker.c file to plugins directory
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260124182921.531562-2-pierrick.bouvier@linaro.org
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
2026-01-29 09:34:14 -08:00
Florian Hofhammer
c22ea55b3b plugins: return bool from register r/w API
The qemu_plugin_{read,write} register API previously was inconsistent
with regard to its docstring (where a return value of both -1 and 0
would indicate an error) and to the memory read/write APIs, which
already return a boolean value to indicate success or failure.
Returning the number of bytes read or written is superfluous, as the
GByteArray* passed to the API functions already encodes the length.
See the linked thread for more details.

This patch moves from returning an int (number of bytes read/written) to
returning a bool from the register read/write API, bumps the plugin API
version, and adjusts plugins and tests accordingly.

Signed-off-by: Florian Hofhammer <florian.hofhammer@fhofhammer.de>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Link: https://lore.kernel.org/qemu-devel/f877dd79-1285-4752-811e-f0d430ff27fe@fhofhammer.de
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
2026-01-29 09:34:14 -08:00
Alex Bradbury
0a9754525c contrib/plugins/hotblocks: Allow limit to be set as a command line argument
Also add documentation for this argument. This allows the default of 20
to be overridden, and is helpful for using the hotblocks plugin for
analysis scripts that require collecting data on a larger number of
blocks (e.g. setting limit=0 to dump information on all blocks).

Signed-off-by: Alex Bradbury <asb@igalia.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Link: https://lore.kernel.org/qemu-devel/58281d6e54bcad1802e8d3dc8d8501d54c2a971e.1753857212.git.asb@igalia.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
2026-01-29 09:34:14 -08:00
Alex Bradbury
e777f6ab91 contrib/plugins/hotblocks: Print uint64_t with PRIu64 rather than PRId64
qemu_plugin_u64_sum returns a uint64_t, so PRIu64 is the correct format
specifier.

Signed-off-by: Alex Bradbury <asb@igalia.com>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Link: https://lore.kernel.org/qemu-devel/5d26c9d99ee87ac4a4034ff64e3d8881253eedf3.1753857212.git.asb@igalia.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
2026-01-29 09:34:14 -08:00
Alex Bradbury
1c1e45fcd6 contrib/plugins/hotblocks: Fix off by one error in iteration of sorted blocks
The logic to iterate over the hottest blocks will never reach the last
item in the list, as it checks `it->next != NULL` before entering the
loop. It's hard to trigger this off-by-one error with the default
limit=20, but it is a bug and is problematic if that default is changed
to something larger.

Signed-off-by: Alex Bradbury <asb@igalia.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Link: https://lore.kernel.org/qemu-devel/f1ba2e57c6126472c0c8310774009f2455efc370.1753857212.git.asb@igalia.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
2026-01-29 09:34:14 -08:00
Alex Bradbury
90fabd5dda contrib/plugins/hotblocks: Correctly free sorted counts list
g_list_free should be passed the head of the list.

Signed-off-by: Alex Bradbury <asb@igalia.com>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Link: https://lore.kernel.org/qemu-devel/cf5a00136738b981a12270b76572e8d502daf208.1753857212.git.asb@igalia.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
2026-01-29 09:34:14 -08:00
Sönke Holz
fa2580f574 contrib/plugins/uftrace_symbols.py: unbreak --no-prefix-symbols
Since 8a545a336d, `name` is unbound if --no-prefix-symbols is passed,
causing this script to break when that option is set.

Signed-off-by: Sönke Holz <sholz8530@gmail.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-ID: <20251205105614.13673-1-sholz8530@gmail.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2025-12-05 15:26:39 +00:00
Alex Bennée
f5b6ca5606 contrib/gitdm: add more individual contributors
I only add names explicitly acked as individual contributors.

Acked-by: Sean Wei <me@sean.taipei>
Acked-by: William Kosasih <kosasihwilliam4@gmail.com>
Message-ID: <20251119113953.1432303-10-alex.bennee@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2025-11-24 09:48:18 +00:00
Alex Bennée
e4799403d1 contrib/gitdm: add mapping for Nutanix
We have a number of hackers from Nutanix, make sure they are grouped
together.

Reviewed-by: Jon Kohler <jon@nutanix.com>
Reviewed-by: John Levon <john.levon@nutanix.com>
Message-ID: <20251119113953.1432303-8-alex.bennee@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2025-11-24 09:46:57 +00:00
Alex Bennée
93d39daebe contrib/gitdm: add mapping for Eviden
Reviewed-by: Clement Mathieu--Drif <clement.mathieu--drif@eviden.com>
Message-ID: <20251119113953.1432303-7-alex.bennee@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2025-11-24 09:46:50 +00:00
Alex Bennée
b6690596b2 contrib/gitdm: add University of Tokyo to academic group
From Akihiko:

  I and my colleagues use QEMU for academic microarchitecture
  researches so it is indeed to appropriate to have an entry here.

Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Message-ID: <20251119113953.1432303-6-alex.bennee@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2025-11-24 09:45:40 +00:00
Alex Bennée
9b6ceb6855 contrib/gitdm: add group-map for Microsoft
While we do see contributions from the top-level domain we want to
catch the linux.microsoft subdomain and those contributors also post
via other addresses.

Cc: Magnus Kulke <magnuskulke@linux.microsoft.com>
Acked-by: Wei Liu <wei.liu@kernel.org>
Message-ID: <20251119113953.1432303-4-alex.bennee@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2025-11-24 09:45:30 +00:00
Alex Bennée
4a5df19293 contrib/gitdm: add group-map for Huawei
While we do see contributions from the top-level domain some
contributors also post via other addresses.

Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Message-ID: <20251119113953.1432303-3-alex.bennee@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2025-11-24 09:45:21 +00:00
Julian Ganz
9fe4dd9943 contrib/plugins: add plugin showcasing new dicontinuity related API
We recently introduced new plugin API for registration of discontinuity
related callbacks. This change introduces a minimal plugin showcasing
the new API. It simply counts the occurances of interrupts, exceptions
and host calls per CPU and reports the counts when exitting.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Julian Ganz <neither@nut.email>
Message-ID: <20251027110344.2289945-11-alex.bennee@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2025-10-29 14:12:43 +00:00
Pierrick Bouvier
8a545a336d contrib/plugins/uftrace_symbols.py: generate debug files to map symbols to source
Enhance uftrace_symbols.py to generate .dbg files, containing
source location for every symbol present in .sym file.
It allows to use `uftrace {replay,dump} --srcline` and show origin of
functions, connecting trace to original source code.

It was first implemented with pyelftools DWARF parser, which was way
too slow (~minutes) to get locations for every symbol in the linux
kernel. Thus, we use `addr2line` instead, which runs in seconds.

As well, there were some bugs with latest pyelftools release,
requiring to run master version, which is not installable with pip.
Thus, since we now require binutils (addr2line), we can ditch pyelftools
based implementation and simply rely on `nm` to get symbols information,
which is faster and better.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20251016150357.876415-8-alex.bennee@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2025-10-20 13:46:28 +01:00
Richard W.M. Jones
ed26056d90 block/curl.c: Use explicit long constants in curl_easy_setopt calls
curl_easy_setopt takes a variable argument that depends on what
CURLOPT you are setting.  Some require a long constant.  Passing a
plain int constant is potentially wrong on some platforms.

With warnings enabled, multiple warnings like this were printed:

../block/curl.c: In function ‘curl_init_state’:
../block/curl.c:474:13: warning: call to ‘_curl_easy_setopt_err_long’ declared with attribute warning: curl_easy_setopt expects a long argument [-Wattribute-warning]
  474 |             curl_easy_setopt(state->curl, CURLOPT_AUTOREFERER, 1) ||
      |             ^

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Chenxi Mao <maochenxi@bosc.ac.cn>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20251009141026.4042021-2-rjones@redhat.com>
2025-10-10 08:24:14 -07:00
Pierrick Bouvier
a073d1149e contrib/plugins/uftrace_symbols.py
usage:  contrib/plugins/uftrace_symbols.py \
        --prefix-symbols \
        arm-trusted-firmware/build/qemu/debug/bl1/bl1.elf \
        arm-trusted-firmware/build/qemu/debug/bl2/bl2.elf \
        arm-trusted-firmware/build/qemu/debug/bl31/bl31.elf \
        u-boot/u-boot:0x60000000 \
        u-boot/u-boot.relocated:0x000000023f6b6000 \
        linux/vmlinux

Will generate symbols and memory mapping files for uftrace, allowing to
have an enhanced trace, instead of raw addresses.

It takes a collection of elf files, and automatically find all their
symbols, and generate an ordered memory map based on that.

This script uses the python (native) pyelftools module.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Acked-by: Alex Bennée <alex.bennee@linaro.org>
Message-ID: <20250902075042.223990-9-pierrick.bouvier@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-ID: <20250922093711.2768983-25-alex.bennee@linaro.org>
2025-09-26 10:07:54 +01:00
Pierrick Bouvier
b860d96f00 contrib/plugins/uftrace: implement x64 support
It's trivial to implement x64 support, as it's the same stack layout
as aarch64.

Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-ID: <20250902075042.223990-8-pierrick.bouvier@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-ID: <20250922093711.2768983-24-alex.bennee@linaro.org>
2025-09-26 10:07:54 +01:00
Pierrick Bouvier
7278747595 contrib/plugins/uftrace: generate additional files for uftrace
Beyond traces per cpu, uftrace expect to find some specific files.
- info: contains information about machine/program run
  those values are not impacting uftrace behaviour (only reported by
  uftrace info), and we simply added empty strings.
- memory mapping: how every binary is mapped in memory. For system mode,
  we generate an empty mapping (uftrace_symbols.py, coming in future
  commit, will take care of that). For user mode, we copy current
  /proc/self/maps. We don't need to do any special filtering, as
  reported addresses will necessarily concern guest program, and not
  QEMU and its libraries.
- task: list of tasks. We present every vcpu/privilege level as a
  separate process, as it's the best view we can have when generating a
  (visual) chrome trace. Using threads is less convenient in terms of
  UI.

Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-ID: <20250902075042.223990-7-pierrick.bouvier@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-ID: <20250922093711.2768983-23-alex.bennee@linaro.org>
2025-09-26 10:07:54 +01:00
Pierrick Bouvier
308c20108a contrib/plugins/uftrace: implement privilege level tracing
We add new option trace-privilege-level=bool, which will create a
separate trace for each privilege level.
This allows to follow changes of privilege during execution.

We implement aarch64 operations to track current privilege level
accordingly.

Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-ID: <20250902075042.223990-6-pierrick.bouvier@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-ID: <20250922093711.2768983-22-alex.bennee@linaro.org>
2025-09-26 10:07:54 +01:00