Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3164910ybv; Mon, 24 Feb 2020 19:39:12 -0800 (PST) X-Google-Smtp-Source: APXvYqwK8Wu2pFF56Bz6kEumfCcuv6V1cp6kcM6SbONbasPKTHMcnj7r1csvx5wfXjjmJDwzMPEJ X-Received: by 2002:aca:fcd4:: with SMTP id a203mr1751028oii.167.1582601951959; Mon, 24 Feb 2020 19:39:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582601951; cv=none; d=google.com; s=arc-20160816; b=Mr8o6r5ftDY7Qs7qQIRz0dIxXMBj8bT3BRVI3cgs4dZTRPBbh1nj7rXK/+VVR5eSfE M6EG+dKuOSKWa1q4dHMxvrZfs/TykscW4ceoh3ro44NyGd5y+vQt6mEMBJ48i7Lb/F6e tpoN5CDC7RKZ3PPpC7RaizVk/1KdZYk3I2d0o2qI3HilZpJqly/bqqOE3hvwavJKPfgL XioFir2UZQnMml8TL4EeFbqz+WFoVBEmQXHpBp7cQG8dFUrMdPLlo5IsQ08uMejkuM2J iKk+ghEoNcozgoyfx26bTc18dwa3vUxgI674fiy8wTdJCeypu04o64EwjLuUlLlKn5CD 0UKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=FxhGFYz6fAwKel+McHgyPZZNImtqGnzaPwux7zsd3N0=; b=BfNmEyQzIFLYNslB35+zIaMme5Q7IhVsGRaDR2FddalBIm+FN8NuHVLhvEQhIgmoLa ohlE53pYRckNxSUl21WOVkUJsDJXVxBGHGJQ3hiGiSAg0nlEXbVVz7Au2D9ZyUy5/WUq 6X7ZXSFi2Fw90G5MSStnxTD7BWj0tmVO5RHHhuY3ttDhqoO6tp0fBpWYMJmic2g1g74L AlfQ0x7W8+heHo2a9X5cAGxoxIiINVyfvpy8Zx/wSYEXV6RuMu5Y9BbEXkVvtdL5giyV a+iU3aaQFW3SVbDrq7O8cLVenHUJ74YB9fW8A/pw5bVqArR8iNT/g5J6sIzipQby1YZ5 pegw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XxoYKCEo; 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 c196si6037533oib.36.2020.02.24.19.38.58; Mon, 24 Feb 2020 19:39:11 -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=XxoYKCEo; 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 S1728779AbgBYDi4 (ORCPT + 99 others); Mon, 24 Feb 2020 22:38:56 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:41088 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727402AbgBYDi4 (ORCPT ); Mon, 24 Feb 2020 22:38:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582601934; 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=FxhGFYz6fAwKel+McHgyPZZNImtqGnzaPwux7zsd3N0=; b=XxoYKCEoC+5UvrsdzSDj5dlaY9CQe+Urx96zy50d72pYFfgMgZhf7T0+/pIhoOA71ngSZn GUBvL//IU3TVWtpNOgo7Hm8DpVNEj3s8K8eQZzhHnL74yXIHRCtgx0K+YuaeCkISiwPDk/ o8Cc18A15t6dKyu0H1zJtVZY6nz8xxA= 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-108-r7S_sd4lOT-zPkHlkyjcCg-1; Mon, 24 Feb 2020 22:38:50 -0500 X-MC-Unique: r7S_sd4lOT-zPkHlkyjcCg-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 1F27813E4; Tue, 25 Feb 2020 03:38:48 +0000 (UTC) Received: from [10.72.13.170] (ovpn-13-170.pek2.redhat.com [10.72.13.170]) by smtp.corp.redhat.com (Postfix) with ESMTP id 64A1B60BF7; Tue, 25 Feb 2020 03:38:36 +0000 (UTC) Subject: Re: [PATCH 0/2] virtio: decouple protected guest RAM form VIRTIO_F_IOMMU_PLATFORM To: "Michael S. Tsirkin" Cc: Halil Pasic , Marek Szyprowski , Robin Murphy , Christoph Hellwig , linux-s390@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, Christian Borntraeger , Janosch Frank , Viktor Mihajlovski , Cornelia Huck , Ram Pai , Thiago Jung Bauermann , David Gibson , "Lendacky, Thomas" , Michael Mueller References: <20200220160606.53156-1-pasic@linux.ibm.com> <426e6972-0565-c931-e171-da0f58fbf856@redhat.com> <20200221155602.4de41fa7.pasic@linux.ibm.com> <0181712c-e533-fcfd-2638-8a0649d713dd@redhat.com> <20200224010607-mutt-send-email-mst@kernel.org> <20200224024641-mutt-send-email-mst@kernel.org> <08d6bdfb-9b49-c278-3c0b-2e02376cf0cf@redhat.com> <20200224083845-mutt-send-email-mst@kernel.org> From: Jason Wang Message-ID: Date: Tue, 25 Feb 2020 11:38:34 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20200224083845-mutt-send-email-mst@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/2/24 =E4=B8=8B=E5=8D=889:40, Michael S. Tsirkin wrote: >> Subject: [PATCH] vhost: do not set VIRTIO_F_IOMMU_PLATFORM when IOMMU = is not >> used >> >> We enable device IOTLB unconditionally when VIRTIO_F_IOMMU_PLATFORM is >> negotiated. This lead unnecessary IOTLB miss/update transactions when >> IOMMU is used. This patch fixes this. >> >> Signed-off-by: Jason Wang >> --- >> hw/net/virtio-net.c | 3 +++ >> hw/virtio/vhost.c | 4 +--- >> 2 files changed, 4 insertions(+), 3 deletions(-) >> >> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c >> index 3627bb1717..0d50e8bd34 100644 >> --- a/hw/net/virtio-net.c >> +++ b/hw/net/virtio-net.c >> @@ -879,6 +879,9 @@ static void virtio_net_set_features(VirtIODevice *= vdev, uint64_t features) >> virtio_net_apply_guest_offloads(n); >> } >> =20 >> + if (vdev->dma_as =3D=3D &address_space_memory) >> + features &=3D ~(1ULL << VIRTIO_F_IOMMU_PLATFORM); >> + >> for (i =3D 0; i < n->max_queues; i++) { >> NetClientState *nc =3D qemu_get_subqueue(n->nic, i); > This pokes at acked features. I think they are also > guest visible ... It's the acked features of vhost device, so I guess not? E.g virtio_set_features_nocheck() did: =C2=A0=C2=A0=C2=A0 val &=3D vdev->host_features; =C2=A0=C2=A0=C2=A0 if (k->set_features) { =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 k->set_features(vdev, val); =C2=A0=C2=A0=C2=A0 } =C2=A0=C2=A0=C2=A0 vdev->guest_features =3D val; Thanks >