Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1521859ybv; Thu, 20 Feb 2020 22:23:08 -0800 (PST) X-Google-Smtp-Source: APXvYqwHU3bqRJqOwjLJbGGjrYW0MPxlD505zsXVwjNt63CC/pCEek/p7bQ+/rWdKzeP0kVRyjus X-Received: by 2002:a05:6808:3b4:: with SMTP id n20mr717439oie.78.1582266188229; Thu, 20 Feb 2020 22:23:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582266188; cv=none; d=google.com; s=arc-20160816; b=B+/5Yfy9r5ECC973dVKzEr36zSdxBOlsXepeQyloRTMoMoWzPXlwUYu7xm8Nxlqx9n xB68Psg1xmktesLVKj+kVjknIU55T3TUm1JTmDYKOgM9w8drmhSfbXGAqwakyP6HgJUI vWwSkcHzrM+iC3z81JO6oDMGNJvkXXBmJKti4SaHASJFHzrWlzPACCsSgfrKRYQMmReL yosyLv1DGm8Ilaw5FklFml11D/A5hPxgF554f6mxHHNN/nVnDn/6UKogZMfODFBmKmRc ZUT0yw9wOucV6gV794unFqlf9P+f/d72Qa3q9I1BUyFUCsTxEVPlN9biYuvLz45q6aps uo3g== 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=6qXib0FabgbTKY5pRwiBWRR8XUkKsOvRz+kOZ5ar6RE=; b=aGXpXJ+yzleyDGlQzqFfQJ3wprbaY7CI8Te2tLDgsBadde9A0ul12M8+Wen7Wc/y5x xgSgRA5GkHCU0tHRqVvxMi+msW2I+Emg/KceABFx8ow83J07cFIuE7mEN4hb09PGcnm5 YB4rufXmFpNFXacCcEgOy5zBVhyP0Jz/RHaLWClBOTUgoawypmGkX6sn2VvBAdo+9gyO QQVKFqIg5JWCJ8A91v2n68EbF0i2RlR4QndpUFrK48EeXUnpHan1AQFbc0KzaJXsvQqg F8dBwhFpiAinYVQSWh/WPo+ynicvHAudvCQKr+OZZtOiGMZJy8n+HhKnf46cDg92SVnG RDbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bf5c+Gxo; 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 m14si980497otr.131.2020.02.20.22.22.54; Thu, 20 Feb 2020 22:23:08 -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=bf5c+Gxo; 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 S1726836AbgBUGWq (ORCPT + 99 others); Fri, 21 Feb 2020 01:22:46 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:51572 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726410AbgBUGWq (ORCPT ); Fri, 21 Feb 2020 01:22:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582266163; 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=6qXib0FabgbTKY5pRwiBWRR8XUkKsOvRz+kOZ5ar6RE=; b=bf5c+Gxo/NV+RXfOvYxz0OyBrFLIQkbgG5ZnmwTiFySw62vlx6i6KADoXZnS97JqAl3XwJ 74ocWg48AGSuCdOCvIbmP+bMJE/+rbDSfRRYIUgesLRgAYh+ok+hG1UTTIrhNyopvkQr8U XRxiovMHQyTBui9F5RIDJMspmPt/96o= 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-469-4HogxvKtMr2o0vgcZfl8sQ-1; Fri, 21 Feb 2020 01:22:40 -0500 X-MC-Unique: 4HogxvKtMr2o0vgcZfl8sQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 15F968018A7; Fri, 21 Feb 2020 06:22:37 +0000 (UTC) Received: from [10.72.13.208] (ovpn-13-208.pek2.redhat.com [10.72.13.208]) by smtp.corp.redhat.com (Postfix) with ESMTP id C4A528B57B; Fri, 21 Feb 2020 06:22:27 +0000 (UTC) Subject: Re: [PATCH 0/2] virtio: decouple protected guest RAM form VIRTIO_F_IOMMU_PLATFORM To: Halil Pasic , "Michael S. Tsirkin" , Marek Szyprowski , Robin Murphy , Christoph Hellwig Cc: 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> From: Jason Wang Message-ID: <426e6972-0565-c931-e171-da0f58fbf856@redhat.com> Date: Fri, 21 Feb 2020 14:22:26 +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: <20200220160606.53156-1-pasic@linux.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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/21 =E4=B8=8A=E5=8D=8812:06, Halil Pasic wrote: > Currently if one intends to run a memory protection enabled VM with > virtio devices and linux as the guest OS, one needs to specify the > VIRTIO_F_IOMMU_PLATFORM flag for each virtio device to make the guest > linux use the DMA API, which in turn handles the memory > encryption/protection stuff if the guest decides to turn itself into > a protected one. This however makes no sense due to multiple reasons: > * The device is not changed by the fact that the guest RAM is > protected. The so called IOMMU bypass quirk is not affected. > * This usage is not congruent with standardised semantics of > VIRTIO_F_IOMMU_PLATFORM. Guest memory protected is an orthogonal reason > for using DMA API in virtio (orthogonal with respect to what is > expressed by VIRTIO_F_IOMMU_PLATFORM). > > This series aims to decouple 'have to use DMA API because my (guest) RA= M > is protected' and 'have to use DMA API because the device told me > VIRTIO_F_IOMMU_PLATFORM'. > > Please find more detailed explanations about the conceptual aspects in > the individual patches. There is however also a very practical problem > that is addressed by this series. > > For vhost-net the feature VIRTIO_F_IOMMU_PLATFORM has the following sid= e > effect The vhost code assumes it the addresses on the virtio descriptor > ring are not guest physical addresses but iova's, and insists on doing = a > translation of these regardless of what transport is used (e.g. whether > we emulate a PCI or a CCW device). (For details see commit 6b1e6cc7855b > "vhost: new device IOTLB API".) On s390 this results in severe > performance degradation (c.a. factor 10). Do you see a consistent degradation on the performance, or it only=20 happen when for during the beginning of the test? > BTW with ccw I/O there is > (architecturally) no IOMMU, so the whole address translation makes no > sense in the context of virtio-ccw. I suspect we can do optimization in qemu side. E.g send memtable entry via IOTLB API when vIOMMU is not enabled. If this makes sense, I can draft patch to see if there's any difference. Thanks > > Halil Pasic (2): > mm: move force_dma_unencrypted() to mem_encrypt.h > virtio: let virtio use DMA API when guest RAM is protected > > drivers/virtio/virtio_ring.c | 3 +++ > include/linux/dma-direct.h | 9 --------- > include/linux/mem_encrypt.h | 10 ++++++++++ > 3 files changed, 13 insertions(+), 9 deletions(-) > > > base-commit: ca7e1fd1026c5af6a533b4b5447e1d2f153e28f2