From: Alexander Graf <graf@amazon.com>
To: Stefano Garzarella <sgarzare@redhat.com>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<virtualization@lists.linux.dev>, <kvm@vger.kernel.org>,
Asias He <asias@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Paolo Abeni <pabeni@redhat.com>, Jakub Kicinski <kuba@kernel.org>,
Eric Dumazet <edumazet@google.com>,
"David S. Miller" <davem@davemloft.net>,
"Stefan Hajnoczi" <stefanha@redhat.com>
Subject: Re: [PATCH] vsock/virtio: Remove queued_replies pushback logic
Date: Fri, 15 Nov 2024 16:49:14 +0100 [thread overview]
Message-ID: <dca2f6ff-b586-461d-936d-e0b9edbe7642@amazon.com> (raw)
In-Reply-To: <yjhfe5bsnfpqbnibxl2urrnuowzitxnrbodlihz4y5csig7e7p@drgxxxxgokfo>
Hi Stefano,
On 15.11.24 12:59, Stefano Garzarella wrote:
>
> On Fri, Nov 15, 2024 at 10:30:16AM +0000, Alexander Graf wrote:
>> Ever since the introduction of the virtio vsock driver, it included
>> pushback logic that blocks it from taking any new RX packets until the
>> TX queue backlog becomes shallower than the virtqueue size.
>>
>> This logic works fine when you connect a user space application on the
>> hypervisor with a virtio-vsock target, because the guest will stop
>> receiving data until the host pulled all outstanding data from the VM.
>
> So, why not skipping this only when talking with a sibling VM?
I don't think there is a way to know, is there?
>
>>
>> With Nitro Enclaves however, we connect 2 VMs directly via vsock:
>>
>> Parent Enclave
>>
>> RX -------- TX
>> TX -------- RX
>>
>> This means we now have 2 virtio-vsock backends that both have the
>> pushback
>> logic. If the parent's TX queue runs full at the same time as the
>> Enclave's, both virtio-vsock drivers fall into the pushback path and
>> no longer accept RX traffic. However, that RX traffic is TX traffic on
>> the other side which blocks that driver from making any forward
>> progress. We're not in a deadlock.
>>
>> To resolve this, let's remove that pushback logic altogether and rely on
>> higher levels (like credits) to ensure we do not consume unbounded
>> memory.
>
> I spoke quickly with Stefan who has been following the development from
> the beginning and actually pointed out that there might be problems
> with the control packets, since credits only covers data packets, so
> it doesn't seem like a good idea remove this mechanism completely.
Can you help me understand which situations the current mechanism really
helps with, so we can look at alternatives?
>
>>
>> Fixes: 0ea9e1d3a9e3 ("VSOCK: Introduce virtio_transport.ko")
>
> I'm not sure we should add this Fixes tag, this seems very risky
> backporting on stable branches IMHO.
Which situations do you believe it will genuinely break anything in? As
it stands today, if you run upstream parent and enclave and hammer them
with vsock traffic, you get into a deadlock. Even without the flow
control, you will never hit a deadlock. But you may get a brown-out like
situation while Linux is flushing its buffers.
Ideally we want to have actual flow control to mitigate the problem
altogether. But I'm not quite sure how and where. Just blocking all
receiving traffic causes problems.
> If we cannot find a better mechanism to replace this with something
> that works both guest <-> host and guest <-> guest, I would prefer
> to do this just for guest <-> guest communication.
> Because removing this completely seems too risky for me, at least
> without a proof that control packets are fine.
So your concern is that control packets would not receive pushback, so
we would allow unbounded traffic to get queued up? Can you suggest
options to help with that?
Alex
Amazon Web Services Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss
Eingetragen am Amtsgericht Charlottenburg unter HRB 257764 B
Sitz: Berlin
Ust-ID: DE 365 538 597
next prev parent reply other threads:[~2024-11-15 15:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-15 10:30 [PATCH] vsock/virtio: Remove queued_replies pushback logic Alexander Graf
2024-11-15 11:59 ` Stefano Garzarella
2024-11-15 15:49 ` Alexander Graf [this message]
2024-11-18 14:07 ` Stefano Garzarella
2024-11-19 8:29 ` Stefano Garzarella
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=dca2f6ff-b586-461d-936d-e0b9edbe7642@amazon.com \
--to=graf@amazon.com \
--cc=asias@redhat.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sgarzare@redhat.com \
--cc=stefanha@redhat.com \
--cc=virtualization@lists.linux.dev \
/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