Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5742443ybi; Tue, 28 May 2019 19:09:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqwzd3bEKziDJfJ7KUvqbCle1eof6o3M2KPr/bKCOKlswLNhLXkOOTPmG0Ccq3g9BDTdms6c X-Received: by 2002:a63:5b5d:: with SMTP id l29mr6808363pgm.444.1559095744475; Tue, 28 May 2019 19:09:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559095744; cv=none; d=google.com; s=arc-20160816; b=Tsi8tnZk565Ypf6Qwh6ISsFyHXcs2YnQkOr3GFCt0ljHNTJhNsouFTtyVHioOzEi1e w18XIAkHwzDtAhEHyVCLs/lmQWsMvnXAG2EeC/nxsx1mD30Z7fc0PuCyhUoS/opHFtLn OpwbkC7S1OsAull6GMIKpkpnpD5IA0T4myB94yK3sx7zcIyXgGZWCl6wI0zw/+KgYoJh JYLQvrm1AlrtRnicYuM70sZTQtOdvcidrLIQ/v/2Kr2SnhUPfTTK0HMZG1YZmAYbWZKu tmpQlGwecb3xSu09o1mD7g16c1OrIbX4/IOzBrHnNkBUgnlSMi2bJr3nby0raQYcoyDw qWsQ== 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=j/P674/GO1QXGWxGyJ6VPc2sOwkGhnR9zKHoKd7R5g8=; b=SQ+loahVlYdzxXQBQ0eAe61MMKdMCb9xF7JfHD1XmHgylzr1YBGpp6wTDmTwOvcOit L9OTInTfJh1qomSOyjf2IwYn6m8DvP5lvg9fqidftnXwn4SNZgFOYsLPQUMUaWmN+Yyc r2I4f81+qmoiIDI6cYO/vmpU2E6y83YRxQbQprZ9o85ZwE/WjfSQ/6KTHzfAwpb0K/QR xTbapDVjtOi6DtGPQXD53zhwLWj7PpLVq9CtgdIjtIbyCh/rauFbBp9O5AyPFNh1/GG3 jsUWJeQhvEs46XWiMEf4LtyQybDVmSPlETQ0EbhxgoNGoL+QR36CqoPAqFBxPy5S8P0O qGyQ== 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 j4si2535324pgl.472.2019.05.28.19.08.48; Tue, 28 May 2019 19:09:04 -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 S1726362AbfE2CHl (ORCPT + 99 others); Tue, 28 May 2019 22:07:41 -0400 Received: from mga07.intel.com ([134.134.136.100]:46297 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725816AbfE2CHl (ORCPT ); Tue, 28 May 2019 22:07:41 -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; 28 May 2019 19:07:40 -0700 X-ExtLoop1: 1 Received: from shzintpr04.sh.intel.com (HELO [0.0.0.0]) ([10.239.4.101]) by orsmga001.jf.intel.com with ESMTP; 28 May 2019 19:07:37 -0700 Subject: Re: [PATCH v2 1/3] KVM: x86: add support for user wait instructions To: Paolo Bonzini Cc: 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> <419f62f3-69a8-7ec0-5eeb-20bed69925f2@redhat.com> From: Tao Xu Message-ID: Date: Wed, 29 May 2019 10:05:19 +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: <419f62f3-69a8-7ec0-5eeb-20bed69925f2@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29/05/2019 09:24, Paolo Bonzini wrote: > On 24/05/19 09:56, Tao Xu wrote: >> +7.19 KVM_CAP_ENABLE_USR_WAIT_PAUSE >> + >> +Architectures: x86 >> +Parameters: args[0] whether feature should be enabled or not >> + >> +With this capability enabled, a VM can use UMONITOR, UMWAIT and TPAUSE >> +instructions. If the instruction causes a delay, the amount of >> +time delayed is called here the physical delay. The physical delay is >> +first computed by determining the virtual delay (the time to delay >> +relative to the VM’s timestamp counter). Otherwise, UMONITOR, UMWAIT >> +and TPAUSE cause an invalid-opcode exception(#UD). >> + > > There is no need to make it a capability. You can just check the guest > CPUID and see if it includes X86_FEATURE_WAITPKG. > > Paolo > Thank you Paolo, but I have another question. I was wondering if it is appropriate to enable X86_FEATURE_WAITPKG when QEMU uses "-overcommit cpu-pm=on"? Or just enable X86_FEATURE_WAITPKG when QEMU add the feature "-cpu host,+waitpkg"? User wait instructions is the wait or pause instructions may be executed at any privilege level, but can use IA32_UMWAIT_CONTROL to set the maximum time.