Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp60874ybc; Fri, 22 Nov 2019 02:04:03 -0800 (PST) X-Google-Smtp-Source: APXvYqynYoFTtz8TLH8uUbGW3X8FTAfEP8/9SPiKOG2h9txdQ8XP76Sot+igtmBlv/O/jleOmEs4 X-Received: by 2002:a17:906:600b:: with SMTP id o11mr20807923ejj.175.1574417043805; Fri, 22 Nov 2019 02:04:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574417043; cv=none; d=google.com; s=arc-20160816; b=gbhCpY1cbWUDCKzs63lWUqezgu1VGuqD0UayUHzohUeHhbR19xge7glQHBpC3qmbQU zKF8adYZbMxHdGNIhkSeO1sR24hso7FfP+VvW5acpp8jHR9s5fJpDqOhC2GKvan815H3 JUDzJ9/Bfe3RCyuap6635rLNbv5smiNHTKKOWSOEuSyBASP4o6fpssXpVctDSJv+uKlM b+4ariIaNvhrNYvuQbNu9c28+LnK2ymQhrmdtd/SXp3ZYiuFi850MXxQllvKt+SQnVzv +uaAKL7T6krzQ8qMNVi5+mJFpL0aOio6puStJYyH3UsAN4/RTl5IY6/Z7c7bv8pd2crH 5pUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:in-reply-to:mime-version:references :message-id:subject:cc:to:from:date:dkim-signature; bh=q5brik//Uj78Imdw+Nasd8kB1YSOqMDawTRFR2gNwAc=; b=eFCl2KgqWkeN8iJPS722ciIJqcwb99yL9EHpBFVcbPLpn3fYfM9ykJ8Ih1jFbKmrbe Osn20Khx7AINwFWauaFDdWtGRBe610Qw3S6nl7CfHI49wQssSXxuQ5iRPxBSCgJlZ+st UOpCqRQ1gZFJ1DShGhsC6qrrAelczYFQlHBKjBv5OU7XQ5aNMuCzkJIcqqqd6uwSiQVA 22XolCmDbI64LNan+V/Q0Pd70ksVxyLKWhm++6O7Piv86XsiD5MeQ2KwuPEDcjrK82pL bZMNBRkbBvU7KvEybmH8eZd1CA7ypNUGpbzAuYD7i1AjB8Prb33Tvx0Xtj80LjHlUYXb KPiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="UlNet/e/"; 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=pass (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 p13si3752902eju.398.2019.11.22.02.03.37; Fri, 22 Nov 2019 02:04:03 -0800 (PST) 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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="UlNet/e/"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726719AbfKVKCX (ORCPT + 99 others); Fri, 22 Nov 2019 05:02:23 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:26764 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726100AbfKVKCW (ORCPT ); Fri, 22 Nov 2019 05:02:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574416940; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=q5brik//Uj78Imdw+Nasd8kB1YSOqMDawTRFR2gNwAc=; b=UlNet/e/vMxmEgMGO0nLCJF4wOK2DyUJzQBVA06EoBW0Uf8YSunAwwqZKvDdcwKx35Ow+2 T8nixD5EaFVqgKi0LRGYd9GpKvqNxtR6y0CGBtU0KDLK/DGIuZpHr3+1+pnWv9OUfZo5IO kOEpqX/pzaZNbW+C/BSq5aWcc85WsQY= 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-375-Jw1Np3e6OH-AOQ2HPnuygQ-1; Fri, 22 Nov 2019 05:02:17 -0500 Received: by mail-wm1-f71.google.com with SMTP id z3so2859974wmk.1 for ; Fri, 22 Nov 2019 02:02:17 -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=TxlQ/8hM2ybpNrpWCxq4vBt3O3dzk/gjN30vFVF3w9c=; b=hhdguYTCh+l7aDq9fwZdDv/q87Wn1EDe7O9CLS9oE3bVXKPufB71ihN63FJ8ZIo00y wgQSEC3eukF8yQwqNz7aEWwXq5y4FVJihEKTVGmKXewqYReYa2/eCoes/yikk9Zsz4A2 yKGnvrWwQGnvTWjkrao7VLkPalSuZbHeLpCtzJnvumhvKXsY29xvGpBh9gaZJ82kWiJg uNByKpj4AD/KUdcNUsQffCSteQPxLLQYh0g1oNnlvLfLFGCOHPywKQQcL3qTzhn1iL8N y5tnFYnJ4/zwGOEWAg4WOVIncImMP1FFb17kVTz36R1K6P49y05HDNapwJ/CRUdymVhT kDwA== X-Gm-Message-State: APjAAAWGqk0ZW76kvtL4jrvDl6QapfHOirdHSqXOItgI3nki69NUDtUV j47zDXDNL83lG5OvvkuKrQyrepVpV0/ed2CdaXv8J3b9kWSYr09XVsCZOrP0KrPQ/vuBEfLVA95 /sjSZn4SWg9gBBu0d25eTHUR+ X-Received: by 2002:a1c:3d8a:: with SMTP id k132mr904876wma.144.1574416936568; Fri, 22 Nov 2019 02:02:16 -0800 (PST) X-Received: by 2002:a1c:3d8a:: with SMTP id k132mr904842wma.144.1574416936299; Fri, 22 Nov 2019 02:02:16 -0800 (PST) Received: from steredhat.homenet.telecomitalia.it (a-nu5-32.tin.it. [212.216.181.31]) by smtp.gmail.com with ESMTPSA id v19sm2111293wrg.38.2019.11.22.02.02.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2019 02:02:15 -0800 (PST) Date: Fri, 22 Nov 2019 11:02:12 +0100 From: Stefano Garzarella To: Stefan Hajnoczi Cc: Stefan Hajnoczi , netdev@vger.kernel.org, virtualization@lists.linux-foundation.org, Dexuan Cui , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, "David S. Miller" , Jorgen Hansen Subject: Re: [PATCH net-next 4/6] vsock: add vsock_loopback transport Message-ID: <20191122100212.u3mvt6qkay7zexz7@steredhat.homenet.telecomitalia.it> References: <20191119110121.14480-1-sgarzare@redhat.com> <20191119110121.14480-5-sgarzare@redhat.com> <20191121093458.GB439743@stefanha-x1.localdomain> <20191121095948.bc7lc3ptsh6jxizw@steredhat> <20191121152517.zfedz6hg6ftcb2ks@steredhat> <20191122092546.GA464656@stefanha-x1.localdomain> MIME-Version: 1.0 In-Reply-To: <20191122092546.GA464656@stefanha-x1.localdomain> X-MC-Unique: Jw1Np3e6OH-AOQ2HPnuygQ-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 22, 2019 at 09:25:46AM +0000, Stefan Hajnoczi wrote: > On Thu, Nov 21, 2019 at 04:25:17PM +0100, Stefano Garzarella wrote: > > On Thu, Nov 21, 2019 at 10:59:48AM +0100, Stefano Garzarella wrote: > > > On Thu, Nov 21, 2019 at 09:34:58AM +0000, Stefan Hajnoczi wrote: > > > > On Tue, Nov 19, 2019 at 12:01:19PM +0100, Stefano Garzarella wrote: > > > > > +static struct workqueue_struct *vsock_loopback_workqueue; > > > > > +static struct vsock_loopback *the_vsock_loopback; > > > >=20 > > > > the_vsock_loopback could be a static global variable (not a pointer= ) and > > > > vsock_loopback_workqueue could also be included in the struct. > > > >=20 > > > > The RCU pointer is really a way to synchronize vsock_loopback_send_= pkt() > > > > and vsock_loopback_cancel_pkt() with module exit. There is no othe= r > > > > reason for using a pointer. > > > >=20 > > > > It's cleaner to implement the synchronization once in af_vsock.c (o= r > > > > virtio_transport_common.c) instead of making each transport do it. > > > > Maybe try_module_get() and related APIs provide the necessary seman= tics > > > > so that core vsock code can hold the transport module while it's be= ing > > > > used to send/cancel a packet. > > >=20 > > > Right, the module cannot be unloaded until open sockets, so here the > > > synchronization is not needed. > > >=20 > > > The synchronization come from virtio-vsock device that can be > > > hot-unplugged while sockets are still open, but that can't happen her= e. > > >=20 > > > I will remove the pointers and RCU in the v2. > > >=20 > > > Can I keep your R-b or do you prefer to watch v2 first? >=20 > I'd like to review v2. >=20 Sure! > > > > > +MODULE_ALIAS_NETPROTO(PF_VSOCK); > > > >=20 > > > > Why does this module define the alias for PF_VSOCK? Doesn't anothe= r > > > > module already define this alias? > > >=20 > > > It is a way to load this module when PF_VSOCK is starting to be used. > > > MODULE_ALIAS_NETPROTO(PF_VSOCK) is already defined in vmci_transport > > > and hyperv_transport. IIUC it is used for the same reason. > > >=20 > > > In virtio_transport we don't need it because it will be loaded when > > > the PCI device is discovered. > > >=20 > > > Do you think there's a better way? > > > Should I include the vsock_loopback transport directly in af_vsock > > > without creating a new module? > > >=20 > >=20 > > That last thing I said may not be possible: > > I remembered that I tried, but DEPMOD found a cyclic dependency because > > vsock_transport use virtio_transport_common that use vsock, so if I > > include vsock_transport in the vsock module, DEPMOD is not happy. > >=20 > > Do you think it's okay in this case to keep MODULE_ALIAS_NETPROTO(PF_VS= OCK) > > or is there a better way? >=20 > The reason I asked is because the semantics of duplicate module aliases > aren't clear to me. Do all modules with the same alias get loaded? > Or just the first? Or ...? It wasn't clear to me either, but when I tried, I saw that all modules with the same alias got loaded. Stefano