kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Radim Krčmář" <rkrcmar@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kmeaw@yandex-team.ru, "Gabriel L. Somlo" <gsomlo@gmail.com>,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	gleb@kernel.org
Subject: Re: [PATCH] KVM: Handle MSR_IA32_PERF_CTL
Date: Tue, 31 May 2016 15:05:10 +0200	[thread overview]
Message-ID: <20160531130510.GA30721@potion> (raw)
In-Reply-To: <1189746463.18391609.1464681232913.JavaMail.zimbra@redhat.com>

2016-05-31 03:53-0400, Paolo Bonzini:
> > 2016-05-27 17:22+0200, Radim Krčmář:
> > > (I wonder why MacOS X doesn't read IA32_PERF_STATUS, though.)
> > 
> > Oh, it maybe does ... we already emulate status and return 0x1000 in its
> > bottom 16 bits.  I have no idea what is that supposed to mean, but I
> > think we should return 0x1000 in IA32_PERF_CTL then.
> 
> It's 1000, not 0x1000 (instead, on real hardware the value is typically a
> multiple of 256).  It was added for Darwin too.

Ah, thanks.  (Drivers say that bottom 8 bits are not used.)

> Returning different values is okay, because they are different on real
> hardware too:
> 
> (sudo dd if=/dev/cpu/0/msr skip=$((0x198)) iflag=skip_bytes bs=8 count=1;
>  sudo dd if=/dev/cpu/0/msr skip=$((0x199)) iflag=skip_bytes bs=8 count=1) | od -tx8
> 0000000 00001f3900001100 0000000000001300
>         ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
>         PERF_STATUS      PERF_CTL
> 
> And perhaps if we returned non-zero values for PERF_CTL Darwin would try to
> write to it.  So returning zero is fine, I think.  There is no correct answer...

Yeah, 0 seems fine.  PERF_CTL the target value for PERF_STATUS, but OS
shouldn't put much trust in those values ... especially under KVM, where
those MSRs make little sense.

  reply	other threads:[~2016-05-31 13:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-26  7:32 [PATCH] KVM: Handle MSR_IA32_PERF_CTL kmeaw
2016-05-26 20:39 ` Radim Krčmář
2016-05-26 20:44   ` Gabriel L. Somlo
     [not found]     ` <920591464331762@webcorp02f.yandex-team.ru>
2016-05-27 15:22       ` Radim Krčmář
2016-05-27 15:38         ` Radim Krčmář
2016-05-31  7:53           ` Paolo Bonzini
2016-05-31 13:05             ` Radim Krčmář [this message]
     [not found]             ` <1317601464689200@webcorp01d.yandex-team.ru>
2016-05-31 13:16               ` [PATCH v3] " Radim Krčmář
2016-05-31 14:38                 ` [PATCH] " Dmitry Bilunov
2016-05-31 14:57                   ` Radim Krčmář
2016-05-27 15:28 ` Radim Krčmář

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=20160531130510.GA30721@potion \
    --to=rkrcmar@redhat.com \
    --cc=gleb@kernel.org \
    --cc=gsomlo@gmail.com \
    --cc=kmeaw@yandex-team.ru \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).