From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6226C433E0 for ; Wed, 27 May 2020 01:21:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CDD772088E for ; Wed, 27 May 2020 01:21:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728353AbgE0BVm (ORCPT ); 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: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@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 >