From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Yuxue Liu yuxue.liu@jaguarmicro.com" <yuxue.liu@jaguarmicro.com>
Cc: pbonzini@redhat.com, lvivier@redhat.com, thuth@redhat.com,
qemu-devel@nongnu.org
Subject: Re: [PATCH] vhost-user-test: no set non-blocking for cal fd less than 0.
Date: Sun, 2 Jun 2024 09:18:00 -0400 [thread overview]
Message-ID: <20240602091427-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20240411073555.1357-1-yuxue.liu@jaguarmicro.com>
On Thu, Apr 11, 2024 at 03:35:55PM +0800, Yuxue Liu yuxue.liu@jaguarmicro.com wrote:
> 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>
> ---
> 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..7c8ef6268d 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, no set non-blocking\n", fd);
> + break;
> + }
I don't get how this is supposed to help. Did you test this?
> /*
> * This is a non-blocking eventfd.
> * The receive function forces it to be blocking,
> --
> 2.43.0
next prev parent reply other threads:[~2024-06-02 13:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-11 7:35 [PATCH] vhost-user-test: no set non-blocking for cal fd less than 0 Yuxue Liu yuxue.liu@jaguarmicro.com
2024-04-18 10:42 ` Thomas Huth
2024-04-18 15:40 ` Michael S. Tsirkin
2024-06-02 13:18 ` Michael S. Tsirkin [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-04-22 9:46 Gavin Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240602091427-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
--cc=yuxue.liu@jaguarmicro.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).