From: Radim =?utf-8?B?S3LEjW3DocWZ?= Subject: Re: [RFC][PATCH] KVM: SVM: Sync g_pat with guest-written PAT value Date: Tue, 21 Apr 2015 14:10:25 +0200 Message-ID: <20150421121021.GG26491@potion.brq.redhat.com> References: <552B5128.4010909@siemens.com> <552B6923.3020602@siemens.com> <20150420161401.GB26491@potion.brq.redhat.com> <20150420171635.GC26491@potion.brq.redhat.com> <553535B1.3050901@siemens.com> <20150420173345.GB26478@potion.brq.redhat.com> <55353957.6010907@siemens.com> <55353B3A.6060907@siemens.com> <20150420183303.GF26491@potion.brq.redhat.com> <55354871.5030208@siemens.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm , Joel Schopp To: Jan Kiszka Return-path: Received: from mx1.redhat.com ([209.132.183.28]:46468 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750937AbbDUMK3 (ORCPT ); Tue, 21 Apr 2015 08:10:29 -0400 Content-Disposition: inline In-Reply-To: <55354871.5030208@siemens.com> Sender: kvm-owner@vger.kernel.org List-ID: 2015-04-20 20:41+0200, Jan Kiszka: > On 2015-04-20 20:33, Radim Kr=C4=8Dm=C3=A1=C5=99 wrote: > > 2015-04-20 19:45+0200, Jan Kiszka: > >> On 2015-04-20 19:37, Jan Kiszka wrote: > >>> On 2015-04-20 19:33, Radim Kr=C4=8Dm=C3=A1=C5=99 wrote: > >>>> 2015-04-20 19:21+0200, Jan Kiszka: > >>>>> On 2015-04-20 19:16, Radim Kr=C4=8Dm=C3=A1=C5=99 wrote: > >>>>>> 2015-04-20 18:14+0200, Radim Kr=C4=8Dm=C3=A1=C5=99: > >>>>>>> Tested-by: Radim Kr=C4=8Dm=C3=A1=C5=99 > >>>>>> > >>>>>> Uncached accesses were roughly 20x slower. > >>>>>> In case anyone wanted to reproduce, I used this as a kvm-unit-= test: > >>>>>> > >>>>>> --- > >>>> | [code] > >>>>> > >>>>> Great, thanks. Will you push it to the unit tests? Could raise > >>>>> motivations to fix the !NPT/EPT case. > >>>> > >>>> It can't be included in `run_tests.sh`, because we intenionally = ignore > >>>> PAT for normal RAM on VMX and the test does "fail" ... > >>> > >>> That ignoring is encoded into the EPT? > >=20 > > Yes, it's the VMX_EPT_IPAT_BIT. > >=20 > >> And do you also know why is it ignored on Intel? Side effects on t= he host? > >=20 > > I think it is an optimization exclusive to Intel. > > We know that the other side is not real hardware, which could avoid= CPU > > caches when accessing memory, so there is little reason to slow the > > guest down. >=20 > If the guest pushes data for DMA into RAM, it may assume that it land= s > there directly, without the need for explicit flushes, because it has > caching disabled - no? Yes, the guest can't tell a difference. In the presence of an assigned device, we always consider PAT; with VFIO, ignoring PAT is decided by coherent DMA capability. Emulated DMA requests are handled by the host, so the IPAT bit optimize= s cases where we know that caches are always right, but the guest doesn't= =2E