From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1C55C6786C for ; Fri, 14 Dec 2018 13:20:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9682D23C91 for ; Fri, 14 Dec 2018 13:20:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9682D23C91 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729929AbeLNNUm (ORCPT ); Fri, 14 Dec 2018 08:20:42 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59958 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729699AbeLNNUm (ORCPT ); Fri, 14 Dec 2018 08:20:42 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C1969308A95E; Fri, 14 Dec 2018 13:20:41 +0000 (UTC) Received: from redhat.com (ovpn-121-101.rdu2.redhat.com [10.10.121.101]) by smtp.corp.redhat.com (Postfix) with ESMTP id AE3331057044; Fri, 14 Dec 2018 13:20:40 +0000 (UTC) Date: Fri, 14 Dec 2018 08:20:40 -0500 From: "Michael S. Tsirkin" To: Jason Wang Cc: kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jintack Lim Subject: Re: [PATCH net V2 4/4] vhost: log dirty page correctly Message-ID: <20181214081821-mutt-send-email-mst@kernel.org> References: <20181212100819.21295-1-jasowang@redhat.com> <20181212100819.21295-5-jasowang@redhat.com> <20181212092435-mutt-send-email-mst@kernel.org> <0239c220-e7ca-c08f-be26-eb9be63fced3@redhat.com> <20181213092930-mutt-send-email-mst@kernel.org> <519ee6f7-06fc-ad49-03da-c096aeb24ced@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <519ee6f7-06fc-ad49-03da-c096aeb24ced@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Fri, 14 Dec 2018 13:20:42 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 14, 2018 at 10:43:03AM +0800, Jason Wang wrote: > > On 2018/12/13 下午10:31, Michael S. Tsirkin wrote: > > > Just to make sure I understand this. It looks to me we should: > > > > > > - allow passing GIOVA->GPA through UAPI > > > > > > - cache GIOVA->GPA somewhere but still use GIOVA->HVA in device IOTLB for > > > performance > > > > > > Is this what you suggest? > > > > > > Thanks > > Not really. We already have GPA->HVA, so I suggested a flag to pass > > GIOVA->GPA in the IOTLB. > > > > This has advantages for security since a single table needs > > then to be validated to ensure guest does not corrupt > > QEMU memory. > > > > I wonder how much we can gain through this. Currently, qemu IOMMU gives > GIOVA->GPA mapping, and qemu vhost code will translate GPA to HVA then pass > GIOVA->HVA to vhost. It looks no difference to me. > > Thanks The difference is in security not in performance. Getting a bad HVA corrupts QEMU memory and it might be guest controlled. Very risky. If translations to HVA are done in a single place through a single table it's safer as there's a single risky place. -- MST