qemu-patch-raspberry4/include/qemu
Alberto Garcia 67335a4558 throttle: Make burst_length 64bit and add range checks
LeakyBucket.burst_length is defined as an unsigned integer but the
code never checks for overflows and it only makes sure that the value
is not 0.

In practice this means that the user can set something like
throttling.iops-total-max-length=4294967300 despite being larger than
UINT_MAX and the final value after casting to unsigned int will be 4.

This patch changes the data type to uint64_t. This does not increase
the storage size of LeakyBucket, and allows us to assign the value
directly from qemu_opt_get_number() or BlockIOThrottle and then do the
checks directly in throttle_is_valid().

The value of burst_length does not have a specific upper limit,
but since the bucket size is defined by max * burst_length we have
to prevent overflows. Instead of going for UINT64_MAX or something
similar this patch reuses THROTTLE_VALUE_MAX, which allows I/O bursts
of 1 GiB/s for 10 days in a row.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Message-id: 1b2e3049803f71cafb2e1fa1be4fb47147a0d398.1503580370.git.berto@igalia.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2017-08-29 16:54:45 +01:00
..
acl.h
atomic.h docs: fix broken paths to docs/devel/atomics.txt 2017-07-31 13:12:47 +03:00
base64.h
bcd.h
bitmap.h bitmap: add bitmap_copy_and_clear_atomic 2017-04-24 10:12:28 +02:00
bitops.h vnc: replace hweight_long() with ctpopl() 2017-05-12 12:36:02 +02:00
bswap.h
buffer.h
compiler.h use _Static_assert in QEMU_BUILD_BUG_ON 2017-05-05 12:09:59 +02:00
config-file.h
coroutine.h coroutine-lock: add qemu_co_rwlock_downgrade and qemu_co_rwlock_upgrade 2017-07-17 11:28:15 +08:00
coroutine_int.h
cpuid.h util: Introduce include/qemu/cpuid.h 2017-07-24 12:42:55 +01:00
crc32c.h
cutils.h
envlist.h
error-report.h error: Functions to report warnings and informational messages 2017-07-13 13:49:54 +02:00
event_notifier.h
fifo8.h
fifo32.h
fprintf-fn.h
futex.h
hbitmap.h qmp: add x-debug-block-dirty-bitmap-sha256 2017-07-11 17:44:59 +02:00
help_option.h
host-utils.h Drop QEMU_GNUC_PREREQ() checks for gcc older than 4.1 2017-04-20 18:33:33 +01:00
id.h
int128.h
iov.h
jhash.h
log.h
main-loop.h main_loop: Make main_loop_wait() return void 2017-07-04 14:39:28 +02:00
memfd.h
mmap-alloc.h exec, kvm, target-ppc: Move getrampagesize() to common code 2017-03-03 11:30:59 +11:00
module.h qmp: Dumb down how we run QMP command registration 2017-03-05 09:02:10 +01:00
notify.h
option.h keyval: New keyval_parse() 2017-03-07 16:07:46 +01:00
option_int.h
osdep.h osdep: Add runtime OFD lock detection 2017-08-11 14:12:44 +02:00
path.h
processor.h
qdist.h
qht.h
queue.h
range.h
ratelimit.h blockjob: Track job ratelimits via bytes, not sectors 2017-07-10 13:18:06 +02:00
rcu.h Revert "rcu: do not create thread in pthread_atfork callback" 2017-08-08 10:40:19 +02:00
rcu_queue.h
readline.h
seqlock.h
sockets.h util/qemu-sockets: Drop unused helper socket_address_to_string() 2017-07-11 11:18:37 +03:00
stats64.h util: add stats64 module 2017-06-16 07:55:00 +08:00
systemd.h qemu-ga: obey LISTEN_PID when using systemd socket activation 2017-03-19 11:12:12 +01:00
thread-posix.h qemu-thread: Assert locks are initialized before using 2017-07-04 14:39:28 +02:00
thread-win32.h qemu-thread: Assert locks are initialized before using 2017-07-04 14:39:28 +02:00
thread.h
throttle-options.h
throttle.h throttle: Make burst_length 64bit and add range checks 2017-08-29 16:54:45 +01:00
timed-average.h
timer.h timer.h: Provide better monotonic time 2017-06-13 14:56:59 +01:00
typedefs.h qapi: Introduce a first class 'null' type 2017-07-24 13:35:11 +02:00
unicode.h
uri.h
uuid.h
xattr.h