From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH] KVM: Handle MSR_IA32_PERF_CTL Date: Tue, 31 May 2016 03:53:52 -0400 (EDT) Message-ID: <1189746463.18391609.1464681232913.JavaMail.zimbra@redhat.com> References: <770161464247923@webcorp02g.yandex-team.ru> <20160526203931.GB25334@potion> <20160526204439.GF2186@HEDWIG.INI.CMU.EDU> <920591464331762@webcorp02f.yandex-team.ru> <20160527152224.GA11721@potion> <20160527153850.GC11721@potion> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kmeaw@yandex-team.ru, "Gabriel L. Somlo" , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, gleb@kernel.org To: Radim =?utf-8?B?S3LEjW3DocWZ?= Return-path: In-Reply-To: <20160527153850.GC11721@potion> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org > 2016-05-27 17:22+0200, Radim Kr=C4=8Dm=C3=A1=C5=99: > > (I wonder why MacOS X doesn't read IA32_PERF_STATUS, though.) >=20 > 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. Returning different values is okay, because they are different on real hardware too: (sudo dd if=3D/dev/cpu/0/msr skip=3D$((0x198)) iflag=3Dskip_bytes bs=3D= 8 count=3D1; sudo dd if=3D/dev/cpu/0/msr skip=3D$((0x199)) iflag=3Dskip_bytes bs=3D= 8 count=3D1) | od -tx8 0000000 00001f3900001100 0000000000001300 ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ PERF_STATUS PERF_CTL And perhaps if we returned non-zero values for PERF_CTL Darwin would tr= y to write to it. So returning zero is fine, I think. There is no correct = answer... Paolo > (Would be nice to understand how that 0x1000 happened ... we might wa= nt > 0 in both.) >=20