Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp28121ybc; Fri, 22 Nov 2019 01:27:51 -0800 (PST) X-Google-Smtp-Source: APXvYqxEKS/sfv0emKUUrxSGswzDojmQdjcL7PgwryjGPLBgIoebVQWIyxcMvbRWZ8Jdkr6VH9CT X-Received: by 2002:a17:906:bc9:: with SMTP id y9mr20963992ejg.64.1574414871836; Fri, 22 Nov 2019 01:27:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574414871; cv=none; d=google.com; s=arc-20160816; b=fjPs5/tPybHdB1iZnPovhWWz85s0o++ePly+/WwBm9kDf4GFDSoz1baLZkXHzilSpN Pj0O3xdYygxsxiT02Y/Cr5tr7brgGXIm0EfEk+Ka4QpA/yuy733xPSWFGlMAcHVtH27C wbRFW4ZJGIDO5kJ21r6bjsS9sVEiN1VYGV0RYIyQoSTimXLNPIHdFs+HKLNN3vxXn40F kNdm5dX4yYYnHPK73eulCvRMXndgNC6aYDCBtI636F0e7aDzY3ENJwH0ZcU7cyk2gN/o r/8zorb2DPPBWg2ldrVfjwxVr5LRd9APDRcvwkOJuSU9a1UtDFtLc/rUYwxDQIDU8IHt SJDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition:user-agent :in-reply-to:mime-version:references:message-id:subject:cc:to:from :date:dkim-signature; bh=NQ5wfa2k/ZGh4tRlMZlUTAY+jcVvzWiqwqcMi1NaDLQ=; b=GyC8gHzN6l2oQYsbnf6uTvJP+5NsV0D4fc7s8EhnwYqmJ7JnKRApfhAgPEZP4Wun9V ShobFKyB1S2QhWFm/83gjrlgzv09JDOauL9tOQzK5Qjt3CfhaQ4WhkT90t5p0UjtBX3+ aZsB80wt7T2uuVm8pa10B8YbYuwiLEXzKEzNaENZMObWvWQuw6KtmsGZmrUkWfFGwEyW cq5a3u7912apKu1J7wk7E+9Zbqen0mGp9xh3KDIzll0hebwoXCt71unm94h3eFzxD9rT kk6vwBvRhdMjaBmTZ0w3PPS0BJjguWtnGKik2Pzdbdnn7KKMuNntpL9ee8I5z+o4Jd1s J//w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=daxj+s3P; 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 w19si4967567edd.51.2019.11.22.01.27.28; Fri, 22 Nov 2019 01:27:51 -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=daxj+s3P; 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 S1726905AbfKVJZw (ORCPT + 99 others); Fri, 22 Nov 2019 04:25:52 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:30515 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726568AbfKVJZw (ORCPT ); Fri, 22 Nov 2019 04:25:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574414751; 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=NQ5wfa2k/ZGh4tRlMZlUTAY+jcVvzWiqwqcMi1NaDLQ=; b=daxj+s3PW5S1Tr6/cnX3Eir4qg3bo6xMSGavDFR9/947ZTAooX5opI8994bA5u7YN9UxUL UYHA6aWJsf3lUtMQD9nsFAi0Rkgei0f+4FJ8CFT+4bO+rfOr7SPZOank+SheQzq5v6D15T RpTb26Uy2wKJx2Xe6M5bHjtcRT/AVH0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-317-l_ijsUHGPBSfxTfG5fbmtQ-1; Fri, 22 Nov 2019 04:25:50 -0500 X-MC-Unique: l_ijsUHGPBSfxTfG5fbmtQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2C04D107AD89; Fri, 22 Nov 2019 09:25:48 +0000 (UTC) Received: from localhost (unknown [10.36.118.40]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7BC3B5D6A7; Fri, 22 Nov 2019 09:25:47 +0000 (UTC) Date: Fri, 22 Nov 2019 09:25:46 +0000 From: Stefan Hajnoczi To: Stefano Garzarella 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: <20191122092546.GA464656@stefanha-x1.localdomain> References: <20191119110121.14480-1-sgarzare@redhat.com> <20191119110121.14480-5-sgarzare@redhat.com> <20191121093458.GB439743@stefanha-x1.localdomain> <20191121095948.bc7lc3ptsh6jxizw@steredhat> <20191121152517.zfedz6hg6ftcb2ks@steredhat> MIME-Version: 1.0 In-Reply-To: <20191121152517.zfedz6hg6ftcb2ks@steredhat> User-Agent: Mutt/1.12.1 (2019-06-15) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="zYM0uCDKw75PZbzx" Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --zYM0uCDKw75PZbzx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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_pk= t() > > > and vsock_loopback_cancel_pkt() with module exit. There is no other > > > reason for using a pointer. > > >=20 > > > It's cleaner to implement the synchronization once in af_vsock.c (or > > > virtio_transport_common.c) instead of making each transport do it. > > > Maybe try_module_get() and related APIs provide the necessary semanti= cs > > > so that core vsock code can hold the transport module while it's bein= g > > > 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 here. > >=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? I'd like to review v2. > > > > +MODULE_ALIAS_NETPROTO(PF_VSOCK); > > >=20 > > > Why does this module define the alias for PF_VSOCK? Doesn't another > > > 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_VSOC= K) > or is there a better way? 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 ...? Stefan --zYM0uCDKw75PZbzx Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAl3XqZoACgkQnKSrs4Gr c8g8zwgAgv0qn/NHDbIBcCRih2eGRkR+l2CqDKByM5A65GN5n5ZwQJvooj/0hZZa maHWK3vTmOU1c5m5gwRHJcTNTvK3hL3xYgxMCzanpWkpK6xPFSbBReQ1KtN+2IJh 1bXN7mvpTAKFkIm10jnGIzK53Tv5y46c+dHQ+Q+Wx56zSCMWcMhPZUBXSAE8Tx61 VAeo0HFPzx/wgy785xR3+tw4xV0M8UlbcYqJG/jTToIES2z4JUNIVTAczg22QpSe hp9KwKDgSMvJLmb6fzefYTgp/hTT3fQh448YbpeHAsly8RSoJjkJx/1w4qj/AVAT rI4XWaP4Enu7IgGna2wLQSCP+fqRog== =VfA7 -----END PGP SIGNATURE----- --zYM0uCDKw75PZbzx--