Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753164AbbKPRvM (ORCPT ); Mon, 16 Nov 2015 12:51:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47360 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752454AbbKPRvK (ORCPT ); Mon, 16 Nov 2015 12:51:10 -0500 Date: Mon, 16 Nov 2015 18:51:06 +0100 From: =?us-ascii?B?PT9VVEYtOD9xP1JhZGltPTIwS3I9QzQ9OERtPUMzPUExPUM1PTk5?= =?us-ascii?B?Pz0=?= To: "Michael S. Tsirkin" Cc: linux-kernel@vger.kernel.org, Paolo Bonzini , Wanpeng Li , Andy Lutomirski , Xiao Guangrong , Kai Huang , =?us-ascii?B?PT9VVEYtOD9xP01paGFpPTIwRG9uPUM4PTlCdT89?= , kvm@vger.kernel.org Subject: Re: [PATCH] kvm/vmx: EPTP switching test Message-ID: <20151116175105.GA17144@potion.brq.redhat.com> References: <1447598396-6678-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1447598396-6678-1-git-send-email-mst@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2118 Lines: 54 2015-11-15 18:00+0200, Michael S. Tsirkin: > This patch adds a new parameter: eptp_switching_test, which enables > > testing EPT switching on VMX if supported by hardware. All EPT entries > are initialized to the same value so this adds no useful functionality > by itself, but can be used to test VMFUNC performance, and serve as a > basis for future features based on EPTP switching. > > Support for nested virt is not enabled. > > This was tested using the following code within guest: > #define VMX_VMFUNC ".byte 0x0f,0x01,0xd4" > static void vmfunc(unsigned int nr, unsigned int ept) > { > asm volatile(VMX_VMFUNC > : > : "a"(nr), "c"(ept) > : "memory"); > } > > VMFUNC instruction cost was measured at ~122 cycles. > (Note: recent versions of gnu toolchain support > the vmfunc instruction - removing the need for writing > the bytecode manually). > > Signed-off-by: Michael S. Tsirkin > --- > > I think I'd like to put this upstream so future eptp switching work can > be implemented on top. Comments? I'd wait for the future. Patch is already on the list so people interested in benchmarking VMFUNC can quickly compile a kernel and developers will need to overwrite the code anyway. (And I think that eptp switching is expected to be used in conjuction with #VE, so it'd then make sense to implement a nop for it as well.) > diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h > @@ -3011,6 +3035,7 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf) > SECONDARY_EXEC_PAUSE_LOOP_EXITING | > SECONDARY_EXEC_RDTSCP | > SECONDARY_EXEC_ENABLE_INVPCID | > + SECONDARY_EXEC_ENABLE_VM_FUNCTIONS | The VMFUNC vmexit should be handled to prevent guests from triggering a WARN_ON on the host. (VMFUNC did just #UD before this patch.) After that, it's ok for KVM. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/