From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755971AbcE0P24 (ORCPT ); Fri, 27 May 2016 11:28:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57017 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754821AbcE0P2z (ORCPT ); Fri, 27 May 2016 11:28:55 -0400 Date: Fri, 27 May 2016 17:28:46 +0200 From: Radim =?utf-8?B?S3LEjW3DocWZ?= To: kmeaw@yandex-team.ru Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, gleb@kernel.org, pbonzini@redhat.com Subject: Re: [PATCH] KVM: Handle MSR_IA32_PERF_CTL Message-ID: <20160527152845.GB11721@potion> References: <770161464247923@webcorp02g.yandex-team.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <770161464247923@webcorp02g.yandex-team.ru> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 27 May 2016 15:28:49 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2016-05-26 10:32+0300, kmeaw@yandex-team.ru: > From: Dmitry Bilunov > > Intel CPUs having Turbo Boost feature implement an MSR to provide a > control interface via rdmsr/wrmsr instructions. One could detect the > presence of this feature by issuing one of these instructions and > handling the #GP exception which is generated in case the referenced MSR > is not implemented by the CPU. > > KVM's vCPU model behaves exactly as a real CPU in this case by injecting > a fault when MSR_IA32_PERF_CTL is called (which KVM does not support). > However, some operating systems use this register during an early boot > stage in which their kernel is not capable of handling #GP correctly, > causing #DP and finally a triple fault effectively resetting the vCPU. > > This patch implements a dummy handler for MSR_IA32_PERF_CTL to avoid the > crashes. Most notably it fixes an issue with MacOS X 10.10 kernel. > > Signed-off-by: Dmitry Bilunov > --- > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > @@ -983,6 +983,7 @@ static u32 emulated_msrs[] = { > MSR_IA32_MCG_STATUS, > MSR_IA32_MCG_CTL, > MSR_IA32_SMBASE, > + MSR_IA32_PERF_CTL, The MSR value is always 0, so there is no point in putting it here.