Received: by 10.223.185.116 with SMTP id b49csp63271wrg; Thu, 8 Mar 2018 12:57:16 -0800 (PST) X-Google-Smtp-Source: AG47ELtTxydokmKC6KuWBy5NpEBK7EPEl1wXD8FpfYwZh0zPx1JCI3w4s9Q9TUQBynfj2b6Qh1w6 X-Received: by 2002:a17:902:ab88:: with SMTP id f8-v6mr25548445plr.325.1520542636321; Thu, 08 Mar 2018 12:57:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520542636; cv=none; d=google.com; s=arc-20160816; b=EFuJn0RJ0YN2u88s1ywOi0DsBBIQAP3zjjLS9HBB7PDF9kwjaN3gLnFCRdcxCxsW9y AIcBkAV2l7oxgEkJbUI0ZmcDguPQfDRIb1HNoOFQgoZFxTY23Nx0nhMMFVFQmih6CWue otSYh8WF8ZgFLWMpS/BB+IartZRYDqIL91Mi8Vrm7dOg69+umRC70bdU82RIXOsPSLS2 TKIt4z2k7qzycqOirlqZy2FdzzVmM4B6lKlxAlbxxiqRokcZp5O5EkPB5MCkQPtv5gjC Uq9+zdVL+Ij2dCwsUWgUaDqV5igicdoo38sJPEMobcEU1xhUU0WCvRXN8vr8QO3vVxHP xszQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=Qir3H9Sr9SObY/Vj4RyJ0IUoVwujl9CqM8qb8ZgZz7w=; b=Lnmzuwvl4kUq6VoBBH6rtF8JfvbwQs5XyWTCf2vWdiHsxJUDJ1ncfF4Ld3loEx9ApS TPWETcIwm8UYq9AUDqayCDB/cZgKKzm8R9/MWAQQOLIfq1ReZjlA6iajlZGDBKYDkAHi u1i2tvVV+T4979xF2nlYJguZuNs3jCj6R5mjWt8WOAdcmbqztt1/j9sD5TBnSABzDDNH BoJ7LCht21o53g7gJIcusazE4nZfiQiulz8G44ITRimkxnr87bDARGBLhr2JCAl3NW19 U29PMsm3CjLcEobJ9hroqUQMb6WWzWJ9gwrd92UzIf+jlH3rVzV6535r1j1b0LPjC5IE QohQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v189si13470794pgb.706.2018.03.08.12.57.01; Thu, 08 Mar 2018 12:57:16 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751257AbeCHU4B (ORCPT + 99 others); Thu, 8 Mar 2018 15:56:01 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:38782 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750896AbeCHU4A (ORCPT ); Thu, 8 Mar 2018 15:56:00 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3096F76FBA; Thu, 8 Mar 2018 20:56:00 +0000 (UTC) Received: from flask (unknown [10.43.2.80]) by smtp.corp.redhat.com (Postfix) with SMTP id 708C4215CDA7; Thu, 8 Mar 2018 20:55:58 +0000 (UTC) Received: by flask (sSMTP sendmail emulation); Thu, 08 Mar 2018 21:55:19 +0100 Date: Thu, 8 Mar 2018 21:55:19 +0100 From: Radim =?utf-8?B?S3LEjW3DocWZ?= To: Wanpeng Li Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Paolo Bonzini Subject: Re: [PATCH 1/3] KVM: X86: Provides userspace with a capability to not intercept MWAIT Message-ID: <20180308205519.GM12290@flask> References: <1519897782-8124-1-git-send-email-wanpengli@tencent.com> <20180308203132.GJ12290@flask> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180308203132.GJ12290@flask> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Thu, 08 Mar 2018 20:56:00 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Thu, 08 Mar 2018 20:56:00 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'rkrcmar@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2018-03-08 21:31+0100, Radim Krčmář: > 2018-03-01 17:49+0800, Wanpeng Li: > > @@ -264,10 +262,12 @@ static inline u64 nsec_to_cycles(struct kvm_vcpu *vcpu, u64 nsec) > > __rem; \ > > }) > > > > -static inline bool kvm_mwait_in_guest(void) > > +#define KVM_X86_DISABLE_EXITS_MWAIT (1 << 0) > > +#define KVM_X86_DISABLE_VALID_EXITS (KVM_X86_DISABLE_EXITS_MWAIT) > > + > > +static inline bool kvm_mwait_in_guest(struct kvm *kvm) > > { > > - return boot_cpu_has(X86_FEATURE_MWAIT) && > > - !boot_cpu_has_bug(X86_BUG_MONITOR); > > + return kvm->arch.mwait_in_guest; > > With this nice variable, the wrapper actually makes the code harder to > read. Please use kvm->arch.mwait_in_guest directly (and the same for > the other two future exits), I take that back. kvm->arch.mwait_in_guest looks ok, but it would be vmx->vcpu.kvm->arch.mwait_in_guest elsewhere and that is just too bad.