From patchwork Mon Mar 18 11:43:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaoyao Li X-Patchwork-Id: 10857479 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 27ACA1575 for ; Mon, 18 Mar 2019 11:43:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D369293CF for ; Mon, 18 Mar 2019 11:43:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 01834293D4; Mon, 18 Mar 2019 11:43:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A8E40293CF for ; Mon, 18 Mar 2019 11:43:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727008AbfCRLno (ORCPT ); Mon, 18 Mar 2019 07:43:44 -0400 Received: from mga18.intel.com ([134.134.136.126]:8128 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726594AbfCRLno (ORCPT ); Mon, 18 Mar 2019 07:43:44 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Mar 2019 04:43:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,493,1544515200"; d="scan'208";a="126363896" Received: from lxy-server.sh.intel.com ([10.239.48.11]) by orsmga008.jf.intel.com with ESMTP; 18 Mar 2019 04:43:41 -0700 From: Xiaoyao Li To: kvm@vger.kernel.org, Paolo Bonzini , =?utf-8?b?UmFk?= =?utf-8?b?aW0gS3LEjW3DocWZ?= Cc: Xiaoyao Li , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , linux-kernel@vger.kernel.org, chao.gao@intel.com Subject: [PATCH v2 0/2] Avoid cpuid faulting leaking and one optimization Date: Mon, 18 Mar 2019 19:43:22 +0800 Message-Id: <20190318114324.14198-1-xiaoyao.li@linux.intel.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This series avoid cpuid faulting of host leakding to guest, which may potentially cause guest boot failure, and use hardware cpuid faulting to remove emulation overhead. Patch 1 avoids cpuid faulting leaking to guest through clearing cpuid faulting bit before enter guest and restoring host's cpuid faulting bit when switch to host. Patch 2 enables hardware cpuid faulting for guest if it exists, to avoid the emulation overhead. ==changelog== v2: - move the save/restore of cpuid faulting bit to vmx_prepare_swich_to_guest/vmx_prepare_swich_to_host to avoid every vmentry RDMSR, based on Paolo's comment. ==previous version== v1: https://patchwork.kernel.org/patch/10852253/ Xiaoyao Li (2): kvm/vmx: avoid CPUID faulting leaking to guest kvm/vmx: Using hardware cpuid faulting to avoid emulation overhead arch/x86/include/asm/kvm_host.h | 2 ++ arch/x86/kvm/vmx/vmx.c | 45 +++++++++++++++++++++++++++++++++ arch/x86/kvm/vmx/vmx.h | 2 ++ arch/x86/kvm/x86.c | 15 ++++++++--- 4 files changed, 61 insertions(+), 3 deletions(-)