]> xenbits.xensource.com Git - qemu-xen.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, 25 Aug 2020 00:11:22 +0000 (19:11 -0500)
commitcb84d9d353d40dbcd02fd8ff2c83971ecac0e65b
tree23abd8d8274eec531725ec27d49f7b63497a4a78
parentb38d9cada46ba6229ed6c87bf777cecb24af0c6b
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