From: Wang Hui <john.whui1985@gmail.com>
To: Gleb Natapov <gleb@kernel.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>, kvm <kvm@vger.kernel.org>
Subject: Re: [PATCH] KVM/X86: vpmu migration, make perf_event associated with vcpu thread
Date: Sat, 30 Nov 2013 19:42:38 +0800 [thread overview]
Message-ID: <5299CF2E.2060802@gmail.com> (raw)
In-Reply-To: <20131130105419.GC21068@minantech.com>
On 2013/11/30 18:54, Gleb Natapov wrote:
> On Sat, Nov 30, 2013 at 01:59:24AM +0800, Wang Hui wrote:
>> After applying Paolo's patch, vpmu's data was migrated correctly.
>> https://patchwork.kernel.org/patch/2850813/
>>
>> 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 have tried pid in the struct of kvm_vcpu to get the vcpu thread's task_struct,
>> but after migration when create perf_event, pid is pointed to qemu's main thread
>> but not vcpu thread because of the pid switching in vcpu_load. I don't understand
>> this very well, I think vcpu is created in qemu_kvm_cpu_thread_fn, which is the
>> vcpu thread, use the pid of current is enough, why switch is needed?
>>
>
> Because the fact that thread that creates vcpu is the one that will
> "run" the vcpu is QEMU implementation detail. Other userspace may create
> all vcpus in one thread and then handle each one to a dedicated thread. Your
> code will not work for such userspace. You need to use pid and reprogram all mmu
> counters when it changes.
>
Thank you Gleb, my thought was too simple, I will try pid.
next prev parent reply other threads:[~2013-11-30 11:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-29 17:59 [PATCH] KVM/X86: vpmu migration, make perf_event associated with vcpu thread Wang Hui
2013-11-30 10:54 ` Gleb Natapov
2013-11-30 11:42 ` Wang Hui [this message]
2013-11-30 11:08 ` Paolo Bonzini
2013-11-30 11:47 ` Wang Hui
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5299CF2E.2060802@gmail.com \
--to=john.whui1985@gmail.com \
--cc=gleb@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.