Received: by 10.223.185.116 with SMTP id b49csp640490wrg; Sat, 10 Feb 2018 15:42:24 -0800 (PST) X-Google-Smtp-Source: AH8x226I6lLk44Ssyd8oYhZYHn0JEDhaGl0ZzHM1fwZwPRDbgBlYLS7tCAm656w/qx4ps7Vifm/B X-Received: by 2002:a17:902:b685:: with SMTP id c5-v6mr6803538pls.174.1518306144804; Sat, 10 Feb 2018 15:42:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518306144; cv=none; d=google.com; s=arc-20160816; b=yMaDJgXs1PZuPLn9EDYwIbsFazqWJwanuBLkrH1WSOM1fWnCGt//6EvcnHLBP4tRqR +9mggQ5Nybp7SGsIfYLXcOvAeDW6SDEzX7pmOVej75Z1zDs0u8pCzWrHVDw5Q3GEvzhd DtIjb/qaYPELvvu0b0r/hnbvJjMVmXvDHsR24+9vnYRHcq72AJiZgg+jX7W/3z68jQDB 6KYOYcleiI8345D0h22SYj3kJWQsIdnU9GjWVa4+m55NWkzoFY8tcc6Zmg3vyI66vOze wdtvk0WK5UXTBpJtctcoD9SjSf83KePftcK92maHXu7+Kb1ff59oh/SnSDDYMH2OTvM2 dY4A== 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 :references:in-reply-to:message-id:date:subject:to:from :dkim-signature:arc-authentication-results; bh=uxbwxtmIvhE0tyQHd+cQ7Y8SXXOjvCrqvWMTN7dbEyQ=; b=AKnYerJoic3x0xC8LThRi89Wwnvn86r78iD29urbaz3DpW567nzAagQgin8uj0zcvC 9Ro3Wovpa8nbcgvaAh5poZwxrpFTdRUvFT8IEQxe5vvux8sMZiepbLVAbAfKzZC3m4tO vCeXG3aykoCHQ6TjfPecaH4x8n36+mKRv3/L0qs5B8Qg5yRZh8fF+KZ090LyFUwt3+lD RTGa27XCiIkgwiyDezTv+ykCfkWDCd2agxqc5pitSZ3bX9PM7NJPST4Zmlq8BDeYkEdc 2vCOXGQT+WUcGTmsXfQXX+YS33UUeYRDl/8GFK/YaaoOIMagzGpfAaeTX4A+4lkl6PZL 9eIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.co.uk header.s=amazon201209 header.b=SjOr/goc; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.co.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e9si3228698pgt.828.2018.02.10.15.41.41; Sat, 10 Feb 2018 15:42:24 -0800 (PST) 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; dkim=pass header.i=@amazon.co.uk header.s=amazon201209 header.b=SjOr/goc; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.co.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753006AbeBJXj5 (ORCPT + 99 others); Sat, 10 Feb 2018 18:39:57 -0500 Received: from smtp-fw-6001.amazon.com ([52.95.48.154]:21160 "EHLO smtp-fw-6001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752988AbeBJXjy (ORCPT ); Sat, 10 Feb 2018 18:39:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.co.uk; i=@amazon.co.uk; q=dns/txt; s=amazon201209; t=1518305994; x=1549841994; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=uxbwxtmIvhE0tyQHd+cQ7Y8SXXOjvCrqvWMTN7dbEyQ=; b=SjOr/gocC6SXeAhX2iC6qldvzBkWtBbokQWFXEkaAlsffh2Zvp6MHIRL pCdWVn/CPD8Wj1hIEHgBM+0Yh9LXVqzXbMbZzXt6g4PjeenU5QS6qyAim VwDfa3q1gfoa8Vvp0YKGF1XKHneZQBsMTSNfeEzHUSqrWzl6W160pOFTf Q=; X-IronPort-AV: E=Sophos;i="5.46,492,1511827200"; d="scan'208";a="331584187" Received: from iad6-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-2c-168cbb73.us-west-2.amazon.com) ([10.124.125.6]) by smtp-border-fw-out-6001.iad6.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 10 Feb 2018 23:39:52 +0000 Received: from uc8d3ff76b9bc5848a9cc.ant.amazon.com (pdx2-ws-svc-lb17-vlan3.amazon.com [10.247.140.70]) by email-inbound-relay-2c-168cbb73.us-west-2.amazon.com (8.14.7/8.14.7) with ESMTP id w1ANdib0093196 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 10 Feb 2018 23:39:46 GMT Received: from uc8d3ff76b9bc5848a9cc.ant.amazon.com (localhost [127.0.0.1]) by uc8d3ff76b9bc5848a9cc.ant.amazon.com (8.15.2/8.15.2/Debian-3) with ESMTP id w1ANdiDA031613; Sat, 10 Feb 2018 23:39:44 GMT Received: (from dwmw@localhost) by uc8d3ff76b9bc5848a9cc.ant.amazon.com (8.15.2/8.15.2/Submit) id w1ANdhRv031612; Sat, 10 Feb 2018 23:39:43 GMT From: David Woodhouse To: tglx@linutronix.de, karahmed@amazon.de, sironi@amazon.de, x86@kernel.org, kvm@vger.kernel.org, torvalds@linux-foundation.org, pbonzini@redhat.com, linux-kernel@vger.kernel.org, bp@alien8.de, peterz@infradead.org, jmattson@google.com, rkrcmar@redhat.com, arjan.van.de.ven@intel.com, dave.hansen@intel.com Subject: [PATCH v2 5/6] KVM/nVMX: Set the CPU_BASED_USE_MSR_BITMAPS if we have a valid L02 MSR bitmap Date: Sat, 10 Feb 2018 23:39:26 +0000 Message-Id: <1518305967-31356-6-git-send-email-dwmw@amazon.co.uk> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518305967-31356-1-git-send-email-dwmw@amazon.co.uk> References: <1518305967-31356-1-git-send-email-dwmw@amazon.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: KarimAllah Ahmed We either clear the CPU_BASED_USE_MSR_BITMAPS and end up intercepting all MSR accesses or create a valid L02 MSR bitmap and use that. This decision has to be made every time we evaluate whether we are going to generate the L02 MSR bitmap. Before commit 086e7d4118cc ("KVM: VMX: Allow direct access to MSR_IA32_SPEC_CTRL") this was probably OK since the decision was always identical. This is no longer the case now since the MSR bitmap might actually change once we decide to not intercept SPEC_CTRL and PRED_CMD. Signed-off-by: KarimAllah Ahmed Signed-off-by: David Woodhouse Cc: Paolo Bonzini Cc: Radim Krčmář Cc: kvm@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- arch/x86/kvm/vmx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 599179b..91e3539 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -10130,7 +10130,8 @@ static void nested_get_vmcs12_pages(struct kvm_vcpu *vcpu, if (cpu_has_vmx_msr_bitmap() && nested_cpu_has(vmcs12, CPU_BASED_USE_MSR_BITMAPS) && nested_vmx_merge_msr_bitmap(vcpu, vmcs12)) - ; + vmcs_set_bits(CPU_BASED_VM_EXEC_CONTROL, + CPU_BASED_USE_MSR_BITMAPS); else vmcs_clear_bits(CPU_BASED_VM_EXEC_CONTROL, CPU_BASED_USE_MSR_BITMAPS); -- 2.7.4