From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Michael S. Tsirkin" Subject: Re: [PATCH net V2 4/4] vhost: log dirty page correctly Date: Fri, 14 Dec 2018 08:20:40 -0500 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-Transfer-Encoding: 8bit Cc: kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jintack Lim To: Jason Wang Return-path: Content-Disposition: inline In-Reply-To: <519ee6f7-06fc-ad49-03da-c096aeb24ced@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.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