[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v3 40/85] vhost-user-test: no set non-blocking for cal fd less tha
From: |
Michael S. Tsirkin |
Subject: |
[PULL v3 40/85] vhost-user-test: no set non-blocking for cal fd less than 0. |
Date: |
Wed, 3 Jul 2024 18:47:21 -0400 |
From: Yuxue Liu <yuxue.liu@jaguarmicro.com>
In the scenario where vhost-user sets eventfd to -1,
qemu_chr_fe_get_msgfds retrieves fd as -1. When vhost_user_read
receives, it does not perform blocking operations on the descriptor
with fd=-1, so non-blocking operations should not be performed here
either.This is a normal use case. Calling g_unix_set_fd_nonblocking
at this point will cause the test to interrupt.
When vhost_user_write sets the call fd to -1, it sets the number of
fds to 0, so the fds obtained by qemu_chr_fe_get_msgfds will also
be 0.
Signed-off-by: Yuxue Liu <yuxue.liu@jaguarmicro.com>
Message-Id: <20240411073555.1357-1-yuxue.liu@jaguarmicro.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
tests/qtest/vhost-user-test.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c
index d4e437265f..255bde54ab 100644
--- a/tests/qtest/vhost-user-test.c
+++ b/tests/qtest/vhost-user-test.c
@@ -458,7 +458,10 @@ static void chr_read(void *opaque, const uint8_t *buf, int
size)
case VHOST_USER_SET_VRING_KICK:
case VHOST_USER_SET_VRING_CALL:
/* consume the fd */
- qemu_chr_fe_get_msgfds(chr, &fd, 1);
+ if (!qemu_chr_fe_get_msgfds(chr, &fd, 1) && fd < 0) {
+ qos_printf("call fd: %d, do not set non-blocking\n", fd);
+ break;
+ }
/*
* This is a non-blocking eventfd.
* The receive function forces it to be blocking,
--
MST
- [PULL v3 30/85] linux-headers: update to 6.10-rc1, (continued)
- [PULL v3 30/85] linux-headers: update to 6.10-rc1, Michael S. Tsirkin, 2024/07/03
- [PULL v3 31/85] hw/misc/pvpanic: centralize definition of supported events, Michael S. Tsirkin, 2024/07/03
- [PULL v3 32/85] tests/qtest/pvpanic: use centralized definition of supported events, Michael S. Tsirkin, 2024/07/03
- [PULL v3 33/85] hw/misc/pvpanic: add support for normal shutdowns, Michael S. Tsirkin, 2024/07/03
- [PULL v3 35/85] tests/qtest/pvpanic: add tests for pvshutdown event, Michael S. Tsirkin, 2024/07/03
- [PULL v3 34/85] pvpanic: Emit GUEST_PVSHUTDOWN QMP event on pvpanic shutdown signal, Michael S. Tsirkin, 2024/07/03
- [PULL v3 36/85] Revert "docs/specs/pvpanic: mark shutdown event as not implemented", Michael S. Tsirkin, 2024/07/03
- [PULL v3 37/85] virtio-pci: Fix the failure process in kvm_virtio_pci_vector_use_one(), Michael S. Tsirkin, 2024/07/03
- [PULL v3 38/85] hw/cxl: Fix read from bogus memory, Michael S. Tsirkin, 2024/07/03
- [PULL v3 39/85] virtio-pci: implement No_Soft_Reset bit, Michael S. Tsirkin, 2024/07/03
- [PULL v3 40/85] vhost-user-test: no set non-blocking for cal fd less than 0.,
Michael S. Tsirkin <=
- [PULL v3 41/85] i386/apic: Add hint on boot failure because of disabling x2APIC, Michael S. Tsirkin, 2024/07/03
- [PULL v3 42/85] hw/virtio: Free vqs after vhost_dev_cleanup(), Michael S. Tsirkin, 2024/07/03
- [PULL v3 43/85] virtio-iommu: add error check before assert, Michael S. Tsirkin, 2024/07/03
- [PULL v3 44/85] vhost-user: Skip unnecessary duplicated VHOST_USER_SET_LOG_BASE requests, Michael S. Tsirkin, 2024/07/03
- [PULL v3 45/85] hw/net/virtio-net.c: fix crash in iov_copy(), Michael S. Tsirkin, 2024/07/03
- [PULL v3 46/85] qapi: clarify that the default is backend dependent, Michael S. Tsirkin, 2024/07/03
- [PULL v3 47/85] libvhost-user: set msg.msg_control to NULL when it is empty, Michael S. Tsirkin, 2024/07/03
- [PULL v3 48/85] libvhost-user: fail vu_message_write() if sendmsg() is failing, Michael S. Tsirkin, 2024/07/03
- [PULL v3 49/85] libvhost-user: mask F_INFLIGHT_SHMFD if memfd is not supported, Michael S. Tsirkin, 2024/07/03
- [PULL v3 50/85] vhost-user-server: do not set memory fd non-blocking, Michael S. Tsirkin, 2024/07/03