Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1853689ybg; Thu, 4 Jun 2020 22:30:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4TrrUL9sFlOeUDVTP8uWW8fBeMigxjWeBdY5NCQ5Sz6VZcP0CT99XUG74AZCDkRQa7trJ X-Received: by 2002:a50:8d18:: with SMTP id s24mr5949582eds.303.1591335049274; Thu, 04 Jun 2020 22:30:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591335049; cv=none; d=google.com; s=arc-20160816; b=YhgSN67JkHWO/lPJFEInzPr5TybWiPOBEWG1NJJsRBC447aX+/1qnNmlwLioqmpEN+ hGsppJ6A+ObkmtNC1ams1sZAcg7s3CA46sIIRU90ghfMr4SHpmFWEO8TLHRr0wbWT3Q/ kd0ytpJgz7r/S7UeoFA3Amgw8xtoYT9JXXL+cIlElF7Hi47c5F5uk8WbZuvAb/wy6f6O jfyFu5Sam67Hv0RTKezwi6k2Tq1UaYpq4WRw/+V9bnM2r5UzQPSM74KZlmcVcjnrlXK7 8S26+NYMVacQ3s374F9hRQeb3bT+GgkfNQjgozduXs1t4KacfCJdo9vVR7GeUVGIGYjo U7Xg== 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:organization:from:references:cc:to:subject:ironport-sdr :ironport-sdr; bh=5TmTw0DJrxbJHxhjXgaHnRP0CGp0S5rLhQ3onZyCeu0=; b=TZGwu10Wr3sDP918v050ufboEcoe+xB4F+x+IHVfSS2++qQmgaw5LRGBxXHYeZv1K8 oaPfW8JMe3VZ1oijqhTasIrbaJzDC2bdxSZQapmUIwuuZjy7EuTxILBKhf5LXUGDbT2W fuDa0iASkX4sWyFGxo+7nbhEvXUd2rLTnxSWapb0fOka0T9VZ6/2tKbSbqr2Pi9VwzPd L6TTFo8mq802VFs843itmAPiiK4BB8DPwiPbqbUCapT/qGdmhG1SUSlb36gNx9rf8TiS uDl1okYCCJ0jOnUMYuj3WwPWHDUKFQv+1FxphcurnP1w+0B3ZFpsdfgXyKePAeC/eRpV d7kw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id l6si3052630ejk.579.2020.06.04.22.30.26; Thu, 04 Jun 2020 22:30:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726068AbgFEF2h (ORCPT + 99 others); Fri, 5 Jun 2020 01:28:37 -0400 Received: from mga01.intel.com ([192.55.52.88]:53954 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725280AbgFEF2h (ORCPT ); Fri, 5 Jun 2020 01:28:37 -0400 IronPort-SDR: 86Rdj9+9oNVf+GJ+pFlp4JwpuZw0icTrPgomEO4PKbvjb75aBKFGnc7tgqvg4Aqn2aVlguDVuT 0L3O9dOeQidg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2020 22:28:36 -0700 IronPort-SDR: pN9jXbrqreLPPzqVaq6579ivo3BNGw+0474VgHEZeNIqsBeMX6KQ+f/uT0VaZ1ySzQTmnWiJEz 5viEeRJqKQ7A== X-IronPort-AV: E=Sophos;i="5.73,475,1583222400"; d="scan'208";a="417160467" Received: from likexu-mobl1.ccr.corp.intel.com (HELO [10.238.4.141]) ([10.238.4.141]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2020 22:28:32 -0700 Subject: =?UTF-8?B?UmU6IOetlOWkjTogW1BBVENIXVt2Nl0gS1ZNOiBYODY6IHN1cHBvcnQg?= =?UTF-8?Q?APERF/MPERF_registers?= To: "Li,Rongqing" , "like.xu@intel.com" Cc: "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" , "x86@kernel.org" , "hpa@zytor.com" , "bp@alien8.de" , "mingo@redhat.com" , "tglx@linutronix.de" , "jmattson@google.com" , "wanpengli@tencent.com" , "vkuznets@redhat.com" , "sean.j.christopherson@intel.com" , "pbonzini@redhat.com" , "xiaoyao.li@intel.com" , "wei.huang2@amd.com" References: <1591321466-2046-1-git-send-email-lirongqing@baidu.com> From: Like Xu Organization: Intel OTC Message-ID: <3a88bd63-ff51-ad70-d92e-893660c63bca@linux.intel.com> Date: Fri, 5 Jun 2020 13:28:30 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1 MIME-Version: 1.0 In-Reply-To: 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 2020/6/5 12:23, Li,Rongqing wrote: > > >> -----邮件原件----- >> 发件人: Xu, Like [mailto:like.xu@intel.com] >> 发送时间: 2020年6月5日 10:32 >> 收件人: Li,Rongqing >> 抄送: linux-kernel@vger.kernel.org; kvm@vger.kernel.org; x86@kernel.org; >> hpa@zytor.com; bp@alien8.de; mingo@redhat.com; tglx@linutronix.de; >> jmattson@google.com; wanpengli@tencent.com; vkuznets@redhat.com; >> sean.j.christopherson@intel.com; pbonzini@redhat.com; xiaoyao.li@intel.com; >> wei.huang2@amd.com >> 主题: Re: [PATCH][v6] KVM: X86: support APERF/MPERF registers >> >> Hi RongQing, >> >> On 2020/6/5 9:44, Li RongQing wrote: >>> Guest kernel reports a fixed cpu frequency in /proc/cpuinfo, this is >>> confused to user when turbo is enable, and aperf/mperf can be used to >>> show current cpu frequency after 7d5905dc14a >>> "(x86 / CPU: Always show current CPU frequency in /proc/cpuinfo)" >>> so guest should support aperf/mperf capability >>> >>> This patch implements aperf/mperf by three mode: none, software >>> emulation, and pass-through >>> >>> None: default mode, guest does not support aperf/mperf >> s/None/Note >>> >>> Software emulation: the period of aperf/mperf in guest mode are >>> accumulated as emulated value >>> >>> Pass-though: it is only suitable for KVM_HINTS_REALTIME, Because that >>> hint guarantees we have a 1:1 vCPU:CPU binding and guaranteed no >>> over-commit. >> The flag "KVM_HINTS_REALTIME 0" (in the Documentation/virt/kvm/cpuid.rst) >> is claimed as "guest checks this feature bit to determine that vCPUs are never >> preempted for an unlimited time allowing optimizations". >> >> I couldn't see its relationship with "1:1 vCPU: pCPU binding". >> The patch doesn't check this flag as well for your pass-through purpose. >> >> Thanks, >> Like Xu > > > I think this is user space jobs to bind HINT_REALTIME and mperf passthrough, KVM just do what userspace wants. > That's fine for user space to bind HINT_REALTIME and mperf passthrough, But I was asking why HINT_REALTIME means "1:1 vCPU: pCPU binding". As you said, "Pass-though: it is only suitable for KVM_HINTS_REALTIME", which means, KVM needs to make sure the kvm->arch.aperfmperf_mode value could "only" be set to KVM_APERFMPERF_PT when the check kvm_para_has_hint(KVM_HINTS_REALTIME) is passed. Specifically, the KVM_HINTS_REALTIME is a per-kvm capability while the kvm_aperfmperf_mode is a per-vm capability. It's unresolved. KVM doesn't always do what userspace wants especially you're trying to expose some features about power and thermal management in the virtualization context. > and this gives user space a possibility, guest has passthrough mperfaperf without HINT_REALTIME, guest can get coarse cpu frequency without performance effect if guest can endure error frequency occasionally > > > -Li >