Received: by 10.192.165.156 with SMTP id m28csp776599imm; Wed, 11 Apr 2018 07:07:35 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+B4Z4EypIRP4XBNPo1qLsAWkB+LSrCANRm3CM9S34wC+l3cAsvYz41Dn4mfhczgLb/ClRq X-Received: by 10.98.15.92 with SMTP id x89mr4211108pfi.7.1523455655848; Wed, 11 Apr 2018 07:07:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523455655; cv=none; d=google.com; s=arc-20160816; b=ZSmQlIFsIfD1fuBluyEae6TveNkuwaG+uyNPo2RYTqPpPU5XuGOltji2xo1Wv5ok8C huAuFrtdsGekyu2yPjhePRw14MZqdJA/oH9q4Inn9l0yTE1YRVZVeOwOvMENlLvWkEzs XvifAYQtTDdBO0yRdOd6gk57NbrLObCBdbz3rVjrsem40Cx5MF1Ur1jATCA03VNnsx7Q aSgKJXnlOe+Qzdpf7FVs9q8kGAeHTf9phqoKb4Rx3RNYE3BZjKqjj5ifqpfwZw3q2iyx Z2crzakq6hFiXAFtKI9ZnN3QqreJOhzlShA2dFOLd7JDMFdrGnTFGlB9dfPb08bDsGZG UGxg== 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:date:cc:to:from:subject:message-id :arc-authentication-results; bh=W4E2Ve1ZK8w+gPhr93hkxEzjWLtG7IopwesrdYIXsqM=; b=bFS7bADsU/SRb+t0EwlqV7rGrBIS+7vRQhbmeSMqdgCGHCKz3siQEwnC/3Eq4Kvo3m x7YHR3XF8BudhwK7hoHrR9SYncpfFKMVmixJqqSF5IRcJLVnLC5iU15U3irpeRzuV+Hc +ySV95zds3sTPTCuitlTo4N2FxWbxLMuh3l/JICEv0k1aRBn2GKvGXGsNSzIZ8RsSjNB WkX6pTC7n9C8uk5YCfFEUlPCRh2Hjx9f3DgC/TXGG6oDGgym/ZBnKfTUMMQaWjlEybKb yjGefDSPjQ3SjtQBzq4I9vnP1UU7raPZ7ZReBGss9rsldPeHqFzUZFQw3kQfZhfXAJxA BIPg== 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 a63-v6si1203561pla.718.2018.04.11.07.06.58; Wed, 11 Apr 2018 07:07:35 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753323AbeDKOCw (ORCPT + 99 others); Wed, 11 Apr 2018 10:02:52 -0400 Received: from mga12.intel.com ([192.55.52.136]:16071 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753258AbeDKOCu (ORCPT ); Wed, 11 Apr 2018 10:02:50 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Apr 2018 07:02:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,436,1517904000"; d="scan'208";a="215793631" Received: from sjchrist-coffee.jf.intel.com ([10.54.74.15]) by orsmga005.jf.intel.com with ESMTP; 11 Apr 2018 07:02:49 -0700 Message-ID: <1523455369.20087.16.camel@intel.com> Subject: Re: [PATCH] X86/KVM: Do not allow DISABLE_EXITS_MWAIT when LAPIC ARAT is not available From: Sean Christopherson To: KarimAllah Ahmed , linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Paolo Bonzini , Radim =?UTF-8?Q?Kr=C4=8Dm=C3=A1=C5=99?= , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , x86@kernel.org Date: Wed, 11 Apr 2018 07:02:49 -0700 In-Reply-To: <1523438163-768-1-git-send-email-karahmed@amazon.de> References: <1523438163-768-1-git-send-email-karahmed@amazon.de> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.18.5.2-0ubuntu3.2 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 On Wed, 2018-04-11 at 11:16 +0200, KarimAllah Ahmed wrote: > If the processor does not have an "Always Running APIC Timer" (aka ARAT), > we should not give guests direct access to MWAIT. The LAPIC timer would > stop ticking in deep C-states, so any host deadlines would not wakeup the > host kernel. > > The host kernel intel_idle driver handles this by switching to broadcast > mode when ARAT is not available and MWAIT is issued with a deep C-state > that would stop the LAPIC timer. When MWAIT is passed through, we can not > tell when MWAIT is issued. > > So just disable this capability when LAPIC ARAT is not available. I am not > even sure if there are any CPUs with VMX support but no LAPIC ARAT or not. ARAT was added on WSM, so NHM, the Core 2 family and a few PSC SKUs support VMX+MWAIT but not ARAT.   > Cc: Paolo Bonzini > Cc: Radim Krčmář > Cc: Thomas Gleixner > Cc: Ingo Molnar > Cc: H. Peter Anvin > Cc: x86@kernel.org > Cc: kvm@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > Reported-by: Wanpeng Li > Signed-off-by: KarimAllah Ahmed > --- >  arch/x86/kvm/x86.c | 3 ++- >  1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index b2ff74b..0334b25 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -2819,7 +2819,8 @@ static int msr_io(struct kvm_vcpu *vcpu, struct kvm_msrs __user *user_msrs, >  static inline bool kvm_can_mwait_in_guest(void) >  { >   return boot_cpu_has(X86_FEATURE_MWAIT) && > - !boot_cpu_has_bug(X86_BUG_MONITOR); > + !boot_cpu_has_bug(X86_BUG_MONITOR) && > + boot_cpu_has(X86_FEATURE_ARAT); >  } >   >  int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)