Blame SOURCES/kvm-coroutine-Rename-qemu_coroutine_inc-dec_pool_size.patch

29b115
From e3cb8849862a9f0dd20f2913d540336a037d43c7 Mon Sep 17 00:00:00 2001
29b115
From: Kevin Wolf <kwolf@redhat.com>
29b115
Date: Tue, 10 May 2022 17:10:19 +0200
29b115
Subject: [PATCH 07/16] coroutine: Rename qemu_coroutine_inc/dec_pool_size()
29b115
29b115
RH-Author: Kevin Wolf <kwolf@redhat.com>
29b115
RH-MergeRequest: 87: coroutine: Fix crashes due to too large pool batch size
29b115
RH-Commit: [1/2] 6389b11f70225f221784c270d9b90c1ea43ca8fb (kmwolf/centos-qemu-kvm)
29b115
RH-Bugzilla: 2079938
29b115
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
29b115
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
29b115
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
29b115
29b115
It's true that these functions currently affect the batch size in which
29b115
coroutines are reused (i.e. moved from the global release pool to the
29b115
allocation pool of a specific thread), but this is a bug and will be
29b115
fixed in a separate patch.
29b115
29b115
In fact, the comment in the header file already just promises that it
29b115
influences the pool size, so reflect this in the name of the functions.
29b115
As a nice side effect, the shorter function name makes some line
29b115
wrapping unnecessary.
29b115
29b115
Cc: qemu-stable@nongnu.org
29b115
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
29b115
Message-Id: <20220510151020.105528-2-kwolf@redhat.com>
29b115
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
29b115
(cherry picked from commit 98e3ab35054b946f7c2aba5408822532b0920b53)
29b115
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
29b115
---
29b115
 hw/block/virtio-blk.c    | 6 ++----
29b115
 include/qemu/coroutine.h | 6 +++---
29b115
 util/qemu-coroutine.c    | 4 ++--
29b115
 3 files changed, 7 insertions(+), 9 deletions(-)
29b115
29b115
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
29b115
index 540c38f829..6a1cc41877 100644
29b115
--- a/hw/block/virtio-blk.c
29b115
+++ b/hw/block/virtio-blk.c
29b115
@@ -1215,8 +1215,7 @@ static void virtio_blk_device_realize(DeviceState *dev, Error **errp)
29b115
     for (i = 0; i < conf->num_queues; i++) {
29b115
         virtio_add_queue(vdev, conf->queue_size, virtio_blk_handle_output);
29b115
     }
29b115
-    qemu_coroutine_increase_pool_batch_size(conf->num_queues * conf->queue_size
29b115
-                                            / 2);
29b115
+    qemu_coroutine_inc_pool_size(conf->num_queues * conf->queue_size / 2);
29b115
     virtio_blk_data_plane_create(vdev, conf, &s->dataplane, &err;;
29b115
     if (err != NULL) {
29b115
         error_propagate(errp, err);
29b115
@@ -1253,8 +1252,7 @@ static void virtio_blk_device_unrealize(DeviceState *dev)
29b115
     for (i = 0; i < conf->num_queues; i++) {
29b115
         virtio_del_queue(vdev, i);
29b115
     }
29b115
-    qemu_coroutine_decrease_pool_batch_size(conf->num_queues * conf->queue_size
29b115
-                                            / 2);
29b115
+    qemu_coroutine_dec_pool_size(conf->num_queues * conf->queue_size / 2);
29b115
     qemu_del_vm_change_state_handler(s->change);
29b115
     blockdev_mark_auto_del(s->blk);
29b115
     virtio_cleanup(vdev);
29b115
diff --git a/include/qemu/coroutine.h b/include/qemu/coroutine.h
29b115
index c828a95ee0..5b621d1295 100644
29b115
--- a/include/qemu/coroutine.h
29b115
+++ b/include/qemu/coroutine.h
29b115
@@ -334,12 +334,12 @@ void coroutine_fn yield_until_fd_readable(int fd);
29b115
 /**
29b115
  * Increase coroutine pool size
29b115
  */
29b115
-void qemu_coroutine_increase_pool_batch_size(unsigned int additional_pool_size);
29b115
+void qemu_coroutine_inc_pool_size(unsigned int additional_pool_size);
29b115
 
29b115
 /**
29b115
- * Devcrease coroutine pool size
29b115
+ * Decrease coroutine pool size
29b115
  */
29b115
-void qemu_coroutine_decrease_pool_batch_size(unsigned int additional_pool_size);
29b115
+void qemu_coroutine_dec_pool_size(unsigned int additional_pool_size);
29b115
 
29b115
 #include "qemu/lockable.h"
29b115
 
29b115
diff --git a/util/qemu-coroutine.c b/util/qemu-coroutine.c
29b115
index c03b2422ff..faca0ca97c 100644
29b115
--- a/util/qemu-coroutine.c
29b115
+++ b/util/qemu-coroutine.c
29b115
@@ -205,12 +205,12 @@ AioContext *coroutine_fn qemu_coroutine_get_aio_context(Coroutine *co)
29b115
     return co->ctx;
29b115
 }
29b115
 
29b115
-void qemu_coroutine_increase_pool_batch_size(unsigned int additional_pool_size)
29b115
+void qemu_coroutine_inc_pool_size(unsigned int additional_pool_size)
29b115
 {
29b115
     qatomic_add(&pool_batch_size, additional_pool_size);
29b115
 }
29b115
 
29b115
-void qemu_coroutine_decrease_pool_batch_size(unsigned int removing_pool_size)
29b115
+void qemu_coroutine_dec_pool_size(unsigned int removing_pool_size)
29b115
 {
29b115
     qatomic_sub(&pool_batch_size, removing_pool_size);
29b115
 }
29b115
-- 
29b115
2.31.1
29b115