Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4685928ybg; Tue, 29 Oct 2019 10:51:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqzr8seVYlo0PBokHgrWOHV/XVOzthETsvKZ9BKXqsBsbDcPHWA+oAQiJWTB62xWBCYFtITU X-Received: by 2002:a50:eb81:: with SMTP id y1mr27351178edr.119.1572371516506; Tue, 29 Oct 2019 10:51:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572371516; cv=none; d=google.com; s=arc-20160816; b=irrhshF06wTC4OMmtM2JVHy9mKsylmpeybZWvgXnAX0ZozeIaDspSUbwg0k0GoFMEr 4DmtwI/hUjEG7OhK7QoeJt8xvH/6XyFaN8RzrgjnVEMLV9VSIX/0kxHTsrnk71jMydyu BhpBb3MuXU9j0TZJlhASMosUIGnPylm0RTezMmfpGvoK9FSjRKAtwhNRe6dR3IOxTkrR dQpQln7dz1XhilvOO3Eg0fhJ/2y+pyXkBacnGBxgBUgtyXQpcO3cv1lLAiIGrRtnA9rW 0uVv4TFALT05ZgoHu5ho7EQCvdJRpHhu+MbM+pTfIYfOPO6atcR1mu97C56kGFzAVYVd SzyQ== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=Ka4FA+FB80gAFjOJHY8VgSTAxk4ueZyTP3tPTO7hyOQ=; b=Gn8QL0xL37T1wEpUQ8yParetBLlsPL+H/9NBJrSZbAkGAgOPEsEdtxSV7LL4zT8Ckn QYAwcUYGTX5q2zV6xaXDZ6d9qcoM6GM5TQD3z8139aMDQGHz2rV904PyPfotc3Ad4uHv cGKjbreN7eXlZgKt+l4f0lD5hMihoVaYFWHSk+9xrlZBHuXlcwR+s9hEf21JnqT8wTzT NBZbSPTJKzRuQZsUbFUAl76lsEgLRHBB2/y+0mpmQcnHG4ZWkzUja9TBjcnmRfmtvwqq hWBvcwHHROewG8+5GQLMWY4ljatfApJRAr221ySe3j1badNNHRyJ4PF22AQK+9lFDBcQ 5Nwg== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e50si10897057ede.59.2019.10.29.10.51.32; Tue, 29 Oct 2019 10:51:56 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727592AbfJ2J4v (ORCPT + 99 others); Tue, 29 Oct 2019 05:56:51 -0400 Received: from mga17.intel.com ([192.55.52.151]:31715 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726342AbfJ2J4u (ORCPT ); Tue, 29 Oct 2019 05:56:50 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Oct 2019 02:56:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,243,1569308400"; d="scan'208";a="374497156" Received: from dpdk-virtio-tbie-2.sh.intel.com (HELO ___) ([10.67.104.74]) by orsmga005.jf.intel.com with ESMTP; 29 Oct 2019 02:56:47 -0700 Date: Tue, 29 Oct 2019 17:57:38 +0800 From: Tiwei Bie To: Jason Wang Cc: "Michael S. Tsirkin" , alex.williamson@redhat.com, maxime.coquelin@redhat.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, dan.daly@intel.com, cunming.liang@intel.com, zhihong.wang@intel.com, lingshan.zhu@intel.com Subject: Re: [PATCH v2] vhost: introduce mdev based hardware backend Message-ID: <20191029095738.GA7228@___> References: <5a7bc5da-d501-2750-90bf-545dd55f85fa@redhat.com> <20191024042155.GA21090@___> <20191024091839.GA17463@___> <20191025080143-mutt-send-email-mst@kernel.org> <20191028015842.GA9005@___> <5e8a623d-9d91-607a-1f9e-7a7086ba9a68@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5e8a623d-9d91-607a-1f9e-7a7086ba9a68@redhat.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 28, 2019 at 11:50:49AM +0800, Jason Wang wrote: > On 2019/10/28 上午9:58, Tiwei Bie wrote: > > On Fri, Oct 25, 2019 at 08:16:26AM -0400, Michael S. Tsirkin wrote: > > > On Fri, Oct 25, 2019 at 05:54:55PM +0800, Jason Wang wrote: > > > > On 2019/10/24 下午6:42, Jason Wang wrote: > > > > > Yes. > > > > > > > > > > > > > > > >   And we should try to avoid > > > > > > putting ctrl vq and Rx/Tx vqs in the same DMA space to prevent > > > > > > guests having the chance to bypass the host (e.g. QEMU) to > > > > > > setup the backend accelerator directly. > > > > > > > > > > That's really good point.  So when "vhost" type is created, parent > > > > > should assume addr of ctrl_vq is hva. > > > > > > > > > > Thanks > > > > > > > > This works for vhost but not virtio since there's no way for virtio kernel > > > > driver to differ ctrl_vq with the rest when doing DMA map. One possible > > > > solution is to provide DMA domain isolation between virtqueues. Then ctrl vq > > > > can use its dedicated DMA domain for the work. > > It might not be a bad idea to let the parent drivers distinguish > > between virtio-mdev mdevs and vhost-mdev mdevs in ctrl-vq handling > > by mdev's class id. > > > Yes, that should work, I have something probable better, see below. > > > > > > > > Anyway, this could be done in the future. We can have a version first that > > > > doesn't support ctrl_vq. > > +1, thanks > > > > > > Thanks > > > Well no ctrl_vq implies either no offloads, or no XDP (since XDP needs > > > to disable offloads dynamically). > > > > > > if (!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS) > > > && (virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO4) || > > > virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO6) || > > > virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_ECN) || > > > virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_UFO) || > > > virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_CSUM))) { > > > NL_SET_ERR_MSG_MOD(extack, "Can't set XDP while host is implementing LRO/CSUM, disable LRO/CSUM first"); > > > return -EOPNOTSUPP; > > > } > > > > > > neither is very attractive. > > > > > > So yes ok just for development but we do need to figure out how it will > > > work down the road in production. > > Totally agree. > > > > > So really this specific virtio net device does not support control vq, > > > instead it supports a different transport specific way to send commands > > > to device. > > > > > > Some kind of extension to the transport? Ideas? > > > So it's basically an issue of isolating DMA domains. Maybe we can start with > transport API for querying per vq DMA domain/ASID? > > - for vhost-mdev, userspace can query the DMA domain for each specific > virtqueue. For control vq, mdev can return id for software domain, for the > rest mdev will return id of VFIO domain. Then userspace know that it should > use different API for preparing the virtqueue, e.g for vq other than control > vq, it should use VFIO DMA API. The control vq it should use hva instead. > > - for virito-mdev, we can introduce per-vq DMA device, and route DMA mapping > request for control vq back to mdev instead of the hardware. (We can wrap > them into library or helpers to ease the development of vendor physical > drivers). Thanks for this proposal! I'm thinking about it these days. I think it might be too complicated. I'm wondering whether we can have something simpler. I will post a RFC patch to show my idea today. Thanks, Tiwei > > Thanks > > > > > > > > > > > -- > > > MST >