Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5ED43C6FA8E for ; Thu, 2 Mar 2023 09:22:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229943AbjCBJV7 (ORCPT ); Thu, 2 Mar 2023 04:21:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229958AbjCBJVp (ORCPT ); Thu, 2 Mar 2023 04:21:45 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72DD830EA3 for ; Thu, 2 Mar 2023 01:20:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677748820; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=mNAh7WwsaV0kOk2ITHv/T/MFdHkpYUKS8lAASyQo12s=; b=cUMnoJruM/FiQCbLzYKR+v1jwYiCKkN3NTRfoYKkw4UnUWf7wmcVJ9Rk9KbKuYm0isTBie zvG1Ajk9oaaty4OL7koiRtxLXpJPwmP204GZ4gxLS1l4/EuJPes5SeEAO+P6pTKssBW+YN 1eULUJeiyfH2N9o7LJaUAiOpTw8f/sM= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-356-GcS8EYWlNfGYu2NDuO6BEQ-1; Thu, 02 Mar 2023 04:20:19 -0500 X-MC-Unique: GcS8EYWlNfGYu2NDuO6BEQ-1 Received: by mail-wr1-f69.google.com with SMTP id r14-20020a0560001b8e00b002cdb76f7e80so1173324wru.19 for ; Thu, 02 Mar 2023 01:20:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677748818; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=mNAh7WwsaV0kOk2ITHv/T/MFdHkpYUKS8lAASyQo12s=; b=aJoXhSQnBiq2rvrnZfEVE0p8KFegXOaU3F3/N02ZnNxUkYhFV2yxNAdjYMmxQzVJ4s BrajolJ7AABncTWYfPxdU246tACpAevaeJwJnM1ftD6SBNsdRfjCPZtdSnag/snWDmYF Ct7OB0E9RergJZ1Uwjgr+nwXQFjgSGTB1ZQF265HQc/20z7iNaAp0eCnAU2l90MJ5wo7 v+lALIDPRVIVBikmGsnnP5DEnXYWBRTtnz9+f7GZDsXatQ1/DIQ3c3LXNT/LYtToX2DR 7g5YIMxDXBkOuZChgNsU58zfwkMyRoMWixXToqNl7etlJ60ydtfU9scZnfhXhPPBxv3x AEVg== X-Gm-Message-State: AO0yUKXmNgb1NJSwUaUlA+aI8rt3j+sJ+vjkYD4QCZ38Bs1ODLLV1HJP vmrDqz20E64/BNmVarjLdkFUX5NrOYPN9dUbSyh1iHFIZtfq+YkDejUg+a05tX5DwpavbKC+JO0 iHyAZx1leMARDC3all9zLT2T1 X-Received: by 2002:adf:ce09:0:b0:2c5:52c3:3f05 with SMTP id p9-20020adfce09000000b002c552c33f05mr6913058wrn.37.1677748818283; Thu, 02 Mar 2023 01:20:18 -0800 (PST) X-Google-Smtp-Source: AK7set9PN/kdkIqrGoMb6UfHqEwEV9RSL6zdzJVeFnieVx1t6UmihOxwNslkLjNRDZls5mCSN7BIMA== X-Received: by 2002:adf:ce09:0:b0:2c5:52c3:3f05 with SMTP id p9-20020adfce09000000b002c552c33f05mr6913041wrn.37.1677748818002; Thu, 02 Mar 2023 01:20:18 -0800 (PST) Received: from sgarzare-redhat (c-115-213.cust-q.wadsl.it. [212.43.115.213]) by smtp.gmail.com with ESMTPSA id x16-20020a5d54d0000000b002c71703876bsm14635935wrv.14.2023.03.02.01.20.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Mar 2023 01:20:17 -0800 (PST) Date: Thu, 2 Mar 2023 10:20:09 +0100 From: Stefano Garzarella To: Bobby Eshleman Cc: "Michael S. Tsirkin" , Bobby Eshleman , Cong Wang , kvm@vger.kernel.org, Alexei Starovoitov , virtualization@lists.linux-foundation.org, Song Liu , Eric Dumazet , Stanislav Fomichev , linux-kselftest@vger.kernel.org, Shuah Khan , Mykola Lysenko , Daniel Borkmann , John Fastabend , Andrii Nakryiko , Yonghong Song , Paolo Abeni , KP Singh , Stefan Hajnoczi , Jakub Kicinski , Hao Luo , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Olsa , bpf@vger.kernel.org, Martin KaFai Lau , "David S. Miller" Subject: Re: [PATCH net-next v3 1/3] vsock: support sockmap Message-ID: <20230302092009.xohos3cvowrrykck@sgarzare-redhat> References: <20230227-vsock-sockmap-upstream-v3-0-7e7f4ce623ee@bytedance.com> <20230227-vsock-sockmap-upstream-v3-1-7e7f4ce623ee@bytedance.com> <20230228163518-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Feb 18, 2023 at 07:25:41AM +0000, Bobby Eshleman wrote: >On Tue, Feb 28, 2023 at 04:36:22PM -0500, Michael S. Tsirkin wrote: >> On Tue, Feb 28, 2023 at 07:04:34PM +0000, Bobby Eshleman wrote: >> > @@ -1241,19 +1252,34 @@ static int vsock_dgram_connect(struct socket *sock, >> > >> > memcpy(&vsk->remote_addr, remote_addr, sizeof(vsk->remote_addr)); >> > sock->state = SS_CONNECTED; >> > + sk->sk_state = TCP_ESTABLISHED; >> > >> > out: >> > release_sock(sk); >> > return err; >> > } >> >> >> How is this related? Maybe add a comment to explain? Does >> TCP_ESTABLISHED make sense for all types of sockets? >> > >Hey Michael, definitely, I can leave a comment. I agree, since I had the same doubt in previous versions, I think it's worth putting a comment in the code to explain why. Since there may be a v4, I'll leave some small comments in a separate email. Thanks, Stefano > >The real reason is due to this piece of logic in sockmap: >https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/net/core/sock_map.c?h=v6.2#n531 > >And because of it, you see the same thing in (for example) >unix_dgram_connect(): >https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/net/unix/af_unix.c?h=v6.2#n1394 > >I believe it makes sense for these other socket types. >