Received: by 10.223.185.116 with SMTP id b49csp1738089wrg; Sun, 11 Feb 2018 20:07:14 -0800 (PST) X-Google-Smtp-Source: AH8x227LfH6+ctOYI3/YH04qTyUrsucjDOk07uybKkNihKf2Xg02pITEKDGStuTkWc/CyNwqvKpX X-Received: by 10.101.74.68 with SMTP id a4mr8219334pgu.176.1518408434327; Sun, 11 Feb 2018 20:07:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518408434; cv=none; d=google.com; s=arc-20160816; b=B3NZsbnlTpubpxoNZfmx1USbkZY4XSkJMY1uPwvlIczORTkBONW5GAvqhM63BX4jpK BLvmu1y86kCs48+Dm8ZGUwdOa54gma2Q4Zqy+WgsBGijyFyK8ZS5fp3sPR+xZgtBomWy Rva6MTpoi/AwUEn3ItmGisL2nWOX6iHkLQ3Z2Xey6iOpqtL6pbZG7rNuUFt7R/Os7sWu v6I2TWWyn76DZu67DUlB1w38pN8Dwxjk2shSeqbn0q343GW4PenwlEwrDvEUl2mSMuFg L9umER5B3DW6q0Aemrnh7kG1LWAIpJPqjBKPYOazwOgmkc4f667DDkgkuBgB84pPLxu5 vB0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=STmFPGpeWrYW9bt656jpayBxR2fBVtm1kElcVTy2Gio=; b=QksrDOlFwwSVzGF2oVny76qBE78CzB78BCLCnwsfaOTp5SKzPjf8DuRnt1rVLhkAm/ Gpks8lF/kxDLcAGakuvYCOQt3mL73EyVplZ+uQ2tZ3r+jnRpcy8RscaTaRSVjiozpMjR /vK5GQaFUxGec9L4J7PX7SLBw4uP+7BQc/7FRgOrXeuSsKQES/QasFOQtBrhciLphYjV sd3QtOmZuq+3jceGEoLgTIJ1SapeDblFesnslo4w+URifBrdd300AhkTZqEHsHt5sFL8 fmBxRp9anmF0Eb9GNHWsO0bT4F5PNINguL3upPpfh/HEVRyMmQkbcELJR2n5yYx1mdby jHKw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c17si4695594pgu.341.2018.02.11.20.06.24; Sun, 11 Feb 2018 20:07:14 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932619AbeBLCpW (ORCPT + 99 others); Sun, 11 Feb 2018 21:45:22 -0500 Received: from [198.137.202.136] ([198.137.202.136]:49903 "EHLO terminus.zytor.com" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S932373AbeBLCpV (ORCPT ); Sun, 11 Feb 2018 21:45:21 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTP id w1BCALnI031801; Sun, 11 Feb 2018 04:10:21 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w1BCALLN031798; Sun, 11 Feb 2018 04:10:21 -0800 Date: Sun, 11 Feb 2018 04:10:21 -0800 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for KarimAllah Ahmed Message-ID: Cc: linux-kernel@vger.kernel.org, karahmed@amazon.de, dwmw@amazon.co.uk, dave.hansen@linux.intel.com, torvalds@linux-foundation.org, arjan@linux.intel.com, tglx@linutronix.de, bp@alien8.de, pbonzini@redhat.com, dan.j.williams@intel.com, mingo@kernel.org, hpa@zytor.com, jmattson@google.com, rkrcmar@redhat.com, dwmw2@infradead.org, gregkh@linuxfoundation.org, luto@kernel.org, jpoimboe@redhat.com, peterz@infradead.org Reply-To: peterz@infradead.org, luto@kernel.org, jpoimboe@redhat.com, gregkh@linuxfoundation.org, rkrcmar@redhat.com, jmattson@google.com, dwmw2@infradead.org, mingo@kernel.org, hpa@zytor.com, pbonzini@redhat.com, dan.j.williams@intel.com, bp@alien8.de, torvalds@linux-foundation.org, arjan@linux.intel.com, tglx@linutronix.de, dave.hansen@linux.intel.com, dwmw@amazon.co.uk, karahmed@amazon.de, linux-kernel@vger.kernel.org In-Reply-To: <1518305967-31356-5-git-send-email-dwmw@amazon.co.uk> References: <1518305967-31356-5-git-send-email-dwmw@amazon.co.uk> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/pti] X86/nVMX: Properly set spec_ctrl and pred_cmd before merging MSRs Git-Commit-ID: fb5b90b795c76e9c10c520fcdb7fe0d7b8334833 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: fb5b90b795c76e9c10c520fcdb7fe0d7b8334833 Gitweb: https://git.kernel.org/tip/fb5b90b795c76e9c10c520fcdb7fe0d7b8334833 Author: KarimAllah Ahmed AuthorDate: Sat, 10 Feb 2018 23:39:25 +0000 Committer: Ingo Molnar CommitDate: Sun, 11 Feb 2018 11:24:16 +0100 X86/nVMX: Properly set spec_ctrl and pred_cmd before merging MSRs These two variables should check whether SPEC_CTRL and PRED_CMD are supposed to be passed through to L2 guests or not. While msr_write_intercepted_l01 would return 'true' if it is not passed through. So just invert the result of msr_write_intercepted_l01 to implement the correct semantics. Signed-off-by: KarimAllah Ahmed Signed-off-by: David Woodhouse Reviewed-by: Jim Mattson Cc: Andy Lutomirski Cc: Arjan van de Ven Cc: Borislav Petkov Cc: Dan Williams Cc: Dave Hansen Cc: David Woodhouse Cc: Greg Kroah-Hartman Cc: Josh Poimboeuf Cc: Linus Torvalds Cc: Paolo Bonzini Cc: Peter Zijlstra Cc: Radim Krčmář Cc: Thomas Gleixner Cc: arjan.van.de.ven@intel.com Cc: dave.hansen@intel.com Cc: kvm@vger.kernel.org Cc: sironi@amazon.de Fixes: 086e7d4118cc ("KVM: VMX: Allow direct access to MSR_IA32_SPEC_CTRL") Link: http://lkml.kernel.org/r/1518305967-31356-5-git-send-email-dwmw@amazon.co.uk Signed-off-by: Ingo Molnar --- arch/x86/kvm/vmx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index bee4c49..599179b 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -10219,8 +10219,8 @@ static inline bool nested_vmx_merge_msr_bitmap(struct kvm_vcpu *vcpu, * updated to reflect this when L1 (or its L2s) actually write to * the MSR. */ - bool pred_cmd = msr_write_intercepted_l01(vcpu, MSR_IA32_PRED_CMD); - bool spec_ctrl = msr_write_intercepted_l01(vcpu, MSR_IA32_SPEC_CTRL); + bool pred_cmd = !msr_write_intercepted_l01(vcpu, MSR_IA32_PRED_CMD); + bool spec_ctrl = !msr_write_intercepted_l01(vcpu, MSR_IA32_SPEC_CTRL); if (!nested_cpu_has_virt_x2apic_mode(vmcs12) && !pred_cmd && !spec_ctrl)