Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp418525ybm; Tue, 26 May 2020 21:36:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgNIUXToEtPaWrG7juYYyZibkmLnQNIb8jIqVyiCQeW00L7AiBfv/1iER64MWj8nty+K3O X-Received: by 2002:a5d:500d:: with SMTP id e13mr14998973wrt.150.1590554182274; Tue, 26 May 2020 21:36:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590554182; cv=none; d=google.com; s=arc-20160816; b=UPWtcl7H8Ip60DNrEUkzcu3pUlPPU5cHea3LTGMdKhVQrzaotH49wA5W7oD8UTRzBr c47TcFbJsFQIndFu5Y09nMwZ9xmbXpJYbMVPL7JRjCTsuGzeqGvhSwTGAuFbOAHVeHHz c1OpTH0e0+XZEOkw40Ob3B26N6DCTDHJbJr3G1Oonxu14uUXyQRvZ3QAemmBacOYnI7E hYXN7YIwjjaqcmHMEIUH1+LqIBGa6OEcBOapKGCBHefnwT77jN9qdAf6NuX2fJkapap2 2ma5K+Kwb/UNCCpCezhWwOrUfkB97bN1xAIRtY0/8Loh3vE+Bw+hjQcfZdMXMvkgHbh+ qw4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=NqBwiZakng3uWGjdv9VydIiua3W3FBExXRyyyBMOKnc=; b=TJQ3m/OMO/6PKOoFITVZ+4sQZWJc32e8y4yVh5T25T2tiT38SamitOaxT3gSfQj7x3 kxKHWUws6DHCLbn9YsmDWj9X7rxHDYXrLcxgWqXuIS0lVwOGXWFxZeZVOHLys57VagMb pHzAspjuIYfmzDIrSZrp9N4Oz8jaEK4jaBt908W4FOqiHKj1gMHZWEpfKYrWaI4aNK/8 dfdrKaPG6hgCRDgXFe/IWr3AQWDEgHvczKPkRPc2W8tUn58XZLtyc82YFltWU9Aae2qv Tw43aA91MVw/24xHLfRtFFOc6I1ShOUsGlVR3+2ZZ5oHTekyIbjYpdVU40Crk9TVMrZS RtBw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id qt28si1244397ejb.256.2020.05.26.21.36.00; Tue, 26 May 2020 21:36:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1728356AbgE0BVm (ORCPT + 99 others); Tue, 26 May 2020 21:21:42 -0400 Received: from mga01.intel.com ([192.55.52.88]:40356 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726701AbgE0BVl (ORCPT ); Tue, 26 May 2020 21:21:41 -0400 IronPort-SDR: Q1e+s7xmMiFcyU8wWg+OJBvB+v4s1/ksuetGpE+WEi43RAT6Pe6wRBoZOdCpBD8DGJfhVw4qLH Wp0pQ8RZgW5Q== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 May 2020 18:21:41 -0700 IronPort-SDR: y1IVERXaiT9vHZgUR/zwGBYB9pUJ74kVYXAxqyzY9zotxceVuf/FzRUx+kq8C/UrLX5Z+nMZKn BuaP760ox6Vg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,439,1583222400"; d="scan'208";a="468558465" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.152]) by fmsmga006.fm.intel.com with ESMTP; 26 May 2020 18:21:40 -0700 Date: Tue, 26 May 2020 18:21:40 -0700 From: Sean Christopherson To: Maxim Levitsky Cc: kvm@vger.kernel.org, Paolo Bonzini , "H. Peter Anvin" , Tao Xu , Jim Mattson , linux-kernel@vger.kernel.org, Joerg Roedel , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , Wanpeng Li , Ingo Molnar , Thomas Gleixner , Borislav Petkov , Vitaly Kuznetsov , Jingqi Liu Subject: Re: [PATCH 2/2] kvm/x86: don't expose MSR_IA32_UMWAIT_CONTROL unconditionally Message-ID: <20200527012140.GD31696@linux.intel.com> References: <20200523161455.3940-1-mlevitsk@redhat.com> <20200523161455.3940-3-mlevitsk@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200523161455.3940-3-mlevitsk@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 23, 2020 at 07:14:55PM +0300, Maxim Levitsky wrote: > This msr is only available when the host supports WAITPKG feature. > > This breaks a nested guest, if the L1 hypervisor is set to ignore > unknown msrs, because the only other safety check that the > kernel does is that it attempts to read the msr and > rejects it if it gets an exception. > > Fixes: 6e3ba4abce KVM: vmx: Emulate MSR IA32_UMWAIT_CONTROL Same comments on the line wraps and Fixes tag. For the code: Reviewed-by: Sean Christopherson > Signed-off-by: Maxim Levitsky > --- > arch/x86/kvm/x86.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index b226fb8abe41b..4752293312947 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -5316,6 +5316,10 @@ static void kvm_init_msr_list(void) > min(INTEL_PMC_MAX_GENERIC, x86_pmu.num_counters_gp)) > continue; > break; > + case MSR_IA32_UMWAIT_CONTROL: > + if (!kvm_cpu_cap_has(X86_FEATURE_WAITPKG)) > + continue; > + break; > default: > break; > } > -- > 2.26.2 >