mirror of
https://github.com/Motorhead1991/qemu.git
synced 2026-02-11 19:39:26 -07:00
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1 iQEcBAABAgAGBQJVevNrAAoJEJykq7OBq3PIn3wH/iTkoxK+8c6vHY4gAyW/3Vel JAWyDULliLg/mJiyDyz+9hbyb3FmDsQ7Gve5laFCqSES8IChe/fAoR2dXAapHbJm VroBii+C4MIakAjB1eSGVTMeJVgyq0SxCbEgo6MSgCNRg8pH/ne4kGMn0elsyMQm VrxqsoW1qda0gLbybu7uRKmdZlb5Eklk0zQmBlzd25j3xgMXmo7ZcXW0d7dCi/xd ot01aPNHWKy2FyYsI+N1SMagCedjn0FFCHMMc08W34olUOAschV+Croxi6gupbTl RdlYNnB6BBYLgT7mxYuKKd20r4Q8Si3E5YjIsYaXIskbCOxDuryKboyheMXWqdA= =mx5x -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging # gpg: Signature made Fri Jun 12 15:57:47 2015 BST using RSA key ID 81AB73C8 # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" # gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" * remotes/stefanha/tags/block-pull-request: qemu-iotests: expand test 093 to support group throttling throttle: Update throttle infrastructure copyright throttle: add the name of the ThrottleGroup to BlockDeviceInfo throttle: acquire the ThrottleGroup lock in bdrv_swap() throttle: Add throttle group support throttle: Add throttle group infrastructure tests throttle: Add throttle group infrastructure throttle: Extract timers from ThrottleState into a separate structure raw-posix: Fix .bdrv_co_get_block_status() for unaligned image size Revert "iothread: release iothread around aio_poll" Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
8aeaa055f5
21 changed files with 958 additions and 223 deletions
|
|
@ -173,8 +173,9 @@ void bdrv_stats_print(Monitor *mon, const QObject *data);
|
|||
void bdrv_info_stats(Monitor *mon, QObject **ret_data);
|
||||
|
||||
/* disk I/O throttling */
|
||||
void bdrv_io_limits_enable(BlockDriverState *bs);
|
||||
void bdrv_io_limits_enable(BlockDriverState *bs, const char *group);
|
||||
void bdrv_io_limits_disable(BlockDriverState *bs);
|
||||
void bdrv_io_limits_update_group(BlockDriverState *bs, const char *group);
|
||||
|
||||
void bdrv_init(void);
|
||||
void bdrv_init_with_whitelist(void);
|
||||
|
|
|
|||
|
|
@ -379,9 +379,14 @@ struct BlockDriverState {
|
|||
unsigned int serialising_in_flight;
|
||||
|
||||
/* I/O throttling */
|
||||
ThrottleState throttle_state;
|
||||
CoQueue throttled_reqs[2];
|
||||
bool io_limits_enabled;
|
||||
/* The following fields are protected by the ThrottleGroup lock.
|
||||
* See the ThrottleGroup documentation for details. */
|
||||
ThrottleState *throttle_state;
|
||||
ThrottleTimers throttle_timers;
|
||||
unsigned pending_reqs[2];
|
||||
QLIST_ENTRY(BlockDriverState) round_robin;
|
||||
|
||||
/* I/O stats (display with "info blockstats"). */
|
||||
BlockAcctStats stats;
|
||||
|
|
|
|||
46
include/block/throttle-groups.h
Normal file
46
include/block/throttle-groups.h
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* QEMU block throttling group infrastructure
|
||||
*
|
||||
* Copyright (C) Nodalink, EURL. 2014
|
||||
* Copyright (C) Igalia, S.L. 2015
|
||||
*
|
||||
* Authors:
|
||||
* Benoît Canet <benoit.canet@nodalink.com>
|
||||
* Alberto Garcia <berto@igalia.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 or
|
||||
* (at your option) version 3 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef THROTTLE_GROUPS_H
|
||||
#define THROTTLE_GROUPS_H
|
||||
|
||||
#include "qemu/throttle.h"
|
||||
#include "block/block_int.h"
|
||||
|
||||
const char *throttle_group_get_name(BlockDriverState *bs);
|
||||
|
||||
void throttle_group_config(BlockDriverState *bs, ThrottleConfig *cfg);
|
||||
void throttle_group_get_config(BlockDriverState *bs, ThrottleConfig *cfg);
|
||||
|
||||
void throttle_group_register_bs(BlockDriverState *bs, const char *groupname);
|
||||
void throttle_group_unregister_bs(BlockDriverState *bs);
|
||||
|
||||
void coroutine_fn throttle_group_co_io_limits_intercept(BlockDriverState *bs,
|
||||
unsigned int bytes,
|
||||
bool is_write);
|
||||
|
||||
void throttle_group_lock(BlockDriverState *bs);
|
||||
void throttle_group_unlock(BlockDriverState *bs);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,10 +1,12 @@
|
|||
/*
|
||||
* QEMU throttling infrastructure
|
||||
*
|
||||
* Copyright (C) Nodalink, SARL. 2013
|
||||
* Copyright (C) Nodalink, EURL. 2013-2014
|
||||
* Copyright (C) Igalia, S.L. 2015
|
||||
*
|
||||
* Author:
|
||||
* Benoît Canet <benoit.canet@irqsave.net>
|
||||
* Authors:
|
||||
* Benoît Canet <benoit.canet@nodalink.com>
|
||||
* Alberto Garcia <berto@igalia.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
|
|
@ -65,14 +67,17 @@ typedef struct ThrottleConfig {
|
|||
typedef struct ThrottleState {
|
||||
ThrottleConfig cfg; /* configuration */
|
||||
int64_t previous_leak; /* timestamp of the last leak done */
|
||||
QEMUTimer * timers[2]; /* timers used to do the throttling */
|
||||
} ThrottleState;
|
||||
|
||||
typedef struct ThrottleTimers {
|
||||
QEMUTimer *timers[2]; /* timers used to do the throttling */
|
||||
QEMUClockType clock_type; /* the clock used */
|
||||
|
||||
/* Callbacks */
|
||||
QEMUTimerCB *read_timer_cb;
|
||||
QEMUTimerCB *write_timer_cb;
|
||||
void *timer_opaque;
|
||||
} ThrottleState;
|
||||
} ThrottleTimers;
|
||||
|
||||
/* operations on single leaky buckets */
|
||||
void throttle_leak_bucket(LeakyBucket *bkt, int64_t delta);
|
||||
|
|
@ -86,20 +91,23 @@ bool throttle_compute_timer(ThrottleState *ts,
|
|||
int64_t *next_timestamp);
|
||||
|
||||
/* init/destroy cycle */
|
||||
void throttle_init(ThrottleState *ts,
|
||||
AioContext *aio_context,
|
||||
QEMUClockType clock_type,
|
||||
void (read_timer)(void *),
|
||||
void (write_timer)(void *),
|
||||
void *timer_opaque);
|
||||
void throttle_init(ThrottleState *ts);
|
||||
|
||||
void throttle_destroy(ThrottleState *ts);
|
||||
void throttle_timers_init(ThrottleTimers *tt,
|
||||
AioContext *aio_context,
|
||||
QEMUClockType clock_type,
|
||||
QEMUTimerCB *read_timer_cb,
|
||||
QEMUTimerCB *write_timer_cb,
|
||||
void *timer_opaque);
|
||||
|
||||
void throttle_detach_aio_context(ThrottleState *ts);
|
||||
void throttle_timers_destroy(ThrottleTimers *tt);
|
||||
|
||||
void throttle_attach_aio_context(ThrottleState *ts, AioContext *new_context);
|
||||
void throttle_timers_detach_aio_context(ThrottleTimers *tt);
|
||||
|
||||
bool throttle_have_timer(ThrottleState *ts);
|
||||
void throttle_timers_attach_aio_context(ThrottleTimers *tt,
|
||||
AioContext *new_context);
|
||||
|
||||
bool throttle_timers_are_initialized(ThrottleTimers *tt);
|
||||
|
||||
/* configuration */
|
||||
bool throttle_enabled(ThrottleConfig *cfg);
|
||||
|
|
@ -108,12 +116,16 @@ bool throttle_conflicting(ThrottleConfig *cfg);
|
|||
|
||||
bool throttle_is_valid(ThrottleConfig *cfg);
|
||||
|
||||
void throttle_config(ThrottleState *ts, ThrottleConfig *cfg);
|
||||
void throttle_config(ThrottleState *ts,
|
||||
ThrottleTimers *tt,
|
||||
ThrottleConfig *cfg);
|
||||
|
||||
void throttle_get_config(ThrottleState *ts, ThrottleConfig *cfg);
|
||||
|
||||
/* usage */
|
||||
bool throttle_schedule_timer(ThrottleState *ts, bool is_write);
|
||||
bool throttle_schedule_timer(ThrottleState *ts,
|
||||
ThrottleTimers *tt,
|
||||
bool is_write);
|
||||
|
||||
void throttle_account(ThrottleState *ts, bool is_write, uint64_t size);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue