Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4586551ybi; Mon, 27 May 2019 22:15:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqxbRvjoVmCV5q5r+dd6+gaNF2wbPmw/TLkl2IocEeNwD1VoBngC7ms3djxpyLOX38p7mwNL X-Received: by 2002:a17:902:9f85:: with SMTP id g5mr128483850plq.29.1559020556054; Mon, 27 May 2019 22:15:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559020556; cv=none; d=google.com; s=arc-20160816; b=XTLRjezYvd0rZdBw67a2jKO/mVEWtoDd8Np/phhHAWkUj5gvWVGgaSf0XYWMWK2Fxo OfHI/r5RlPT78FSlEOOKDiZCC4rz6k+JywW4Av+ECfnveMZ0mNFk8RLZmbV6eJHat19v MzuCgUfd2R3KMgwQBxipNm7pWiu8fCgjas7tiStGK0Kh3I/YhSwMb4Ym45YNAJtdzrwd ILNTFZ4bwMhYj7E0WuL/Lc0D7chYVz+Z9jP9eDGbLZbmiRnZuAkeq/JWZpNv0ODBKoTr Wq3qrIV3JDtntBr4P9Ub0tNGrx9Ne9xCQ7gi/+HinCGSAYZCHzNwsvkb0rVxBKycY4TF akuQ== 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; bh=vGsh/bpZQAavHkYSrZT4Pzl4gWXQBqvoiW4xziKtB/w=; b=DNe64dqx8UMdbeTkbQmR2a+2slohHV6p9FYLzyPorxEtoGV3vjW9/Ujc5MUzyQgoz9 ZhoBzAmUXGnf8iMREEzniFs09FPcAEIXF4LW/u5rebhaQp1qxxyd0IZmFn4hXA8UZEj5 Rq3KXz7BTi3K0+eHVKuAkBg/g3eetbgPvS12uYArY+IvRJ99K8Gp9XkcVkvHvlP25Yqc YdkbXPmF+496MWNxCeDHDHD6Oa7j/qcai9y8bXqHUnZHeCEUpUhSr++EqTnvQL9bmFFL oyHP30nfyrGd1WoFPoPc3y6Yh7zhJo9egwelBO1nKfss9fnrTSNdWRqpQVud2sCTnXJ9 w1qA== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h34si22039861pld.42.2019.05.27.22.15.40; Mon, 27 May 2019 22:15:56 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727193AbfE1FOO (ORCPT + 99 others); Tue, 28 May 2019 01:14:14 -0400 Received: from mga07.intel.com ([134.134.136.100]:35832 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726269AbfE1FON (ORCPT ); Tue, 28 May 2019 01:14:13 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 May 2019 22:14:13 -0700 X-ExtLoop1: 1 Received: from shzintpr02.sh.intel.com (HELO [0.0.0.0]) ([10.239.4.160]) by orsmga001.jf.intel.com with ESMTP; 27 May 2019 22:14:07 -0700 Subject: Re: [PATCH v2 1/3] KVM: x86: add support for user wait instructions To: Peter Zijlstra Cc: pbonzini@redhat.com, rkrcmar@redhat.com, corbet@lwn.net, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, sean.j.christopherson@intel.com, x86@kernel.org, kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, jingqi.liu@intel.com References: <20190524075637.29496-1-tao3.xu@intel.com> <20190524075637.29496-2-tao3.xu@intel.com> <20190527103003.GX2623@hirez.programming.kicks-ass.net> From: Tao Xu Message-ID: <43e2a62a-e992-2138-f038-1e4b2fb79ad1@intel.com> Date: Tue, 28 May 2019 13:11:49 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190527103003.GX2623@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27/05/2019 18:30, Peter Zijlstra wrote: > On Fri, May 24, 2019 at 03:56:35PM +0800, Tao Xu wrote: >> This patch adds support for UMONITOR, UMWAIT and TPAUSE instructions >> in kvm, and by default dont't expose it to kvm and provide a capability >> to enable it. > > I'm thinking this should be conditional on the guest being a 1:1 guest, > and I also seem to remember we have bits for that already -- they were > used to disable paravirt spinlocks for example. > Hi Peter, I am wondering if "1:1 guest" means different guests in the same host should have different settings on user wait instructions? User wait instructions(UMONITOR, UMWAIT and TPAUSE) can use in guest only when the VMCS Secondary Processor-Based VM-Execution Control bit 26 is 1, otherwise any execution of TPAUSE, UMONITOR, or UMWAIT causes a #UD. So with a capability to enable it, we use qemu kvm_vm_ioctl_enable_cap() to enable it. The qemu link is blew: https://lists.gnu.org/archive/html/qemu-devel/2019-05/msg05810.html By using different QEMU parameters, different guests in the same host would have different features with or without user wait instructions. About "disable paravirt spinlocks" case, I am wondering if it uses kernel parameters? If it uses kernel parameters, different guests in the same host may have same settings on user wait instructions. Or when we uses kernel parameters to disable user wait instructions, for a host chooses to enable user wait instructions, we should do some work on QEMU to choose disable or enable user wait instructions? Thanks Tao