Block patches
The following changes since commit bec9c64ef7be8063f1192608b83877bc5c9ea217:
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2018-02-13 18:24:08 +0000)
are available in the Git repository at:
git://github.com/stefanha/qemu.git tags/block-pull-request
for you to fetch changes up to d2f668b74907cbd96d9df0774971768ed06de2f0:
misc: fix spelling (2018-02-15 09:39:49 +0000)
----------------------------------------------------------------
Pull request
v2:
* Dropped Fam's git-publish series because there is still ongoing discussion
----------------------------------------------------------------
Marc-André Lureau (1):
misc: fix spelling
Stefan Hajnoczi (1):
vl: pause vcpus before stopping iothreads
Wolfgang Bumiller (1):
ratelimit: don't align wait time with slices
include/qemu/ratelimit.h | 11 +++++------ util/qemu-coroutine-lock.c | 2 +- vl.c | 12 ++++++++++-- 3 files changed, 16 insertions(+), 9 deletions(-)
Signature · 1 line
2.14.3
[Qemu-devel] [PULL v2 1/3] vl: pause vcpus before stopping iothreads
Commit dce8921b2baaf95974af8176406881872067adfa ("iothread: Stop threads before main() quits") introduced iothread_stop_all() to avoid the following virtio-scsi assertion failure:
assert(blk_get_aio_context(d->conf.blk) == s->ctx);
Back then the assertion failed because when bdrv_close_all() made d->conf.blk NULL, blk_get_aio_context() returned the global AioContext instead of s->ctx.
The same assertion can still fail today when vcpus submit new I/O requests after iothread_stop_all() has moved the BDS to the global AioContext.
This patch hardens the iothread_stop_all() approach by pausing vcpus before calling iothread_stop_all().
Note that the assertion failure is a race condition. It is not possible to reproduce it reliably.
Message-id: [email protected]
--- vl.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
vl.c +10 -2
@@ -4767,10 +4767,18 @@ int main(int argc, char **argv, char **envp)main_loop ();replay_disable_events (); + +/* The ordering of the following is delicate. Stop vcpus to prevent new +* I/O requests being queued by the guest. Then stop IOThreads (this +* includes a drain operation and completes all request processing). At +* this point emulated devices are still associated with their IOThreads +* (if any) but no longer have any work to do. Only then can we close +* block devices safely because we know there is no more I/O coming. +*/ +pause_all_vcpus ();iothread_stop_all (); - -pause_all_vcpus ();bdrv_close_all (); +res_free ();/* vhost-user must be cleaned up before chardevs. */
Signature · 1 line
2.14.3
[Qemu-devel] [PULL v2 2/3] ratelimit: don't align wait time with slices
In reply to Stefan HajnocziFrom: Wolfgang Bumiller <[email protected]>
It is possible for rate limited writes to keep overshooting a slice's quota by a tiny amount causing the slice-aligned waiting period to effectively halve the rate.
Message-id: [email protected]
--- include/qemu/ratelimit.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
include/qemu/ratelimit.h +5 -6
@@ -36,7 +36,7 @@ typedef struct {static inline int64_t ratelimit_calculate_delay (RateLimit *limit,uint64_t n) {int64_t now =qemu_clock_get_ns (QEMU_CLOCK_REALTIME ); -uint64_t delay_slices; +double delay_slices;assert (limit->slice_quota && limit->slice_ns);
@@ -55,12 +55,11 @@ static inline int64_t ratelimit_calculate_delay(RateLimit *limit, uint64_t n)return 0 ; } -/* Quota exceeded. Calculate the next time slice we may start -* sending data again. */ - delay_slices = (limit->dispatched + limit->slice_quota -1 ) / - limit->slice_quota; +/* Quota exceeded. Wait based on the excess amount and then start a new +* slice. */ + delay_slices = (double )limit->dispatched / limit->slice_quota; limit->slice_end_time = limit->slice_start_time + - delay_slices * limit->slice_ns; + (uint64_t )(delay_slices * limit->slice_ns);return limit->slice_end_time - now; }
Signature · 1 line
2.14.3
[Qemu-devel] [PULL v2 3/3] misc: fix spelling
In reply to Stefan HajnocziFrom: Marc-André Lureau <[email protected]>
s/pupulate/populate
Message-id: [email protected]
--- util/qemu-coroutine-lock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
util/qemu-coroutine-lock.c +1 -1
@@ -89,7 +89,7 @@ void qemu_co_queue_run_restart(Coroutine *co)* invalid memory. Therefore, use a temporary queue and do not touch * the "co" coroutine as soon as you enter another one. * -* In its turn resumed "co" can pupulate "co_queue_wakeup" queue with +* In its turn resumed "co" can populate "co_queue_wakeup" queue with * new coroutines to be woken up. The caller, who has resumed "co", * will be responsible for traversing the same queue, which may cause * a different wakeup order but not any missing wakeups.
Signature · 1 line
2.14.3
Peter Maydell
AppliedQuoted 26 lines · Stefan Hajnoczi
The following changes since commit
bec9c64ef7be8063f1192608b83877bc5c9ea217:Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2018-02-13 18:24:08 +0000)
are available in the Git repository at:
git://github.com/stefanha/qemu.gittags/block-pull-requestfor you to fetch changes up to
d2f668b74907cbd96d9df0774971768ed06de2f0:misc: fix spelling (2018-02-15 09:39:49 +0000)
----------------------------------------------------------------
Pull requestv2:
* Dropped Fam's git-publish series because there is still ongoing discussion----------------------------------------------------------------
Marc-André Lureau (1):
misc: fix spellingStefan Hajnoczi (1):
vl: pause vcpus before stopping iothreads
Quoted 7 lines
Wolfgang Bumiller (1):
ratelimit: don't align wait time with slicesinclude/qemu/ratelimit.h | 11 +++++------ util/qemu-coroutine-lock.c | 2 +- vl.c | 12 ++++++++++-- 3 files changed, 16 insertions(+), 9 deletions(-)
Applied, thanks.
-- PMM