]> git.proxmox.com Git - mirror_qemu.git/commit - include/hw/core/cpu.h
accel: introduce accelerator blocker API
authorEmanuele Giuseppe Esposito <eesposit@redhat.com>
Fri, 11 Nov 2022 15:47:56 +0000 (10:47 -0500)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 11 Jan 2023 08:59:39 +0000 (09:59 +0100)
commitbd688fc93120fb3e28aa70e3dfdf567ccc1e0bc1
treed763c7b30c195a31dedf67d708b7d770fd16b5ef
parentb585edca34a817fdb751dfe94fbd3cde32ffe60d
accel: introduce accelerator blocker API

This API allows the accelerators to prevent vcpus from issuing
new ioctls while execting a critical section marked with the
accel_ioctl_inhibit_begin/end functions.

Note that all functions submitting ioctls must mark where the
ioctl is being called with accel_{cpu_}ioctl_begin/end().

This API requires the caller to always hold the BQL.
API documentation is in sysemu/accel-blocker.h

Internally, it uses a QemuLockCnt together with a per-CPU QemuLockCnt
(to minimize cache line bouncing) to keep avoid that new ioctls
run when the critical section starts, and a QemuEvent to wait
that all running ioctls finish.

Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20221111154758.1372674-2-eesposit@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
accel/accel-blocker.c [new file with mode: 0644]
accel/meson.build
hw/core/cpu-common.c
include/hw/core/cpu.h
include/sysemu/accel-blocker.h [new file with mode: 0644]
util/meson.build