All of lore.kernel.org
 help / color / mirror / Atom feed
* Using taskset , powertop and perf with qemu-kvm
@ 2012-10-10  7:52 Jaspal
  2012-10-10 10:08 ` Gleb Natapov
  0 siblings, 1 reply; 3+ messages in thread
From: Jaspal @ 2012-10-10  7:52 UTC (permalink / raw)
  To: kvm

Hello ,

I wish to run some cpu intensive tasks on a vm , use only one core 
specifically #0 of the 6 available ( Xeon 3670 ) and all the while 
record basic perf events like cpu-cycles , instructions etc.

I am using taskset to define the cpu-affinity of the qemu process :
taskset -p 0x1 `pgrep qemu` (assuming only 1 vm is running )

I can verify that the vm is now running only on core 0 using top. top 
also shows that the qemu process is using 99% of it's share of CPU time 
( %CPU column in top ) upon running the tasks in vm. However what I fail 
to see is the increase in time spent of the core 0 in the C0 ( active ) 
state via powertop. It barely manages to cross 12%. If I run the same 
tasks ( FFT benchmark ) on the host on a different core ( say #1 ) and 
monitor it using powertop again , I can see that  C0 % for core 1 is 
above 100% ( 104 ~ 107 )
So why does not the output of top ( qemu is using 99% of it's cpu time , 
which is spent on core 0 )  co-relate with powertop ( which says core 0 
is idle for around 88% of time ) ?
Also , powertop reports that core 2 is being used heavily ( 104 % ) and 
I suspect this is one which is executing the vm operations. But why ?
There are no other cpu/memory intensive tasks running on the host.

Next , I am using the perf kvm record function to save the stats. If I 
use all the 7 core counters available along-with -a option , perf 
generates ~2MB/second . Is there a way to save just the raw count of the 
events ?
Also , if instead of -a , if I give -C 0 , perf just saves around 
0.016MB/s as opposed to 1.894MB/s in case of -a option. If the vm is 
indeed using core 0 , then perf should have recorded the events.

On a last note , does perf kvm automatically selects the vm to profile ( 
in case multiple vms are running ) on the basis of the guest.kallsyms 
and guest.modules files passed to it ?

Thanks ,
Jaspal

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Using taskset , powertop and perf with qemu-kvm
  2012-10-10  7:52 Using taskset , powertop and perf with qemu-kvm Jaspal
@ 2012-10-10 10:08 ` Gleb Natapov
  2012-10-10 12:20   ` Jaspal
  0 siblings, 1 reply; 3+ messages in thread
From: Gleb Natapov @ 2012-10-10 10:08 UTC (permalink / raw)
  To: Jaspal; +Cc: kvm

On Wed, Oct 10, 2012 at 01:22:22PM +0530, Jaspal wrote:
> Hello ,
> 
> I wish to run some cpu intensive tasks on a vm , use only one core
> specifically #0 of the 6 available ( Xeon 3670 ) and all the while
> record basic perf events like cpu-cycles , instructions etc.
> 
> I am using taskset to define the cpu-affinity of the qemu process :
> taskset -p 0x1 `pgrep qemu` (assuming only 1 vm is running )
> 
pgrep tells you only the pid of the io thread. vcpu runs in a separate
thread.

> I can verify that the vm is now running only on core 0 using top.
> top also shows that the qemu process is using 99% of it's share of
> CPU time ( %CPU column in top ) upon running the tasks in vm.
> However what I fail to see is the increase in time spent of the core
> 0 in the C0 ( active ) state via powertop. It barely manages to
> cross 12%. If I run the same tasks ( FFT benchmark ) on the host on
> a different core ( say #1 ) and monitor it using powertop again , I
> can see that  C0 % for core 1 is above 100% ( 104 ~ 107 )
> So why does not the output of top ( qemu is using 99% of it's cpu
> time , which is spent on core 0 )  co-relate with powertop ( which
> says core 0 is idle for around 88% of time ) ?
> Also , powertop reports that core 2 is being used heavily ( 104 % )
> and I suspect this is one which is executing the vm operations. But
> why ?
> There are no other cpu/memory intensive tasks running on the host.
> 
> Next , I am using the perf kvm record function to save the stats. If
> I use all the 7 core counters available along-with -a option , perf
> generates ~2MB/second . Is there a way to save just the raw count of
> the events ?
> Also , if instead of -a , if I give -C 0 , perf just saves around
> 0.016MB/s as opposed to 1.894MB/s in case of -a option. If the vm is
> indeed using core 0 , then perf should have recorded the events.
> 
> On a last note , does perf kvm automatically selects the vm to
> profile ( in case multiple vms are running ) on the basis of the
> guest.kallsyms and guest.modules files passed to it ?
> 
> Thanks ,
> Jaspal
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
			Gleb.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Using taskset , powertop and perf with qemu-kvm
  2012-10-10 10:08 ` Gleb Natapov
@ 2012-10-10 12:20   ` Jaspal
  0 siblings, 0 replies; 3+ messages in thread
From: Jaspal @ 2012-10-10 12:20 UTC (permalink / raw)
  To: Gleb Natapov; +Cc: kvm

On 10/10/2012 03:38 PM, Gleb Natapov wrote:
> On Wed, Oct 10, 2012 at 01:22:22PM +0530, Jaspal wrote:
>> Hello ,
>>
>> I wish to run some cpu intensive tasks on a vm , use only one core
>> specifically #0 of the 6 available ( Xeon 3670 ) and all the while
>> record basic perf events like cpu-cycles , instructions etc.
>>
>> I am using taskset to define the cpu-affinity of the qemu process :
>> taskset -p 0x1 `pgrep qemu` (assuming only 1 vm is running )
>>
> pgrep tells you only the pid of the io thread. vcpu runs in a separate
> thread.
>
>> I can verify that the vm is now running only on core 0 using top.
>> top also shows that the qemu process is using 99% of it's share of
>> CPU time ( %CPU column in top ) upon running the tasks in vm.
>> However what I fail to see is the increase in time spent of the core
>> 0 in the C0 ( active ) state via powertop. It barely manages to
>> cross 12%. If I run the same tasks ( FFT benchmark ) on the host on
>> a different core ( say #1 ) and monitor it using powertop again , I
>> can see that  C0 % for core 1 is above 100% ( 104 ~ 107 )
>> So why does not the output of top ( qemu is using 99% of it's cpu
>> time , which is spent on core 0 )  co-relate with powertop ( which
>> says core 0 is idle for around 88% of time ) ?
>> Also , powertop reports that core 2 is being used heavily ( 104 % )
>> and I suspect this is one which is executing the vm operations. But
>> why ?
>> There are no other cpu/memory intensive tasks running on the host.
>>
>> Next , I am using the perf kvm record function to save the stats. If
>> I use all the 7 core counters available along-with -a option , perf
>> generates ~2MB/second . Is there a way to save just the raw count of
>> the events ?
>> Also , if instead of -a , if I give -C 0 , perf just saves around
>> 0.016MB/s as opposed to 1.894MB/s in case of -a option. If the vm is
>> indeed using core 0 , then perf should have recorded the events.
>>
>> On a last note , does perf kvm automatically selects the vm to
>> profile ( in case multiple vms are running ) on the basis of the
>> guest.kallsyms and guest.modules files passed to it ?
>>
>> Thanks ,
>> Jaspal
>> --
>> To unsubscribe from this list: send the line "unsubscribe kvm" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> 			Gleb.
Thanks. It works using the correct tid.

--
Jaspal

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-10-10 12:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-10  7:52 Using taskset , powertop and perf with qemu-kvm Jaspal
2012-10-10 10:08 ` Gleb Natapov
2012-10-10 12:20   ` Jaspal

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.