Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp350754img; Mon, 18 Mar 2019 04:44:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqzA57Z/wbLP1K83YE5a4QF7ghVmF+PW99hBssQjByQEKeCQ/gX5/N574AD+xUj/fGvnw6Ok X-Received: by 2002:a62:e411:: with SMTP id r17mr8323769pfh.127.1552909483252; Mon, 18 Mar 2019 04:44:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552909483; cv=none; d=google.com; s=arc-20160816; b=B8QZFUsqtIc/BPTCXlKcUkSYIeNHEIEOgRYT137SBuMNXszkAvGgU4rsb/BFNyMZPm DFEDBYL8soqDG6mIZUoENef2zHBX3xO9hc29XyawGVIx0AkLpgk1c5GzsaFEiy8GLd08 92Tc/XbOPzevhrGqMTOnt8LeL5p5MK7lrlAV4F6Fz/Jtm9bq8uVQDpXvAhzGZLq4mRqB j8xg9Ye+XEvFyPYd/tkEzkvElDGUtTTIJvy5WFEprs/QWxl7BSdC+79fvFZFZnOQH34H j5gaxG0xEAr8DPgL6nEsGbjWxaEQJJoQwJmx6H8M+X+AcDdLB59zDhL4J3B96CDw4VYb ihlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=061Z4mopchjnAkD9+x0SrzccDxne9iDMbmFO5zmrmYM=; b=uI9aLVpLQCgKhMvdVEiNVTW/YTH2CVTLGcISRPGsiIVL5ru+bwN0au+oET6Uk46ypK PLVoS5iFN9Q92GAUkx+31aRCYuLRjiiRTIMCsMlj5qag7bZTxkZkFn/L58DYXLcSrduB KIsEzXcToNe7IcriOssLu4UCJzNVeCSosGeq3CdeQsM4HKrwJ2/95NpXJD3c91oLHOn8 LWRgXf/3YVawYVESFT3ButFdEl886Khs6uSwcenhvE2/YR/RQ/EmikAoF4hIuKHeomMS 0Ai17x4yO4q/JBczgAA/qPzk4MZtw+HW7IgxwwooBqvREyTr06iIcIbXL8BbDA9Mu4Zv 2X4A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y4si9226933plk.30.2019.03.18.04.44.27; Mon, 18 Mar 2019 04:44:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727178AbfCRLno (ORCPT + 99 others); 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?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= 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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.19.1