qemu-e2k/include
Paolo Bonzini 4951967d84 ratelimit: protect with a mutex
Right now, rate limiting is protected by the AioContext mutex, which is
taken for example both by the block jobs and by qmp_block_job_set_speed
(via find_block_job).

We would like to remove the dependency of block layer code on the
AioContext mutex, since most drivers and the core I/O code are already
not relying on it.  However, there is no existing lock that can easily
be taken by both ratelimit_set_speed and ratelimit_calculate_delay,
especially because the latter might run in coroutine context (and
therefore under a CoMutex) but the former will not.

Since concurrent calls to ratelimit_calculate_delay are not possible,
one idea could be to use a seqlock to get a snapshot of slice_ns and
slice_quota.  But for now keep it simple, and just add a mutex to the
RateLimit struct; block jobs are generally not performance critical to
the point of optimizing the clock cycles spent in synchronization.

This also requires the introduction of init/destroy functions, so
add them to the two users of ratelimit.h.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-05-04 14:15:35 +02:00
..
authz Prefer 'on' | 'off' over 'yes' | 'no' for bool options 2021-01-29 17:07:53 +00:00
block block: Add BDRV_O_NO_SHARE for blk_new_open() 2021-04-30 12:27:48 +02:00
chardev chardev: Fix yank with the chardev-change case 2021-04-01 15:27:44 +04:00
crypto crypto: add reload for QCryptoTLSCredsClass 2021-03-23 08:48:21 +01:00
disas Hexagon (disas) disassembler 2021-02-18 07:48:22 -08:00
exec exec: Remove accel/tcg/ from include paths 2021-05-01 11:44:13 -07:00
fpu softfloat: Define comparison operations for bfloat16 2020-08-29 19:25:42 -07:00
hw hw/pci-host/gpex: Don't fault for unmapped parts of MMIO and PIO windows 2021-04-30 11:16:52 +01:00
io io: add qio_channel_readv_full_all_eof & qio_channel_readv_full_all helpers 2021-02-10 09:23:28 +00:00
libdecnumber include: Make headers more self-contained 2019-08-16 13:31:51 +02:00
migration migration: Inhibit virtio-balloon for the duration of background snapshot 2021-04-06 18:56:01 +01:00
monitor migrate: remove QMP/HMP commands for speed, downtime and cache size 2021-03-18 09:22:55 +00:00
net net: check the existence of peer before trying to pad 2021-04-23 11:11:28 +01:00
qapi Revert "hmp: Use QAPI NetdevInfo in hmp_info_network" 2021-04-08 17:33:59 +08:00
qemu ratelimit: protect with a mutex 2021-05-04 14:15:35 +02:00
qom qom: move user_creatable_add_opts logic to vl.c and QAPIfy it 2021-03-19 10:18:17 +01:00
scsi scsi: inline sg_io_sense_from_errno() into the callers. 2021-03-06 11:42:56 +01:00
semihosting semihosting: Move include/hw/semihosting/ -> include/semihosting/ 2021-03-10 15:34:12 +00:00
standard-headers m68k pull request 20210315 2021-03-17 10:38:27 +00:00
sysemu Add NVMM accelerator: acceleration enlightenments 2021-05-04 14:15:34 +02:00
tcg tcg/tci: Implement the disassembler properly 2021-03-17 07:24:44 -06:00
ui include/ui/console.h: Delete is_surface_bgr() 2021-03-23 08:48:21 +01:00
user trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
elf.h Remove deprecated target tilegx 2021-03-09 11:26:32 +01:00
glib-compat.h glib-compat: add g_unix_get_passwd_entry_qemu() 2020-11-02 19:52:08 -06:00
qemu-common.h qemu-common.h: Update copyright string to 2021 2021-03-09 22:19:24 +01:00
qemu-io.h Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
trace-tcg.h trace: get rid of generated-events.h/generated-events.c 2016-10-12 09:54:52 +02:00