Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752593AbdGLNlN (ORCPT ); Wed, 12 Jul 2017 09:41:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47828 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751176AbdGLNlL (ORCPT ); Wed, 12 Jul 2017 09:41:11 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 33ED14E34C Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=rkrcmar@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 33ED14E34C Date: Wed, 12 Jul 2017 15:41:05 +0200 From: Radim =?utf-8?B?S3LEjW3DocWZ?= To: Bandan Das Cc: Jim Mattson , David Hildenbrand , kvm list , Paolo Bonzini , LKML Subject: Re: [PATCH v4 3/3] KVM: nVMX: Emulate EPTP switching for the L1 hypervisor Message-ID: <20170712134105.GG3326@potion> References: <20170710204936.4001-1-bsd@redhat.com> <20170710204936.4001-4-bsd@redhat.com> <2d50ebc4-9328-ce08-b55b-6a331ee13cc3@redhat.com> <20170711191334.GB3442@potion> <20170711202227.GC3442@potion> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 12 Jul 2017 13:41:11 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1981 Lines: 43 2017-07-11 16:45-0400, Bandan Das: > Radim Krčmář writes: > > > 2017-07-11 15:38-0400, Bandan Das: > >> Radim Krčmář writes: > >> > >> > 2017-07-11 14:35-0400, Bandan Das: > >> >> Jim Mattson writes: > >> >> ... > >> >> >>> I can find the definition for an vmexit in case of index >= > >> >> >>> VMFUNC_EPTP_ENTRIES, but not for !vmcs12->eptp_list_address in the SDM. > >> >> >>> > >> >> >>> Can you give me a hint? > >> >> >> > >> >> >> I don't think there is. Since, we are basically emulating eptp switching > >> >> >> for L2, this is a good check to have. > >> >> > > >> >> > There is nothing wrong with a hypervisor using physical page 0 for > >> >> > whatever purpose it likes, including an EPTP list. > >> >> > >> >> Right, but of all the things, a l1 hypervisor wanting page 0 for a eptp list > >> >> address most likely means it forgot to initialize it. Whatever damage it does will > >> >> still end up with vmfunc vmexit anyway. > >> > > >> > Most likely, but not certainly. I also don't see a to diverge from the > >> > spec here. > >> > >> Actually, this is a specific case where I would like to diverge from the spec. > >> But then again, it's L1 shooting itself in the foot and this would be a rarely > >> used code path, so, I am fine removing it. > > > > Thanks, we're not here to judge the guest, but to provide a bare-metal > > experience. :) > > There are certain cases where do. For example, when L2 instruction emulation > fails we decide to kill L2 instead of injecting the error to L1 and let it handle > that. Anyway, that's a different topic, I was just trying to point out there > are cases kvm does a somewhat policy decision... Emulation failure is a KVM bug and we are too lazy to implement the bare-metal behavior correctly, but avoiding the EPTP list bug is actually easier than introducing it. You can make KVM simpler and improve bare-metal emulation at the same time.