Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4680353ybi; Tue, 28 May 2019 00:23:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqxBuGX9bBIWM5YVjWWM/Gwr//MrjaWKTHDwrn/XOFr3QR0aWc5Lr6niHMuE1KJC2VKbpEeE X-Received: by 2002:a17:902:2beb:: with SMTP id l98mr130214962plb.290.1559028192128; Tue, 28 May 2019 00:23:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559028192; cv=none; d=google.com; s=arc-20160816; b=OVhe8QfDiWpm3pTisF7sWViDx10e1VYpsr8wJjsSJvmwV8XzOkmIpNlJMCvptGuw9D +jvD+s6PIYcdCarGhKVLPubTBZRTK1yQi/itqkg7POqSbsXScXmlme8X7TH6Mkvb7ZPG H33Dr1Kba9a04pXALMXX45U/LgHKMxQfkKkwXluoVJL1SmaBxEfCwPoIXI/sXl+NeHWy ZnGGWDz3Sj3D7lVd0zAyuWStz+zLJNIHsMm6CujxUQBgJBXQfjhhS0nbY7zQr5kx9p3g KF5chWZMUfPKlcCrigVW/JgDjl4pqfhfIur4+Mkm7WRcG/gd+6JAxhz9Xf9pCipoUQ3e korg== 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=0ARzj6Rtj3o++NyN0OW3NEwZ5xNOzK/gXxcPEEhm47k=; b=czhP5wLeD+E+Ja/BdLcIYvm2F1spSE1iEOz3koX9zxBOO+nmqW/bb8cZ43t4h+sVTX dlokb0Kg21p9a3sQT0rT9ZnoJsHeX/ofj0PqTr/2RAQ3gk/fdlTT9xjLNlEHAlklCPiO 0dGjmTEVQ2Yjjm47l/7is5e4iL0tVvvXr5v8PaDfV6RgSgFzY0bdQxe3IpZ6G939+Ktn xuStUYgozKNkE5uox0U1Mo0dVhXy7reOowwFB+10ZNHdYTL5IXLJ7Bds2WfrJsmg2DsQ 36inZAc5Z9GWRn2QqeQXxkyqmopHHNqP/Fatrlob0qPv5EijeOxWdDs3s40+QTll2B6X mb8Q== 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 g73si13078889pfb.282.2019.05.28.00.22.56; Tue, 28 May 2019 00:23:12 -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 S1727383AbfE1HVw (ORCPT + 99 others); Tue, 28 May 2019 03:21:52 -0400 Received: from mga02.intel.com ([134.134.136.20]:57195 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726879AbfE1HVw (ORCPT ); Tue, 28 May 2019 03:21:52 -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 orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 May 2019 00:21:51 -0700 X-ExtLoop1: 1 Received: from shzintpr03.sh.intel.com (HELO [0.0.0.0]) ([10.239.4.100]) by orsmga001.jf.intel.com with ESMTP; 28 May 2019 00:21:48 -0700 Subject: Re: [PATCH v2 1/3] KVM: x86: add support for user wait instructions To: Wanpeng Li Cc: Peter Zijlstra , Paolo Bonzini , Radim Krcmar , Jonathan Corbet , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Sean Christopherson , the arch/x86 maintainers , kvm , linux-doc@vger.kernel.org, LKML , 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> <43e2a62a-e992-2138-f038-1e4b2fb79ad1@intel.com> From: Tao Xu Message-ID: <072dd34e-0361-5a06-4d0b-d04e8150a3bb@intel.com> Date: Tue, 28 May 2019 15:19:30 +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: 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 28/05/2019 14:11, Wanpeng Li wrote: > On Tue, 28 May 2019 at 13:16, Tao Xu wrote: >> >> >> 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 > > Please refer to a4429e53c9 (KVM: Introduce paravirtualization hints > and KVM_HINTS_DEDICATED) and b2798ba0b87 (KVM: X86: Choose qspinlock > when dedicated physical CPUs are available) Hi Wanpeng, Thank you! This information really helped me. After I read the code in KVM/QEMU, I was wondering that with qemu command-line "-cpu host,+kvm-hint-dedicated", then in KVM, "kvm_hint_has_feature(KVM_HINTS_DEDICATED)" will be true, am I right? Tao