From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wang Hui Subject: Re: [PATCH] KVM/X86: vpmu migration, make perf_event associated with vcpu thread Date: Sat, 30 Nov 2013 19:47:53 +0800 Message-ID: <5299D069.3090108@gmail.com> References: <5298D5FC.8030709@gmail.com> <5299C741.40609@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Gleb Natapov , kvm To: Paolo Bonzini Return-path: Received: from mail-pd0-f195.google.com ([209.85.192.195]:35851 "EHLO mail-pd0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751249Ab3K3LsD (ORCPT ); Sat, 30 Nov 2013 06:48:03 -0500 Received: by mail-pd0-f195.google.com with SMTP id v10so4808445pde.10 for ; Sat, 30 Nov 2013 03:48:02 -0800 (PST) In-Reply-To: <5299C741.40609@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 2013/11/30 19:08, Paolo Bonzini wrote: > Il 29/11/2013 18:59, Wang Hui ha scritto: >> But when I wrote a test module to make IA32_PMC1 to count the event of unhalted >> cpu-cycles, after migration the value of IA32_PMC1 never grows up again. I found >> that after migration perf_event was created exactly, but when it was created, >> "current" is qemu's main thread which won't enter no-root mode, so the count of >> perf_event will never increase. > > I think the fix is to apply the MSRs in QEMU's VCPU thread, through > run_on_cpu. Interesting that I could not reproduce this when testing my > patches. > > Paolo > Thank you for your advice, Paolo. I will try run_on_cpu. And my qemu version was 1.5.1, maybe it is too old. I will try the latest version. Thanks Wang Hui