From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH kvm-unit-tests] vmx: fixes for MAXPHYADDR requirement Date: Thu, 25 Jan 2018 12:06:28 -0500 (EST) Message-ID: <328082763.2585798.1516899988525.JavaMail.zimbra@redhat.com> References: <1516212225-37393-2-git-send-email-pbonzini@redhat.com> <20180125151132.GB19884@flask> <1847212195.2581284.1516898169052.JavaMail.zimbra@redhat.com> <20180125164553.GA23362@flask> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Cc: kvm@vger.kernel.org To: Radim =?utf-8?B?S3LEjW3DocWZ?= Return-path: Received: from mx1.redhat.com ([209.132.183.28]:33150 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751136AbeAYRG2 (ORCPT ); Thu, 25 Jan 2018 12:06:28 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C6B2850176 for ; Thu, 25 Jan 2018 17:06:28 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BB33B608F3 for ; Thu, 25 Jan 2018 17:06:28 +0000 (UTC) In-Reply-To: <20180125164553.GA23362@flask> Sender: kvm-owner@vger.kernel.org List-ID: ----- Original Message ----- > From: "Radim Krčmář" > To: "Paolo Bonzini" > Cc: kvm@vger.kernel.org > Sent: Thursday, January 25, 2018 5:45:54 PM > Subject: Re: [PATCH kvm-unit-tests] vmx: fixes for MAXPHYADDR requirement > > 2018-01-25 11:36-0500, Paolo Bonzini: > > ----- Original Message ----- > > > From: "Radim Krčmář" > > > To: "Paolo Bonzini" > > > Cc: kvm@vger.kernel.org > > > Sent: Thursday, January 25, 2018 4:11:32 PM > > > Subject: Re: [PATCH kvm-unit-tests] vmx: fixes for MAXPHYADDR requirement > > > > > > 2018-01-17 19:03+0100, Paolo Bonzini: > > > > The EPT access tests require at least 41 bits of guest physical address > > > > space. This is because the test data needs a separate PML4 entry in > > > > the > > > > EPT table. However, many consumer-grade processors have only 36 or > > > > 39-bit MAXPHYADDR, and the tests fail there with a page fault due to > > > > reserved bits set in the guest (GVA->GPA) page tables. > > > > > > > > Add a test on MAXPHYADDR and skip the tests if they cannot run on the > > > > system under test, and only require 40 bits to lower the requirements. > > > > > > > > Signed-off-by: Paolo Bonzini > > > > --- > > > > x86/vmx_tests.c | 6 +++++- > > > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > > > > > > diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c > > > > index e8c97f2..0c3b5a7 100644 > > > > --- a/x86/vmx_tests.c > > > > +++ b/x86/vmx_tests.c > > > > @@ -2609,6 +2609,10 @@ static void ept_access_test_setup(void) > > > > if (setup_ept(false)) > > > > test_skip("EPT not supported"); > > > > > > > > + /* We use data->gpa = 1 << 39 so that test data has a separate pml4 > > > > entry > > > > */ > > > > + if (cpuid_maxphyaddr() < 40) > > > > > > This does not help at the moment -- QEMU reports 40 even on hosts that > > > don't have as much. It is a QEMU bug, so applied still, thanks. > > > > True. However, vmx.flat is run with "-cpu host,+vmx", and that should > > forward > > the host MAXPHYADDR, shouldn't it? > > Would make sense for QEMU to do that, but it's not what happens. > I get 40 on both 39 and 46 hosts. > > We can do "-cpu host,+vmx,host_phys_bits" at the cost of breaking unit > tests on old QEMUs ... No, let's fix QEMU. Paolo