From: Gerd Hoffmann <kraxel@redhat.com>
To: Andy King <acking@vmware.com>
Cc: pv-drivers@vmware.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org,
gregkh@linuxfoundation.org, davem@davemloft.net
Subject: Re: [PATCH 1/1] VSOCK: Introduce VM Sockets
Date: Wed, 13 Feb 2013 12:06:04 +0100 [thread overview]
Message-ID: <511B739C.8000204@redhat.com> (raw)
In-Reply-To: <1675407061.963254.1360682467627.JavaMail.root@vmware.com>
On 02/12/13 16:21, Andy King wrote:
> Hi Gerd,
>
>>> +struct vsock_transport {
> ...
>> Whoa. This has grown *alot*. Care to explain this please? Patch
>> creating a Documentation/virtual/vsock.txt would be cool.
>
> Yes, it grew because of the notification stuff, which I'd forgotten
> about until I removed the vmci header from the core code. You are
> free to use empty functions for these if they don't make any sense
> for virtio.
I've seen you have a notify_ops in the vmci bits. Do you have different
notify ops depending on socket type or something? Does it make sense to
move the notify ops ptr into "struct vsock_sock" maybe?
And can we make it optional please (i.e. allow the function pointers to
be NULL)?
> The alternative is for us to move the entire body of
> vsock_stream_recv/send into the transport, where we can hide the
> notification stuff, but it seems like folks will just end up
> duplicating a lot of code then.
Sounds not so good. However, it is still not very clear what this
notification stuff is all about. And it's not just notification, the
calls can return errors too.
Which problem you are trying to tackle with the notifications?
>> stream_has_data + stream_has_space + stream_rcvhiwat look like they
>> are needed for buffer management. Details please (especially for
>> stream_rcvhiwat).
>
> stream_has_data: Returns amount of data available (in bytes) in the
> socket's receive buffer, or -1 if empty.
>
> stream_has_space: Returns amount of space available (in bytes) in the
> socket's send buffer, or -1 if full.
As one would expect from the names, good.
> stream_rcvhiwat: The upper bound on the socket's receive buffer.
> Which technically is the same as the value returned by
> get_buffer_size(), so perhaps we could substitute that here and
> drop this one.
Yes, please.
>> What is stream_is_active?
>
> For the VMCI transport, it indicates if the underlying queuepair is
> still around (i.e., make sure we haven't torn it down while sleeping
> in a blocking send or receive). Perhaps it's not the best name?
How you'd hit that? Peer closing the socket while sleeping? Other
thread closing the socket wile sleeping? Both?
I think a state field in struct vsock_sock would be a better solution here.
>> What is *_allow?
>
> It's very basic filtering. We have specific addresses that we don't
> allow, and we look for them in the allow() functions. You can just
> return true if you like.
Can we make those calls optional too please?
>> What are all those notify_* calls?
>
> They're to do with signaling and flow-control. Again, they might
> not make any sense at all, but it's hard to know without having
> written another transport :)
I don't see a immediate need for them in the virto transport, but it's
hard to say without knowing what exactly they are doing.
>> Why do you need vsock_transport_{send,recv}_notify_data structs?
>> Can't this live in vsock_sock->trans?
>
> Those have to be setup on a per-call basis (per-thread), so it's
> just easier to have them on the stack of the send/recv calls. If
> you think there's a better name, or a better way to allocate them,
> I'm all ears.
Hmm. The struct content seems to be vmci-specific and it is in generic
code, which isn't that nice.
The notify_*_init could return a opaque pointer instead. But then
you'll need a notify_*_free too. And you can't place it on the stack
and thus have a allocation in the hot path, which I guess you are trying
to avoid in the first place.
No good idea offhand, but maybe that changes if the purpose of all those
notify_* calls is more clear.
cheers,
Gerd
next prev parent reply other threads:[~2013-02-13 11:06 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-07 0:23 [PATCH 0/1] VM Sockets for Linux upstreaming Andy King
2013-02-07 0:23 ` [PATCH 1/1] VSOCK: Introduce VM Sockets Andy King
2013-02-11 14:22 ` Gerd Hoffmann
2013-02-12 15:21 ` Andy King
2013-02-13 3:21 ` [Pv-drivers] " Andy King
2013-02-13 11:06 ` Gerd Hoffmann [this message]
2013-02-14 3:20 ` Andy King
2013-02-14 9:28 ` Gerd Hoffmann
2013-02-12 10:58 ` Gerd Hoffmann
2013-02-13 3:23 ` Andy King
2013-02-13 12:44 ` Gerd Hoffmann
2013-02-14 3:07 ` Andy King
2013-02-18 16:56 ` Andy King
2013-02-14 11:05 ` Gerd Hoffmann
2013-02-18 17:07 ` Andy King
2013-02-19 8:45 ` Gerd Hoffmann
2013-02-14 20:18 ` Sasha Levin
2013-02-18 17:09 ` Andy King
2013-02-15 10:32 ` Gerd Hoffmann
2013-02-09 1:20 ` [Pv-drivers] [PATCH 0/1] VM Sockets for Linux upstreaming Dmitry Torokhov
2013-02-09 2:59 ` David Miller
2013-02-11 1:10 ` David Miller
-- strict thread matches above, loose matches on Subject: below --
2013-02-04 23:26 Andy King
2013-02-04 23:26 ` [PATCH 1/1] VSOCK: Introduce VM Sockets Andy King
2013-01-25 17:37 [PATCH 0/1] VM Sockets for Linux upstreaming acking
2013-01-25 17:37 ` [PATCH 1/1] VSOCK: Introduce VM Sockets acking
2013-01-25 23:59 ` Neil Horman
2013-01-28 12:25 ` Gerd Hoffmann
2013-01-31 22:06 ` Andy King
2013-02-01 8:12 ` Gerd Hoffmann
2013-02-04 23:41 ` Andy King
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=511B739C.8000204@redhat.com \
--to=kraxel@redhat.com \
--cc=acking@vmware.com \
--cc=davem@davemloft.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pv-drivers@vmware.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;
as well as URLs for NNTP newsgroup(s).