From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60830C83016 for ; Tue, 1 Dec 2020 16:11:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 01A7622266 for ; Tue, 1 Dec 2020 16:11:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Bu03HYNp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392132AbgLAQLN (ORCPT ); Tue, 1 Dec 2020 11:11:13 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:32471 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390790AbgLAQLM (ORCPT ); Tue, 1 Dec 2020 11:11:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606838985; 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=FmeUIl5gKiTi3zNwJ/hCxS5K2ryAZ0zswO+YxWmjOmo=; b=Bu03HYNpBt9219IsMF9Iwf0/Wn+B6ELNSIFEqVwnT9GK847KgaK3zeDYpfCTOakumqH52j op6bkzZw8J0aAQVZC9zrPufzK0znrlqs1S7oQ1+0GFaHz9+r7YsfkBbeITk6mL5H67mEVq 1hz7/YVttFXAXOa+DGgbO37oGzUX7ko= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-582-0cLj-J02O3mfT2cKgL7AOg-1; Tue, 01 Dec 2020 11:09:43 -0500 X-MC-Unique: 0cLj-J02O3mfT2cKgL7AOg-1 Received: by mail-wm1-f71.google.com with SMTP id y187so1144822wmy.3 for ; Tue, 01 Dec 2020 08:09:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=FmeUIl5gKiTi3zNwJ/hCxS5K2ryAZ0zswO+YxWmjOmo=; b=YnyXIIozvKRTfVKWRSZAm/xJW7mgvSBk+5lId3VoX37DS3VZpVgCIlnQjO2CgQIQze PeS6YB2e9ufE/rBgNdOHBMUuIlSMpb51min+sYfqKQmZwOwCY4DhqYi2K775e/a5/bGt 8e+HanKPELLnaawn0AxTI//7fKuQ/OejnpYsMW/ms57RkTnxPmjbUSyzBBKUJRGCUgeG MWDcrRRb5rLqTlH8Z+e/s/B/HJhwRP7gQaLySfks+XAodp0LxzyasO0RJkU3uupe15+I UtsldKWiT2msjEkT5FL4rqanr2iGmwur6JQidvbp2t/5oSnFjBR1CA6nimJj+/8nCbwV +YEg== X-Gm-Message-State: AOAM5305LqECuRUa8dEgpsypsyx/RHhAWNoBMOubl/dJKpYHa4j41kJA 4mgXuvbx6KffXY93Kv+EGM7ro+4dmEqmb3N8rkdLaTvBXvHHjUFHdgtLdKZCF1NsMRUBu54qLPt Mv9uOk1ELhAmBdiXjm8RGF/bL X-Received: by 2002:a7b:c015:: with SMTP id c21mr3377366wmb.79.1606838981756; Tue, 01 Dec 2020 08:09:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJwPVt1eahGleV7/m/61AodRx9ufD5CueGJuH+1j+yzVjP58dGrebIJ7Cg7HtKEs90D7L+R+lQ== X-Received: by 2002:a7b:c015:: with SMTP id c21mr3377336wmb.79.1606838981480; Tue, 01 Dec 2020 08:09:41 -0800 (PST) Received: from steredhat (host-79-17-248-175.retail.telecomitalia.it. [79.17.248.175]) by smtp.gmail.com with ESMTPSA id g11sm38598wrq.7.2020.12.01.08.09.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2020 08:09:40 -0800 (PST) Date: Tue, 1 Dec 2020 17:09:37 +0100 From: Stefano Garzarella To: Andra Paraschiv Cc: netdev , linux-kernel , "David S . Miller" , David Duncan , Dexuan Cui , Alexander Graf , Jorgen Hansen , Jakub Kicinski , Stefan Hajnoczi , Vitaly Kuznetsov Subject: Re: [PATCH net-next v1 1/3] vm_sockets: Include flag field in the vsock address data structure Message-ID: <20201201160937.sswd3prfn6r52ihc@steredhat> References: <20201201152505.19445-1-andraprs@amazon.com> <20201201152505.19445-2-andraprs@amazon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20201201152505.19445-2-andraprs@amazon.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 01, 2020 at 05:25:03PM +0200, Andra Paraschiv wrote: >vsock enables communication between virtual machines and the host they >are running on. With the multi transport support (guest->host and >host->guest), nested VMs can also use vsock channels for communication. > >In addition to this, by default, all the vsock packets are forwarded to >the host, if no host->guest transport is loaded. This behavior can be >implicitly used for enabling vsock communication between sibling VMs. > >Add a flag field in the vsock address data structure that can be used to >explicitly mark the vsock connection as being targeted for a certain >type of communication. This way, can distinguish between nested VMs and >sibling VMs use cases and can also setup them at the same time. Till >now, could either have nested VMs or sibling VMs at a time using the >vsock communication stack. > >Use the already available "svm_reserved1" field and mark it as a flag >field instead. This flag can be set when initializing the vsock address >variable used for the connect() call. Maybe we can split this patch in 2 patches, one to rename the svm_flag and one to add the new flags. > >Signed-off-by: Andra Paraschiv >--- > include/uapi/linux/vm_sockets.h | 18 +++++++++++++++++- > 1 file changed, 17 insertions(+), 1 deletion(-) > >diff --git a/include/uapi/linux/vm_sockets.h b/include/uapi/linux/vm_sockets.h >index fd0ed7221645d..58da5a91413ac 100644 >--- a/include/uapi/linux/vm_sockets.h >+++ b/include/uapi/linux/vm_sockets.h >@@ -114,6 +114,22 @@ > > #define VMADDR_CID_HOST 2 > >+/* This sockaddr_vm flag value covers the current default use case: >+ * local vsock communication between guest and host and nested VMs setup. >+ * In addition to this, implicitly, the vsock packets are forwarded to the host >+ * if no host->guest vsock transport is set. >+ */ >+#define VMADDR_FLAG_DEFAULT_COMMUNICATION 0x0000 I think we don't need this macro, since the next one can be used to check if it a sibling communication (flag 0x1 set) or not (flag 0x1 not set). >+ >+/* Set this flag value in the sockaddr_vm corresponding field if the vsock >+ * channel needs to be setup between two sibling VMs running on the same host. >+ * This way can explicitly distinguish between vsock channels created for nested >+ * VMs (or local communication between guest and host) and the ones created for >+ * sibling VMs. And vsock channels for multiple use cases (nested / sibling VMs) >+ * can be setup at the same time. >+ */ >+#define VMADDR_FLAG_SIBLING_VMS_COMMUNICATION 0x0001 What do you think if we shorten in VMADDR_FLAG_SIBLING? Thanks, Stefano >+ > /* Invalid vSockets version. */ > > #define VM_SOCKETS_INVALID_VERSION -1U >@@ -145,7 +161,7 @@ > > struct sockaddr_vm { > __kernel_sa_family_t svm_family; >- unsigned short svm_reserved1; >+ unsigned short svm_flag; > unsigned int svm_port; > unsigned int svm_cid; > unsigned char svm_zero[sizeof(struct sockaddr) - >-- >2.20.1 (Apple Git-117) > > > > >Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005. >