Return-Path: Received: from mail.linutronix.de (146.0.238.70:993) by crypto-ml.lab.linutronix.de with IMAP4-SSL for ; 22 Jun 2018 16:22:48 -0000 Received: from mx3-rdu2.redhat.com ([66.187.233.73] helo=mx1.redhat.com) by Galois.linutronix.de with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1fWOpi-00005e-Ht for speck@linutronix.de; Fri, 22 Jun 2018 18:22:47 +0200 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7B11B5A26B for ; Fri, 22 Jun 2018 16:22:39 +0000 (UTC) Received: from [10.36.116.50] (ovpn-116-50.ams2.redhat.com [10.36.116.50]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E80C42026D6C for ; Fri, 22 Jun 2018 16:22:38 +0000 (UTC) Subject: [MODERATED] Re: [PATCH v2.1 6/6] [PATCH v2.1 6/6] Patch #6 References: <20180620204352.134174608@localhost.localdomain> From: Paolo Bonzini Message-ID: <38f18e11-e07d-d2d1-cc45-977ad48d1065@redhat.com> Date: Fri, 22 Jun 2018 18:22:38 +0200 MIME-Version: 1.0 In-Reply-To: <20180620204352.134174608@localhost.localdomain> Content-Type: multipart/mixed; boundary="rLExAHKRDcVi6jIpqd9qAyhNd0al9j3Bn"; protected-headers="v1" To: speck@linutronix.de List-ID: This is an OpenPGP/MIME encrypted message (RFC 4880 and 3156) --rLExAHKRDcVi6jIpqd9qAyhNd0al9j3Bn Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 20/06/2018 22:43, speck for konrad.wilk_at_oracle.com wrote: > x86/KVM: Use L1 cache flush before VMENTER if available. >=20 > Right before we do an VMENTER we need to flush the L1 data cache > to thwart against untrusted guests reading the host memory that > is cached in L1 data cache. This is not what the patch does. The patch adds the usage of the MSR. You should add something like "If provided by the processor, use MSR_IA32_FLUSH_CMD instead of a loop" to the commit message. Paolo > Signed-off-by: Konrad Rzeszutek Wilk > --- > arch/x86/kvm/x86.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) >=20 > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index c0079aae38ba..b7ee35b1e251 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -58,6 +58,7 @@ > =20 > #include > =20 > +#include > #include > #include > #include > @@ -6550,8 +6551,15 @@ static void *__read_mostly empty_zero_pages; > =20 > void kvm_l1d_flush(void) > { > + int size; > + > + if (static_cpu_has(X86_FEATURE_FLUSH_L1D)) { > + x86_flush_l1d(); > + return; > + } > + --rLExAHKRDcVi6jIpqd9qAyhNd0al9j3Bn--