From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH V5 1/2] perf ignore LBR and extra_regs Date: Mon, 14 Jul 2014 13:55:03 +0200 Message-ID: <53C3C517.4000500@redhat.com> References: <1404989984-3068-1-git-send-email-kan.liang@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: andi@firstfloor.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org To: kan.liang@intel.com, peterz@infradead.org Return-path: Received: from mail-qc0-f180.google.com ([209.85.216.180]:63745 "EHLO mail-qc0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754113AbaGNLzL (ORCPT ); Mon, 14 Jul 2014 07:55:11 -0400 In-Reply-To: <1404989984-3068-1-git-send-email-kan.liang@intel.com> Sender: kvm-owner@vger.kernel.org List-ID: Il 10/07/2014 12:59, kan.liang@intel.com ha scritto: > From: Kan Liang > > x86, perf: Protect LBR and extra_regs against KVM lying > > With -cpu host, KVM reports LBR and extra_regs support, if the host has support. > When the guest perf driver tries to access LBR or extra_regs MSR, > it #GPs all MSR accesses,since KVM doesn't handle LBR and extra_regs support. > So check the related MSRs access right once at initialization time to avoid the error access at runtime. > > For reproducing the issue, please build the kernel with CONFIG_KVM_INTEL = y (for host kernel). > And CONFIG_PARAVIRT = n and CONFIG_KVM_GUEST = n (for guest kernel). I'm not sure this is a useful patch. This is #GP'ing just because of a limitation in the PMU; just compile the kernel with CONFIG_PARAVIRT, or split the "rdmsr is always rdmsr_safe" behavior out of CONFIG_PARAVIRT and into a new Kconfig symbol. In fact there's no reason why LBR cannot be virtualized (though it does need support from the processor), and it may even be possible to support OFFCORE_RSP_X in the KVM virtual PMU. Paolo