Received: by 10.223.185.116 with SMTP id b49csp3807000wrg; Tue, 13 Feb 2018 08:03:52 -0800 (PST) X-Google-Smtp-Source: AH8x2265Nzb89y1hGv8FRknfr9obNBVQ9WGQ13WzKRtIusLTA96ahCk+9E1WtHW3/NL7qXGZYm/C X-Received: by 10.98.86.27 with SMTP id k27mr1722908pfb.174.1518537832633; Tue, 13 Feb 2018 08:03:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518537832; cv=none; d=google.com; s=arc-20160816; b=UKRJpvXEYlYnQ4h2QBTjNGqEU64wxGaOPXrRr9NGxUPP5JjsydHgg69Vou8fY/hej7 S5X+V1QC0pfCwSteqHD9Pv5w22raCIuIrCwoAzck2Fmbp8ie3nLk/XT1TrLZpe08rKTL cw8bHmV6ms0OJDUrkCmOduSO77UbgYvhPtZmO5dxWz/h21jHBJmlBgWvcCDOz7nJPIOC MgS4MWHnADoDvzoorcSEnYYCfwTf/y6tfFoLHv4/YagJ9PSuo1J/v92mpVMXfbWgDhfe Tc6S8uU2eRmlfXKHVIi6Uw3jxuS36yKTHMtMfr6HpZ0HqR905VUkgXCdfPufy7NZTV00 V0ig== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=JjTfWGwMHlQ2CGLe0GsK3WPNbn7lBLEdt3fm5BxQhe4=; b=Alynrkk3F2WWo8Doh73Sl5j8ypikAE0C9PM/iGHgbJ3THIve/OCPTMAT7LFmE9nbo5 3Kq83VecOdRCCpSdvN30rdhsKB7lM9VJur5nwtvmu+X186uChVv+ouqiQFlbdWNoyJSp 8wN+nRWk2Z5BgcJ2dkviQGtGgAo1DP/W7hHv9duF24OiuSulHEpWCceIb+VLFHBQpeTX rn9UAof00PoX6NVh1TyjmZpEfIB6bswJe19HKOOnE0SOobhMuEE2jJNkstg5udkpFY0y mtO6HHseWFPfWsHbBAxrBK+84cEq2fr4iFPyJigl917HPRilGw9qwJLsC6tpKaUmsoJy 2Q2A== 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 u85si19691pfi.5.2018.02.13.08.03.37; Tue, 13 Feb 2018 08:03:52 -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 S934507AbeBMQCe (ORCPT + 99 others); Tue, 13 Feb 2018 11:02:34 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:59590 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933698AbeBMQCb (ORCPT ); Tue, 13 Feb 2018 11:02:31 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 11A6C40FB645; Tue, 13 Feb 2018 16:02:31 +0000 (UTC) Received: from [10.36.116.223] (ovpn-116-223.ams2.redhat.com [10.36.116.223]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4168D1008574; Tue, 13 Feb 2018 16:02:30 +0000 (UTC) Subject: Re: [PATCH v2 1/2] KVM: X86: Add per-VM no-HLT-exiting capability To: Wanpeng Li , linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= References: <1517813878-22248-1-git-send-email-wanpengli@tencent.com> From: Paolo Bonzini Message-ID: <324a8c3a-35f1-ad4b-1ff5-9ba742778470@redhat.com> Date: Tue, 13 Feb 2018 17:02:27 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <1517813878-22248-1-git-send-email-wanpengli@tencent.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 13 Feb 2018 16:02:31 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 13 Feb 2018 16:02:31 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'pbonzini@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/02/2018 07:57, Wanpeng Li wrote: > From: Wanpeng Li > > If host CPUs are dedicated to a VM, we can avoid VM exits on HLT. > This patch adds the per-VM non-HLT-exiting capability. > > Cc: Paolo Bonzini > Cc: Radim Krčmář > Signed-off-by: Wanpeng Li > --- > v1 -> v2: > * vmx_clear_hlt() around INIT handling > * vmx_clear_hlt() upon SMI and implement auto halt restart Hi Wanpeng, sorry I could not answer before. We do not need to implement AutoHalt. It's a messy functionality and the way it works is much simpler: on RSM the microcode reads AutoHALT's bit 0 and... decrements RIP if it is 1. All you need to do however is clear the activity state. Guests should expect anyway that "CLI;HLT" can be interrupted by an NMI and follow it with a JMP. Second, I would prefer to implement at the same time MWAIT and PAUSE passthrough, as in https://www.spinics.net/lists/kvm/msg159517.html: > The three capabilities are more or less all doing the same thing. > Perhaps it would make some sense to only leave PAUSE spin loops in > guest, but not HLT/MWAIT; but apart from that I think users would > probably enable all of them. So I think we should put in the > documentation that blindly passing the KVM_CHECK_EXTENSION result to > KVM_ENABLE_CAP is a valid thing to do when vCPUs are associated to > dedicated physical CPUs. > > Let's get rid of KVM_CAP_X86_GUEST_MWAIT altogether and > add a new capability. But let's use just one. Thanks again for your work, and sorry for slightly contradicting Radim's review. I've rebased and applied patch 2. Paolo