From: Stefano Garzarella <sgarzare@redhat.com>
To: Arseniy Krasnov <AVKrasnov@sberdevices.ru>,
Bobby Eshleman <bobby.eshleman@gmail.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"virtualization@lists.linux-foundation.org"
<virtualization@lists.linux-foundation.org>,
kernel <kernel@sberdevices.ru>,
Krasnov Arseniy <oxffffaa@gmail.com>
Subject: Re: [RFC PATCH v1 2/3] test/vsock: add big message test
Date: Wed, 23 Nov 2022 16:21:59 +0100 [thread overview]
Message-ID: <20221123152159.xbqhsslrhh4ymbnn@sgarzare-redhat> (raw)
In-Reply-To: <749f147b-6112-2e6f-1ebe-05ba2e8a8727@sberdevices.ru>
On Mon, Nov 21, 2022 at 09:40:39PM +0000, Arseniy Krasnov wrote:
>On 21.11.2022 19:50, Arseniy Krasnov wrote:
>> On 21.11.2022 17:52, Stefano Garzarella wrote:
>>> On Tue, Nov 15, 2022 at 08:52:35PM +0000, Arseniy Krasnov wrote:
>>>> This adds test for sending message, bigger than peer's buffer size.
>>>> For SOCK_SEQPACKET socket it must fail, as this type of socket has
>>>> message size limit.
>>>>
>>>> Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru>
>>>> ---
>>>> tools/testing/vsock/vsock_test.c | 62 ++++++++++++++++++++++++++++++++
>>>> 1 file changed, 62 insertions(+)
>>>>
>>>> diff --git a/tools/testing/vsock/vsock_test.c b/tools/testing/vsock/vsock_test.c
>>>> index 107c11165887..bb4e8657f1d6 100644
>>>> --- a/tools/testing/vsock/vsock_test.c
>>>> +++ b/tools/testing/vsock/vsock_test.c
>>>> @@ -560,6 +560,63 @@ static void test_seqpacket_timeout_server(const struct test_opts *opts)
>>>> close(fd);
>>>> }
>>>>
>>>> +static void test_seqpacket_bigmsg_client(const struct test_opts *opts)
>>>> +{
>>>> + unsigned long sock_buf_size;
>>>> + ssize_t send_size;
>>>> + socklen_t len;
>>>> + void *data;
>>>> + int fd;
>>>> +
>>>> + len = sizeof(sock_buf_size);
>>>> +
>>>> + fd = vsock_seqpacket_connect(opts->peer_cid, 1234);
>>>
>>> Not for this patch, but someday we should add a macro for this port and maybe even make it configurable :-)
>>>
>>>> + if (fd < 0) {
>>>> + perror("connect");
>>>> + exit(EXIT_FAILURE);
>>>> + }
>>>> +
>>>> + if (getsockopt(fd, AF_VSOCK, SO_VM_SOCKETS_BUFFER_SIZE,
>>>> + &sock_buf_size, &len)) {
>>>> + perror("getsockopt");
>>>> + exit(EXIT_FAILURE);
>>>> + }
>>>> +
>>>> + sock_buf_size++;
>>>> +
>>>> + data = malloc(sock_buf_size);
>>>> + if (!data) {
>>>> + perror("malloc");
>>>> + exit(EXIT_FAILURE);
>>>> + }
>>>> +
>>>> + send_size = send(fd, data, sock_buf_size, 0);
>>>> + if (send_size != -1) {
>>>
>>> Can we check also `errno`?
>>> IIUC it should contains EMSGSIZE.
>Hm, seems current implementation is a little bit broken and returns ENOMEM, because any negative value, returned by
>transport callback is always replaced to ENOMEM. I think i need this patch from Bobby:
>https://lore.kernel.org/lkml/d81818b868216c774613dd03641fcfe63cc55a45.1660362668.git.bobby.eshleman@bytedance.com/
>May be i can include it to this patchset also fixing review comments(of course keeping Bobby as author). Or more
>simple way is to check ENOMEM instead of EMSGSIZE in this test(simple, but a little bit dumb i think).
Maybe in this patch you can start checking ENOMEM (with a TODO comment),
and then Bobby can change it when sending his patch.
Or you can repost it (I'm not sure if we should keep the legacy behavior
for other transports or it was an error, but better to discuss it on
that patch). However, I think we should merge that patch.
@Bobby, what do you think?
Thanks,
Stefano
next prev parent reply other threads:[~2022-11-23 15:23 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-15 20:48 [RFC PATCH v1 0/3] test/vsock: update two tests and add new tool Arseniy Krasnov
2022-11-15 20:50 ` [RFC PATCH v1 1/3] test/vsock: rework message bound test Arseniy Krasnov
2022-11-21 14:46 ` Stefano Garzarella
2022-11-21 16:49 ` Arseniy Krasnov
2022-11-23 15:24 ` Stefano Garzarella
2022-11-15 20:52 ` [RFC PATCH v1 2/3] test/vsock: add big message test Arseniy Krasnov
2022-11-21 14:52 ` Stefano Garzarella
2022-11-21 16:50 ` Arseniy Krasnov
2022-11-21 21:40 ` Arseniy Krasnov
2022-11-23 15:21 ` Stefano Garzarella [this message]
[not found] ` <CAKB00G0vcy3EkoouzTsZ8OYZ7hJRFxQ4ThUm4f0ALVs6maFd2g@mail.gmail.com>
2022-11-23 16:28 ` Arseniy Krasnov
2022-11-15 20:54 ` [RFC PATCH v1 3/3] test/vsock: vsock_perf utility Arseniy Krasnov
2022-11-21 15:28 ` Stefano Garzarella
2022-11-21 16:51 ` Arseniy Krasnov
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=20221123152159.xbqhsslrhh4ymbnn@sgarzare-redhat \
--to=sgarzare@redhat.com \
--cc=AVKrasnov@sberdevices.ru \
--cc=bobby.eshleman@gmail.com \
--cc=kernel@sberdevices.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=oxffffaa@gmail.com \
--cc=virtualization@lists.linux-foundation.org \
/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