LKML Archive on lore.kernel.org
 help / color / Atom feed
From: Dirk Brandewie <dirk.brandewie@gmail.com>
To: Gleb Natapov <gleb@kernel.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Kashyap Chamarthy <kchamart@redhat.com>,
	Josh Boyer <jwboyer@fedoraproject.org>,
	One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	"cpufreq@vger.kernel.org" <cpufreq@vger.kernel.org>,
	Linux PM list <linux-pm@vger.kernel.org>,
	"Linux-Kernel@Vger. Kernel. Org" <linux-kernel@vger.kernel.org>,
	"Richard W.M. Jones" <rjones@redhat.com>
Subject: Re: intel_pstate divide error with v3.13-rc4-256-gb7000ad
Date: Fri, 03 Jan 2014 12:00:01 -0800
Message-ID: <52C716C1.6070704@gmail.com> (raw)
In-Reply-To: <20140103180435.GK10961@minantech.com>

On 01/03/2014 10:04 AM, Gleb Natapov wrote:
> On Fri, Jan 03, 2014 at 09:30:28AM -0800, Dirk Brandewie wrote:
>> Hi All,
>>
>> Sorry for being late to the party but I just got back from vacation.
>>
>> There is something deeply wrong here.  We should have never gotten to
>> intel_pstate_init_cpu().  The VM had to have returned value from the read
>> of the max pstate at driver init time and 0 when the CPU was being brought up.
>>
>> intel_pstate_msrs_not_valid() was added to solve this issue early on
>> if I remember correctly it was Josh that reported it then.  Is there
>> a definative way to detect whether we are running in a VM?
>>
> Checking for VM is a wrong thing to do here. KVM should behave like it
> does not support p-state.
>
>> Can some one tell me how the nested environment differs in regards to
>> reading MSRs?
>>
> It shouldn't differ, but there may be bug somewhere in nested emulation.
> We shouldn't try and hind the bug by doing more checks in Linux but
> rather fixing KVM bug that causes Linux to behave incorrectly.

Based on the unhandled MSR messages in the host dmesg the following patch
should make sure the correct values are returned for PLAT_FORM_INFO, APERF
and MPERF.  intel_pstate and turbostat are the only users of these registers.

Could you try the folloinw patch minus Rafael's patch please.
Compile tested only.

TIA
--Dirk

commit 5594b89bee7f83200c1a70bf95d50ac35e4fe3f8
Author: Dirk Brandewie <dirk.j.brandewie@intel.com>
Date:   Fri Jan 3 11:44:15 2014 -0800

     x86/kvm: Handle MSR_PLATFORM_INFO, MSR_IA32_MPERF and MSR_IA32_APERF MSRs

     Handle MSRs correctly when read from a nested KVM

     Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
---
  arch/x86/kvm/x86.c | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 5d004da..390ef27 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2336,6 +2336,9 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 
*pdata)

  	switch (msr) {
  	case MSR_IA32_PLATFORM_ID:
+	case MSR_IA32_MPERF:
+	case MSR_IA32_APERF:
+	case MSR_PLATFORM_INFO:
  	case MSR_IA32_EBL_CR_POWERON:
  	case MSR_IA32_DEBUGCTLMSR:
  	case MSR_IA32_LASTBRANCHFROMIP:


  reply index

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-24 14:36 Josh Boyer
2013-12-24 16:06 ` Viresh Kumar
2013-12-27 12:24   ` One Thousand Gnomes
2013-12-27 12:47     ` Gleb Natapov
2013-12-27 13:46       ` Josh Boyer
2013-12-27 14:15         ` Kashyap Chamarthy
2013-12-27 14:34           ` Richard W.M. Jones
2013-12-27 16:52           ` Gleb Natapov
2013-12-27 17:01             ` Gleb Natapov
2013-12-27 17:17               ` Richard W.M. Jones
2013-12-27 17:17               ` Kashyap Chamarthy
2013-12-27 21:51                 ` Rafael J. Wysocki
2013-12-29 12:12                   ` Kashyap Chamarthy
2013-12-29 15:04                     ` Rafael J. Wysocki
2013-12-30 14:58                       ` Kashyap Chamarthy
2013-12-31  2:07                         ` Rafael J. Wysocki
2014-01-03 17:30                           ` Dirk Brandewie
2014-01-03 18:04                             ` Gleb Natapov
2014-01-03 20:00                               ` Dirk Brandewie [this message]
2014-01-03 22:06                                 ` Paolo Bonzini
2014-01-06 17:18                                   ` Dirk Brandewie
2014-01-07 16:11                                     ` Gleb Natapov
2014-01-03 22:46                               ` Rafael J. Wysocki
2014-01-04  8:35                                 ` Paolo Bonzini
2014-01-04 14:38                                   ` Rafael J. Wysocki
2014-01-04 17:38                                     ` Paolo Bonzini
2014-01-04 17:48                                       ` Gleb Natapov
2014-01-04 21:38                                         ` Rafael J. Wysocki
2014-01-06 11:20                                           ` Paolo Bonzini
2014-01-06 11:37                                             ` Rafael J. Wysocki
2014-01-06 18:40                                               ` Dirk Brandewie
2013-12-27 14:35   ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52C716C1.6070704@gmail.com \
    --to=dirk.brandewie@gmail.com \
    --cc=cpufreq@vger.kernel.org \
    --cc=gleb@kernel.org \
    --cc=gnomes@lxorguk.ukuu.org.uk \
    --cc=jwboyer@fedoraproject.org \
    --cc=kchamart@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjones@redhat.com \
    --cc=rjw@rjwysocki.net \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git
	git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git
	git clone --mirror https://lore.kernel.org/lkml/9 lkml/git/9.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git