Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2326695ybp; Thu, 10 Oct 2019 05:56:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqwpfl35BVfGkG6r/e0xRslOfSQ6CZVBLT8FE+r8absdF2HT97aFrc+rSUQB7SvESo/ivBtk X-Received: by 2002:a17:906:792:: with SMTP id l18mr7758449ejc.170.1570712192358; Thu, 10 Oct 2019 05:56:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570712192; cv=none; d=google.com; s=arc-20160816; b=XyBkokJXM/cpf4+gPE1857EkcyyqLxqHq/REoq2+YkIOg+pB+VgfjdU5AWm3ARJtuu vZtj74v6czJBSckKVoPu+3agaSofws3Yt51EuMDtvM2R4VT1ErT/DEJ0GrFgLKp3xSC0 ltjLZ7GzWHlBshVwCD69G2PphPDMlR2qfkvlyEhG2cnq+I/o8ywcwyjEeoq8CxKa8Kgu 7iy2wBxTXUW/wIfxctXphuim4Gv71VPLBjeUXgpMbKiNp3yxgzoGZC4+xnxvNxGyk1Yk DTZlgNE4w+mkxGum65zjoJar+B83QpTMSYlWennhm4vn/QRA94+FLsvjhNJ9cy/AX5yS QdPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Nq/uA9hbiLadGUMtvDysqPg6doejpIGdIlN33a9wYx0=; b=XhtVwyJenKiuv4bUiae8fEpVoQouljj8/M2WeZnVtFIlUk6PTXM4bZ4/G7g9vzVM1R 0BK+WTBu/bZILF01j9fOB68/Cxp7EFcOS6htdvLZy23ReKa2lBsjNdh6EjWm9XR6Hk6A RTElwbLxefVKpERLkqKhX5zRkvbVFHNvGuvJLdJ1tfhCq74XUgu4PviBCOoDF1Sw/TL6 UJgDZZFQkQlOjBokYnNC8a+jCwl1EghX0TIpT660ZPcj0pDD3nQpPNofe7EOzwDUTkuJ VkcyrFiPvV9yodBsk24Rcc1f9OzWyc5jaMtXoGkI5JF88BxOreyZTDZaEIpwPI5I+CBr casg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ch6si2952179ejb.275.2019.10.10.05.56.08; Thu, 10 Oct 2019 05:56:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387920AbfJJMz1 (ORCPT + 99 others); Thu, 10 Oct 2019 08:55:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51314 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728274AbfJJMz0 (ORCPT ); Thu, 10 Oct 2019 08:55:26 -0400 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AA54E81DF1 for ; Thu, 10 Oct 2019 12:55:25 +0000 (UTC) Received: by mail-wm1-f70.google.com with SMTP id q9so2579818wmj.9 for ; Thu, 10 Oct 2019 05:55:25 -0700 (PDT) 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:user-agent; bh=Nq/uA9hbiLadGUMtvDysqPg6doejpIGdIlN33a9wYx0=; b=iRG88cT8jfz7lLd8qbhMlzJRCH9YkZqmxAbUC2bT/IsXZ8NPXnXCdjLIUkv9glHcjJ I72W6KzwyOfEprmScsyiORVjccmOIowjh6iBwIwDr8jWZ4wRVwSBiSdkIrZ2bOz+n6YL hhNW5nVBLa34n5+zR2wT7H1kj90gukeAGflz2LJGPa7zKt8N4h0k7u/KwyAt8m2uyjUU NInbKzBAsJXfAJqHp4nyuSUMjwa6fc44jJwWn03Y+9iXo6M7mjeTD32EqkaedXMy2Ixw IFhidAxPEmxjjpx0dnZfHhvdufOkQDf5oBRX04PyJ4Yq1R31a4FvvaFOoE7dAzz4auCm m30A== X-Gm-Message-State: APjAAAWcRfD0zgahvtKilhRcKQDMfnsrqfozgMhL9HVP7DZOG8o0p31z etbUOiPIfvJ4dgxjII0cUbNOaBe9vTvQqqRqM/NN8oObo4c0OGfOGOqKIU05zRkBFHZ88iHEEEW AeOyD/4xn0LMO66VjnujklX9d X-Received: by 2002:a05:600c:2291:: with SMTP id 17mr7030804wmf.171.1570712124316; Thu, 10 Oct 2019 05:55:24 -0700 (PDT) X-Received: by 2002:a05:600c:2291:: with SMTP id 17mr7030775wmf.171.1570712124033; Thu, 10 Oct 2019 05:55:24 -0700 (PDT) Received: from steredhat (host174-200-dynamic.52-79-r.retail.telecomitalia.it. [79.52.200.174]) by smtp.gmail.com with ESMTPSA id u68sm8140030wmu.12.2019.10.10.05.55.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 05:55:23 -0700 (PDT) Date: Thu, 10 Oct 2019 14:55:21 +0200 From: Stefano Garzarella To: Stefan Hajnoczi Cc: netdev@vger.kernel.org, Sasha Levin , linux-hyperv@vger.kernel.org, Stephen Hemminger , kvm@vger.kernel.org, "Michael S. Tsirkin" , Dexuan Cui , Haiyang Zhang , linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, Stefan Hajnoczi , "David S. Miller" , Jorgen Hansen Subject: Re: [RFC PATCH 10/13] vsock: add multi-transports support Message-ID: <20191010125521.mf7elqjpwhwjhwpo@steredhat> References: <20190927112703.17745-1-sgarzare@redhat.com> <20190927112703.17745-11-sgarzare@redhat.com> <20191009131123.GK5747@stefanha-x1.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191009131123.GK5747@stefanha-x1.localdomain> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 09, 2019 at 02:11:23PM +0100, Stefan Hajnoczi wrote: > On Fri, Sep 27, 2019 at 01:27:00PM +0200, Stefano Garzarella wrote: > > RFC: > > - I'd like to move MODULE_ALIAS_NETPROTO(PF_VSOCK) to af_vsock.c. > > @Jorgen could this break the VMware products? > > What will cause the vmw_vsock_vmci_transport.ko module to be loaded > after you remove MODULE_ALIAS_NETPROTO(PF_VSOCK)? Perhaps > drivers/misc/vmw_vmci/vmci_guest.c:vmci_guest_probe_device() could do > something when the guest driver loads. Good idea, maybe we can call some function provided by vmci_transport to register it as a guest (I'll remove the type from the transport and I add it as a parameter of vsock_core_register()) > There would need to be something > equivalent for the host side too. Maybe in the vmci_host_do_init_context(). > > This will solve another issue too. Today the VMCI transport can be > loaded if an application creates an AF_VSOCK socket during early boot > before the virtio transport has been probed. This happens because the > VMCI transport uses MODULE_ALIAS_NETPROTO(PF_VSOCK) *and* it does not > probe whether this system is actually a VMware guest. > > If we instead load the core af_vsock.ko module and transports are only > loaded based on hardware feature probing (e.g. the presence of VMware > guest mode, a virtio PCI adapter, etc) then transports will be > well-behaved. Yes, I completely agree with you. I'll try to follow your suggestion, > > > - DGRAM sockets are handled as before, I don't know if make sense work > > on it now, or when another transport will support DGRAM. The big > > issues here is that we cannot link 1-1 a socket to transport as > > for stream sockets since DGRAM is not connection-oriented. > > Let's ignore DGRAM for now since only VMCI supports it and we therefore > do not require multi-transpor) support. Okay :) > > > diff --git a/include/net/af_vsock.h b/include/net/af_vsock.h > > index 86f8f463e01a..2a081d19e20d 100644 > > --- a/include/net/af_vsock.h > > +++ b/include/net/af_vsock.h > > @@ -94,7 +94,13 @@ struct vsock_transport_send_notify_data { > > u64 data2; /* Transport-defined. */ > > }; > > > > +#define VSOCK_TRANSPORT_F_H2G 0x00000001 > > +#define VSOCK_TRANSPORT_F_G2H 0x00000002 > > +#define VSOCK_TRANSPORT_F_DGRAM 0x00000004 > > Documentation comments, please. I'll fix! > > > +void vsock_core_unregister(const struct vsock_transport *t) > > +{ > > + mutex_lock(&vsock_register_mutex); > > + > > + /* RFC-TODO: maybe we should check if there are open sockets > > + * assigned to that transport and avoid the unregistration > > + */ > > If unregister() is only called from module_exit() functions then holding > a reference to the transport module would be enough to prevent this > case. The transport could only be removed once all sockets have been > destroyed (and dropped their transport module reference). Yes. I did this in "[RFC PATCH 12/13] vsock: prevent transport modules unloading". Maybe I can merge it in this patch... Thanks, Stefano