From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eduardo Habkost Subject: Re: [Qemu-devel] [PATCH] i386/cpu/kvm: look at PMU's CPUID before setting MSRs Date: Wed, 27 Dec 2017 15:39:51 -0200 Message-ID: <20171227173951.GE24856@localhost.localdomain> References: <1514383466-7257-1-git-send-email-jan.dakinevich@virtuozzo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: qemu-devel@nongnu.org, "Denis V. Lunev" , Roman Kagan , Paolo Bonzini , Marcelo Tosatti , Richard Henderson , kvm@vger.kernel.org To: Jan Dakinevich Return-path: Received: from mx1.redhat.com ([209.132.183.28]:38636 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751184AbdL0Rjx (ORCPT ); Wed, 27 Dec 2017 12:39:53 -0500 Content-Disposition: inline In-Reply-To: <1514383466-7257-1-git-send-email-jan.dakinevich@virtuozzo.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Dec 27, 2017 at 05:04:26PM +0300, Jan Dakinevich wrote: > Certain PMU-related MSRs are not supported for CPUs with PMU > architecture below version 2. KVM rejects any access to them (see > intel_is_valid_msr_idx routine in KVM), and QEMU fails on the following > assertion: > > kvm_put_msrs: Assertion `ret == cpu->kvm_msr_buf->nmsrs' failed. > > QEMU also could fail if KVM exposes less fixed counters then 3. It could > happen if host system run inside another hypervisor, which is tweaking > PMU-related CPUID. To prevent possible fail, number of fixed counters now is > obtained in the same way as number of GP counters. > > Reviewed-by: Roman Kagan > Signed-off-by: Jan Dakinevich Reviewed-by: Eduardo Habkost -- Eduardo