[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 40/91] vhost-user-test: don't set call fd -1 non-blocking
From: |
Michael S. Tsirkin |
Subject: |
[PULL 40/91] vhost-user-test: don't set call fd -1 non-blocking |
Date: |
Tue, 2 Jul 2024 10:09:00 -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 fail with an assert.
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 24/91] hw/mem/cxl_type3: Add DC extent list representative and get DC extent list mailbox support, (continued)
- [PULL 24/91] hw/mem/cxl_type3: Add DC extent list representative and get DC extent list mailbox support, Michael S. Tsirkin, 2024/07/02
- [PULL 29/91] hw/mem/cxl_type3: Allow to release extent superset in QMP interface, Michael S. Tsirkin, 2024/07/02
- [PULL 26/91] hw/cxl/events: Add qmp interfaces to add/release dynamic capacity extents, Michael S. Tsirkin, 2024/07/02
- [PULL 32/91] tests/qtest/pvpanic: use centralized definition of supported events, Michael S. Tsirkin, 2024/07/02
- [PULL 33/91] hw/misc/pvpanic: add support for normal shutdowns, Michael S. Tsirkin, 2024/07/02
- [PULL 31/91] hw/misc/pvpanic: centralize definition of supported events, Michael S. Tsirkin, 2024/07/02
- [PULL 37/91] virtio-pci: Fix the failure process in kvm_virtio_pci_vector_use_one(), Michael S. Tsirkin, 2024/07/02
- [PULL 38/91] hw/cxl: Fix read from bogus memory, Michael S. Tsirkin, 2024/07/02
- [PULL 34/91] pvpanic: Emit GUEST_PVSHUTDOWN QMP event on pvpanic shutdown signal, Michael S. Tsirkin, 2024/07/02
- [PULL 36/91] Revert "docs/specs/pvpanic: mark shutdown event as not implemented", Michael S. Tsirkin, 2024/07/02
- [PULL 40/91] vhost-user-test: don't set call fd -1 non-blocking,
Michael S. Tsirkin <=
- [PULL 35/91] tests/qtest/pvpanic: add tests for pvshutdown event, Michael S. Tsirkin, 2024/07/02
- [PULL 39/91] virtio-pci: implement No_Soft_Reset bit, Michael S. Tsirkin, 2024/07/02
- [PULL 41/91] i386/apic: Add hint on boot failure because of disabling x2APIC, Michael S. Tsirkin, 2024/07/02
- [PULL 42/91] hw/virtio: Free vqs after vhost_dev_cleanup(), Michael S. Tsirkin, 2024/07/02
- [PULL 45/91] hw/net/virtio-net.c: fix crash in iov_copy(), Michael S. Tsirkin, 2024/07/02
- [PULL 44/91] vhost-user: Skip unnecessary duplicated VHOST_USER_SET_LOG_BASE requests, Michael S. Tsirkin, 2024/07/02
- [PULL 43/91] virtio-iommu: add error check before assert, Michael S. Tsirkin, 2024/07/02
- [PULL 47/91] libvhost-user: set msg.msg_control to NULL when it is empty, Michael S. Tsirkin, 2024/07/02
- [PULL 48/91] libvhost-user: fail vu_message_write() if sendmsg() is failing, Michael S. Tsirkin, 2024/07/02
- [PULL 46/91] qapi: clarify that the default is backend dependent, Michael S. Tsirkin, 2024/07/02