Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1201347pxx; Fri, 30 Oct 2020 04:47:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydBHVbLqoAP3I+HuNXSMCw+kHBCfyCeYk0nlgjLuyU1W2JZkhDO3KV7/ZvbWyhsIaFsL4D X-Received: by 2002:a17:906:3641:: with SMTP id r1mr1923816ejb.405.1604058472393; Fri, 30 Oct 2020 04:47:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604058472; cv=none; d=google.com; s=arc-20160816; b=A5atyRaurG4hmemlGAHzM1YViSazOE/Pogdtj9UVqgqtTX0UbUK01JoURDmxeyCKqy iQ6/Ftp+sIOOKEUXDCjl5msO26WMl2M+XgyTGwpHSbXnmbt6lecuZmz3EsFB25cxzAED DJUs5zm7sQ3zM8YLdsyWkzOthI5CZpPep8ZKIAP31OHjwYN+TCOuMhiJPnvnrz7WFRrN ixjoy9iq4AkDWv8Dg6PF/Vu2bkLSmBxANbM4wXTSH0ikLJ4k+EeRhBHcYKm80leVvNbL wqUxbUTNvEwJV781J/8D5YrBK8l19bwPQo3EcsgZbp1dy92JSvOULs0PdN7WypRsVl61 IFJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=rMzfcfElqXmYjTtD+miGi6l1YpfMLIM07gwUkJW1Ka4=; b=dIcIjTVIlqqbLD/gpZoW/X2UhgXUPs1390Mn5fv6nTEXXSXTWD/R99mJQMlZICdDrQ ZkLnst3lCn/gZs8Z1K6MFjJoRCoR/b2yM175El9XSH//rmrysx4X7Nlf6XpuW8v7KN99 OlkOyHZOd6Koqj80cwdDKiiEmkIwpY8iBnsNt7M51p42UA3NwJwYGtF2KJDUhovPFLMn E1p3stiN+mPtqO+AvTdfp+70M+2ChRNC9OgIQVh4zYFNmZ7lUTEKTMli54nel6RN+qy/ L8hciSF7oTp5eQadoggc0wVk22k7cOe2DLWwrFF6zcxc8jxOkn5mZZDvnbHdkk45h6jW kv0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PVFKwuwq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id ch9si4079969edb.172.2020.10.30.04.47.28; Fri, 30 Oct 2020 04:47:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PVFKwuwq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726055AbgJ3LpD (ORCPT + 99 others); Fri, 30 Oct 2020 07:45:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:53114 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726614AbgJ3LpB (ORCPT ); Fri, 30 Oct 2020 07:45:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604058300; 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=rMzfcfElqXmYjTtD+miGi6l1YpfMLIM07gwUkJW1Ka4=; b=PVFKwuwqTRUUOhLjZ8FB3UshrB7jvRAkCkQWB9YzfaCXf7DPKhuwqf5TTBC1eZLoIQPwoo pkOM+cjabNQWwpY/Ndx6W85sy1bwDu/IWqIaJxlZL1/WuZGCdDHVSD01TeOzO9IzdBWyBK zRKMzH4XITTHa3KkV9akZ4frnMPH5+4= 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-584-3sQS_sVaMLePpUqD5ntZlw-1; Fri, 30 Oct 2020 07:44:55 -0400 X-MC-Unique: 3sQS_sVaMLePpUqD5ntZlw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6B6F01017DD0; Fri, 30 Oct 2020 11:44:54 +0000 (UTC) Received: from [10.72.12.248] (ovpn-12-248.pek2.redhat.com [10.72.12.248]) by smtp.corp.redhat.com (Postfix) with ESMTP id 820275CC26; Fri, 30 Oct 2020 11:44:45 +0000 (UTC) Subject: Re: [PATCH] vhost/vsock: add IOTLB API support To: Stefano Garzarella Cc: mst@redhat.com, netdev@vger.kernel.org, Stefan Hajnoczi , kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org References: <20201029174351.134173-1-sgarzare@redhat.com> <751cc074-ae68-72c8-71de-a42458058761@redhat.com> <20201030105422.ju2aj2bmwsckdufh@steredhat> From: Jason Wang Message-ID: <278f4732-e561-2b4f-03ee-b26455760b01@redhat.com> Date: Fri, 30 Oct 2020 19:44:43 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20201030105422.ju2aj2bmwsckdufh@steredhat> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/10/30 下午6:54, Stefano Garzarella wrote: > On Fri, Oct 30, 2020 at 06:02:18PM +0800, Jason Wang wrote: >> >> On 2020/10/30 上午1:43, Stefano Garzarella wrote: >>> This patch enables the IOTLB API support for vhost-vsock devices, >>> allowing the userspace to emulate an IOMMU for the guest. >>> >>> These changes were made following vhost-net, in details this patch: >>> - exposes VIRTIO_F_ACCESS_PLATFORM feature and inits the iotlb >>>   device if the feature is acked >>> - implements VHOST_GET_BACKEND_FEATURES and >>>   VHOST_SET_BACKEND_FEATURES ioctls >>> - calls vq_meta_prefetch() before vq processing to prefetch vq >>>   metadata address in IOTLB >>> - provides .read_iter, .write_iter, and .poll callbacks for the >>>   chardev; they are used by the userspace to exchange IOTLB messages >>> >>> This patch was tested with QEMU and a patch applied [1] to fix a >>> simple issue: >>>     $ qemu -M q35,accel=kvm,kernel-irqchip=split \ >>>            -drive file=fedora.qcow2,format=qcow2,if=virtio \ >>>            -device intel-iommu,intremap=on \ >>>            -device vhost-vsock-pci,guest-cid=3,iommu_platform=on >> >> >> Patch looks good, but a question: >> >> It looks to me you don't enable ATS which means vhost won't get any >> invalidation request or did I miss anything? >> > > You're right, I didn't see invalidation requests, only miss and updates. > Now I have tried to enable 'ats' and 'device-iotlb' but I still don't > see any invalidation. > > How can I test it? (Sorry but I don't have much experience yet with > vIOMMU) I guess it's because the batched unmap. Maybe you can try to use "intel_iommu=strict" in guest kernel command line to see if it works. Btw, make sure the qemu contains the patch [1]. Otherwise ATS won't be enabled for recent Linux Kernel in the guest. Thanks [1] https://patchew.org/QEMU/20200909081731.24688-1-jasowang@redhat.com/ > > Thanks, > Stefano >