From: Alexander Graf <graf@amazon.com>
To: Paolo Abeni <pabeni@redhat.com>
Cc: <vishnu.dasa@broadcom.com>, <stefanha@redhat.com>,
<virtualization@lists.linux.dev>, <kvm@vger.kernel.org>,
<bcm-kernel-feedback-list@broadcom.com>, <arnd@arndb.de>,
<netdev@vger.kernel.org>, <eperezma@redhat.com>,
<gregkh@linuxfoundation.org>, <mst@redhat.com>,
<jasowang@redhat.com>, <corbet@lwn.net>,
<nh-open-source@amazon.com>, <bryan-bt.tan@broadcom.com>,
<syzbot@syzkaller.appspotmail.com>, <sgarzare@redhat.com>,
<linux-kernel@vger.kernel.org>
Subject: Re: [net-next, v4] vsock: add G2H fallback for CIDs not owned by H2G transport
Date: Tue, 10 Mar 2026 12:07:30 +0100 [thread overview]
Message-ID: <79351c96-3b8c-4ebb-82c7-7f18ac88bd68@amazon.com> (raw)
In-Reply-To: <ef3435b1-5d86-4137-903f-bddeca3deb91@redhat.com>
On 10.03.26 10:26, Paolo Abeni wrote:
> Hi,
>
> On 3/10/26 10:18 AM, Paolo Abeni wrote:
>> This is an AI-generated review of your patch. The human sending this
>> email has considered the AI review valid, or at least plausible.
>>
>> For local reproduction steps see https://netdev-ai.bots.linux.dev/ai-local.html
>> ---
>>> @@ -581,11 +585,21 @@ int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk)
>>> case SOCK_SEQPACKET:
>>> if (vsock_use_local_transport(remote_cid))
>>> new_transport = transport_local;
>>> - else if (remote_cid <= VMADDR_CID_HOST || !transport_h2g ||
>>> + else if (remote_cid <= VMADDR_CID_HOST ||
>>> (remote_flags & VMADDR_FLAG_TO_HOST))
>>> new_transport = transport_g2h;
>>> - else
>>> + else if (transport_h2g &&
>>> + (!transport_h2g->has_remote_cid ||
>>> + transport_h2g->has_remote_cid(vsk, remote_cid)))
>>> + new_transport = transport_h2g;
>>> + else if (sock_net(sk)->vsock.g2h_fallback &&
>>> + transport_g2h && transport_g2h->has_remote_cid &&
>>> + transport_g2h->has_remote_cid(vsk, remote_cid)) {
>>> + vsk->remote_addr.svm_flags |= VMADDR_FLAG_TO_HOST;
>>> + new_transport = transport_g2h;
>>> + } else {
>>> new_transport = transport_h2g;
>>> + }
>>> break;
>> The old code had `!transport_h2g` in the second else-if condition at line
>> -583, which routed all CID > VMADDR_CID_HOST traffic to transport_g2h when
>> no H2G transport was loaded. The new code removes this check.
>>
>> When transport_h2g is NULL (no H2G transport loaded) and the G2H transport
>> does not implement has_remote_cid (as is the case for VMCI and Hyper-V
>> transports), what happens?
>>
>> The G2H fallback branch at line +596 requires
>> `transport_g2h->has_remote_cid` to be non-NULL. If it's NULL, the
>> short-circuit evaluation skips this branch and executes the final else at
>> line +601, setting `new_transport = transport_h2g` (which is NULL),
>> ultimately returning -ENODEV.
>>
>> The commit message explicitly states the intent to preserve the existing
>> no-H2G fallback behavior. Does this implementation break it for G2H
>> transports that do not implement the new optional has_remote_cid callback?
>>
>> This affects VMCI and Hyper-V environments: when no H2G transport is
>> loaded, CID > 2 connections that previously fell back to G2H now get
>> ENODEV.
> Other comments from AI looked like nit picking to me, but the above one
> looks relevant. I forwarded verbatim all the feedback for completeness.
Yes, this is on purpose. Instead of having bi-modality based on whether
the vhost_vsock kernel module is loaded, we now clearly define that with
the sysctl off, you get the same mode that "vhost_vsock is loaded" gave
you before. The oddball case of "vhost_vsock is not loaded" that meant
everything goes to the G2H transport and confused users is really not
worth keeping IMHO. It's replaced by the auto-fallback logic.
Broadcom also mentioned that G2H for CID > 2 does not exist. IIUC
Hyper-V also does not support CID > 2.
Alex
Amazon Web Services Development Center Germany GmbH
Tamara-Danz-Str. 13
10243 Berlin
Geschaeftsfuehrung: Christof Hellmis, Andreas Stieger
Eingetragen am Amtsgericht Charlottenburg unter HRB 257764 B
Sitz: Berlin
Ust-ID: DE 365 538 597
next prev parent reply other threads:[~2026-03-10 11:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-04 23:00 [PATCH net-next v4] vsock: add G2H fallback for CIDs not owned by H2G transport Alexander Graf
2026-03-05 9:51 ` Stefano Garzarella
2026-03-10 9:30 ` Paolo Abeni
2026-03-10 9:18 ` [net-next,v4] " Paolo Abeni
2026-03-10 9:26 ` Paolo Abeni
2026-03-10 11:07 ` Alexander Graf [this message]
2026-03-12 10:10 ` [PATCH net-next v4] " patchwork-bot+netdevbpf
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=79351c96-3b8c-4ebb-82c7-7f18ac88bd68@amazon.com \
--to=graf@amazon.com \
--cc=arnd@arndb.de \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=bryan-bt.tan@broadcom.com \
--cc=corbet@lwn.net \
--cc=eperezma@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=jasowang@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=nh-open-source@amazon.com \
--cc=pabeni@redhat.com \
--cc=sgarzare@redhat.com \
--cc=stefanha@redhat.com \
--cc=syzbot@syzkaller.appspotmail.com \
--cc=virtualization@lists.linux.dev \
--cc=vishnu.dasa@broadcom.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