]> git.ipfire.org Git - thirdparty/qemu.git/commit
xen/9pfs: yield when there isn't enough room on the ring
authorStefano Stabellini <stefano.stabellini@xilinx.com>
Thu, 21 May 2020 19:26:26 +0000 (12:26 -0700)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 16 Jun 2020 22:21:43 +0000 (17:21 -0500)
commit2367c7235b074d816db4b261e472272aa081c76f
treefb21fa6e71c7c63ce8201d5432e70f66fbd8126a
parent0c6499ff2b1f9614195f31a24f1cf3888ce5d079
xen/9pfs: yield when there isn't enough room on the ring

Instead of truncating replies, which is problematic, wait until the
client reads more data and frees bytes on the reply ring.

Do that by calling qemu_coroutine_yield(). The corresponding
qemu_coroutine_enter_if_inactive() is called from xen_9pfs_bh upon
receiving the next notification from the client.

We need to be careful to avoid races in case xen_9pfs_bh and the
coroutine are both active at the same time. In xen_9pfs_bh, wait until
either the critical section is over (ring->co == NULL) or until the
coroutine becomes inactive (qemu_coroutine_yield() was called) before
continuing. Then, simply wake up the coroutine if it is inactive.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Message-Id: <20200521192627.15259-2-sstabellini@kernel.org>
Signed-off-by: Greg Kurz <groug@kaod.org>
(cherry picked from commit a4c4d462729466c4756bac8a0a8d77eb63b21ef7)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/9pfs/xen-9p-backend.c