All of lore.kernel.org
 help / color / mirror / Atom feed
* 0.11: SMP guests using one host CPU only?
@ 2009-10-20  9:03 Tomasz Chmielewski
  2009-10-20  9:41 ` Avi Kivity
  0 siblings, 1 reply; 10+ messages in thread
From: Tomasz Chmielewski @ 2009-10-20  9:03 UTC (permalink / raw)
  To: kvm

On a 8 CPU host, I created a guest with 4 CPUs (-smp 4).

Unfortunately, the guest only uses one host CPU.
For example, running "cat /dev/urandom | gzip -9 >/dev/null &" several 
times on this guest causes load on only one host CPU.

Is it expected?

The host is running 2.6.32-rc5 and qemu-kvm-0.11. I also tried 2.6.31.5 
with qemu-kvm-0.11 with the same result.


I have another machine, running 2.6.24 kernel, where it works just fine 
(running several CPU-intensive tasks on a guest result in several host 
CPUs being loaded).



-- 
Tomasz Chmielewski
http://wpkg.org

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

* Re: 0.11: SMP guests using one host CPU only?
  2009-10-20  9:03 0.11: SMP guests using one host CPU only? Tomasz Chmielewski
@ 2009-10-20  9:41 ` Avi Kivity
  2009-10-20 10:17   ` Tomasz Chmielewski
  0 siblings, 1 reply; 10+ messages in thread
From: Avi Kivity @ 2009-10-20  9:41 UTC (permalink / raw)
  To: Tomasz Chmielewski; +Cc: kvm

On 10/20/2009 06:03 PM, Tomasz Chmielewski wrote:
> On a 8 CPU host, I created a guest with 4 CPUs (-smp 4).
>
> Unfortunately, the guest only uses one host CPU.
> For example, running "cat /dev/urandom | gzip -9 >/dev/null &" several 
> times on this guest causes load on only one host CPU.
>
> Is it expected?

No.  What does 'top -H' show?

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


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

* Re: 0.11: SMP guests using one host CPU only?
  2009-10-20  9:41 ` Avi Kivity
@ 2009-10-20 10:17   ` Tomasz Chmielewski
  2009-10-20 13:16     ` Avi Kivity
  0 siblings, 1 reply; 10+ messages in thread
From: Tomasz Chmielewski @ 2009-10-20 10:17 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm

Avi Kivity wrote:
> On 10/20/2009 06:03 PM, Tomasz Chmielewski wrote:
>> On a 8 CPU host, I created a guest with 4 CPUs (-smp 4).
>>
>> Unfortunately, the guest only uses one host CPU.
>> For example, running "cat /dev/urandom | gzip -9 >/dev/null &" several 
>> times on this guest causes load on only one host CPU.
>>
>> Is it expected?
> 
> No.  What does 'top -H' show?

In the guest - 4 CPUs with ~100% usage each (when I press "1"), otherwise, in the task list, multiple "cat" processes taking most CPU time (as it reads from /dev/urandom).


In the host - qemu-system-x86 (one process/thread) taking ~100% CPU; when I press "1", I see only one CPU is used 100%, 7 other CPUs are more or less not used.


guest command line:


/usr/bin/qemu-system-x86_64 -m 1024 -drive file=/srv/kvm/images/lvs2,if=virtio,cache=writeback,index=0,boot=on -net nic,vlan=0,model=virtio,macaddr=F2:4A:51:41:B1:3F -net tap,vlan=0,script=/etc/qemu-ifup -localtime -smp 4


There are 5 other guests (1 CPU) started before this guest.


-- 
Tomasz Chmielewski
http://wpkg.org

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

* Re: 0.11: SMP guests using one host CPU only?
  2009-10-20 10:17   ` Tomasz Chmielewski
@ 2009-10-20 13:16     ` Avi Kivity
  2009-10-20 13:19       ` Tomasz Chmielewski
  0 siblings, 1 reply; 10+ messages in thread
From: Avi Kivity @ 2009-10-20 13:16 UTC (permalink / raw)
  To: Tomasz Chmielewski; +Cc: kvm

On 10/20/2009 07:17 PM, Tomasz Chmielewski wrote:
> Avi Kivity wrote:
>> On 10/20/2009 06:03 PM, Tomasz Chmielewski wrote:
>>> On a 8 CPU host, I created a guest with 4 CPUs (-smp 4).
>>>
>>> Unfortunately, the guest only uses one host CPU.
>>> For example, running "cat /dev/urandom | gzip -9 >/dev/null &" 
>>> several times on this guest causes load on only one host CPU.
>>>
>>> Is it expected?
>>
>> No.  What does 'top -H' show?
>
> In the guest - 4 CPUs with ~100% usage each (when I press "1"), 
> otherwise, in the task list, multiple "cat" processes taking most CPU 
> time (as it reads from /dev/urandom).
>
>
> In the host - qemu-system-x86 (one process/thread) taking ~100% CPU; 
> when I press "1", I see only one CPU is used 100%, 7 other CPUs are 
> more or less not used.
>

I meant, how many qemu threads are there, and how much cpu does each take?

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


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

* Re: 0.11: SMP guests using one host CPU only?
  2009-10-20 13:16     ` Avi Kivity
@ 2009-10-20 13:19       ` Tomasz Chmielewski
  2009-10-20 13:21         ` Avi Kivity
  0 siblings, 1 reply; 10+ messages in thread
From: Tomasz Chmielewski @ 2009-10-20 13:19 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm

Avi Kivity wrote:
> On 10/20/2009 07:17 PM, Tomasz Chmielewski wrote:
>> Avi Kivity wrote:
>>> On 10/20/2009 06:03 PM, Tomasz Chmielewski wrote:
>>>> On a 8 CPU host, I created a guest with 4 CPUs (-smp 4).
>>>>
>>>> Unfortunately, the guest only uses one host CPU.
>>>> For example, running "cat /dev/urandom | gzip -9 >/dev/null &" 
>>>> several times on this guest causes load on only one host CPU.
>>>>
>>>> Is it expected?
>>>
>>> No.  What does 'top -H' show?
>>
>> In the guest - 4 CPUs with ~100% usage each (when I press "1"), 
>> otherwise, in the task list, multiple "cat" processes taking most CPU 
>> time (as it reads from /dev/urandom).
>>
>>
>> In the host - qemu-system-x86 (one process/thread) taking ~100% CPU; 
>> when I press "1", I see only one CPU is used 100%, 7 other CPUs are 
>> more or less not used.
>>
> 
> I meant, how many qemu threads are there, and how much cpu does each take?

There is only one qemu thread for the 4-cpu guest.


-- 
Tomasz Chmielewski
http://wpkg.org


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

* Re: 0.11: SMP guests using one host CPU only?
  2009-10-20 13:19       ` Tomasz Chmielewski
@ 2009-10-20 13:21         ` Avi Kivity
  2009-10-20 13:48           ` Tomasz Chmielewski
  0 siblings, 1 reply; 10+ messages in thread
From: Avi Kivity @ 2009-10-20 13:21 UTC (permalink / raw)
  To: Tomasz Chmielewski; +Cc: kvm

On 10/20/2009 10:19 PM, Tomasz Chmielewski wrote:
>>
>> I meant, how many qemu threads are there, and how much cpu does each 
>> take?
>
>
> There is only one qemu thread for the 4-cpu guest.

Not possible.  Even a single-cpu guest has two threads.

What does 'ls /proc/$(pgrep qemu)/task' show?


-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


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

* Re: 0.11: SMP guests using one host CPU only?
  2009-10-20 13:21         ` Avi Kivity
@ 2009-10-20 13:48           ` Tomasz Chmielewski
  2009-10-22  7:05             ` Avi Kivity
  0 siblings, 1 reply; 10+ messages in thread
From: Tomasz Chmielewski @ 2009-10-20 13:48 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm

Avi Kivity wrote:
> On 10/20/2009 10:19 PM, Tomasz Chmielewski wrote:
>>>
>>> I meant, how many qemu threads are there, and how much cpu does each 
>>> take?
>>
>>
>> There is only one qemu thread for the 4-cpu guest.
> 
> Not possible.  Even a single-cpu guest has two threads.

"ps auxH" shuld show me all threads? I started it multiple times, and it shown 1 thread for the 4-CPU guest
(with no CPU intensive tasks running - could this be a reason?).

 
> What does 'ls /proc/$(pgrep qemu)/task' show?

Running several CPU-intensive processes on this guest uses only one CPU on the host.

Both "ps auxH" and /proc confirm that this guest has 4-5 threads when I run several CPU-intensive apps.

Only one thread for this guest uses 100% CPU time; other threads use ~0%.

If I don't run any CPU-intensive tasks on this guests, it only runs one thread (unless I misinterpret something here).


Some 1-CPU guests have only one thread though?


# QEMU_TASKS=$(pgrep qemu)

# for QEMU_TASK in $QEMU_TASKS; do cat /proc/$QEMU_TASK/cmdline ; echo ; ls /proc/$QEMU_TASK/task ; echo ; done
/usr/bin/qemu-system-x86_64-m1024-drivefile=/srv/kvm/images/lvs2,if=virtio,cache=writeback,index=0,boot=on-netnic,vlan=0,model=virtio,macaddr=F2:4A:51:41:B1:3F-nettap,vlan=0,script=/etc/qemu-ifup-localtime-smp4
17687/  19018/  19020/  19069/

/usr/bin/qemu-system-x86_64-m1024-drivefile=/srv/kvm/images/gluster1a,if=virtio,cache=writeback,index=0,boot=on-netnic,vlan=0,model=virtio,macaddr=F2:4A:51:41:B1:3A-nettap,vlan=0,script=/etc/qemu-ifup-localtime
19220/  24857/

/usr/bin/qemu-system-x86_64-m1024-drivefile=/srv/kvm/images/gluster2a,if=virtio,cache=writeback,index=0,boot=on-netnic,vlan=0,model=virtio,macaddr=F2:4A:51:41:B1:3B-nettap,vlan=0,script=/etc/qemu-ifup-localtime
19252/  24896/

/usr/bin/qemu-system-x86_64-m1024-drivefile=/srv/kvm/images/gluster3a,if=virtio,cache=writeback,index=0,boot=on-netnic,vlan=0,model=virtio,macaddr=F2:4A:51:41:B1:3C-nettap,vlan=0,script=/etc/qemu-ifup-localtime
19258/  24934/

/usr/bin/qemu-system-x86_64-m1024-drivefile=/srv/kvm/images/gluster4a,if=virtio,cache=writeback,index=0,boot=on-netnic,vlan=0,model=virtio,macaddr=F2:4A:51:41:B1:3D-nettap,vlan=0,script=/etc/qemu-ifup-localtime
25878/

/usr/bin/qemu-system-x86_64-m1024-drivefile=/srv/kvm/images/lvs1,if=virtio,cache=writeback,index=0,boot=on-netnic,vlan=0,model=virtio,macaddr=F2:4A:51:41:B1:3E-nettap,vlan=0,script=/etc/qemu-ifup-localtime
25920/



No CPU-intensive apps:

/usr/bin/qemu-system-x86_64-m1024-drivefile=/srv/kvm/images/lvs2,if=virtio,cache=writeback,index=0,boot=on-netnic,vlan=0,model=virtio,macaddr=F2:4A:51:41:B1:3F-nettap,vlan=0,script=/etc/qemu-ifup-localtime-smp4
17687/



-- 
Tomasz Chmielewski
http://wpkg.org


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

* Re: 0.11: SMP guests using one host CPU only?
  2009-10-20 13:48           ` Tomasz Chmielewski
@ 2009-10-22  7:05             ` Avi Kivity
  2009-10-22  9:28               ` Tomasz Chmielewski
  0 siblings, 1 reply; 10+ messages in thread
From: Avi Kivity @ 2009-10-22  7:05 UTC (permalink / raw)
  To: Tomasz Chmielewski; +Cc: kvm

On 10/20/2009 04:48 PM, Tomasz Chmielewski wrote:
> Avi Kivity wrote:
>> On 10/20/2009 10:19 PM, Tomasz Chmielewski wrote:
>>>>
>>>> I meant, how many qemu threads are there, and how much cpu does 
>>>> each take?
>>>
>>>
>>> There is only one qemu thread for the 4-cpu guest.
>>
>> Not possible.  Even a single-cpu guest has two threads.
>
> "ps auxH" shuld show me all threads? I started it multiple times, and 
> it shown 1 thread for the 4-CPU guest
> (with no CPU intensive tasks running - could this be a reason?).

No.  kvm implies 2+ threads.

>
>
>> What does 'ls /proc/$(pgrep qemu)/task' show?
>
> Running several CPU-intensive processes on this guest uses only one 
> CPU on the host.
>
> Both "ps auxH" and /proc confirm that this guest has 4-5 threads when 
> I run several CPU-intensive apps.
>
> Only one thread for this guest uses 100% CPU time; other threads use ~0%.
>
> If I don't run any CPU-intensive tasks on this guests, it only runs 
> one thread (unless I misinterpret something here).
>
>
> Some 1-CPU guests have only one thread though?
>

Are you sure they're using kvm?  Try 'info kvm' in the monitor.  tcg 
will only use on thread (more will be spawned for I/O, but will 
eventually die).

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


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

* Re: 0.11: SMP guests using one host CPU only?
  2009-10-22  7:05             ` Avi Kivity
@ 2009-10-22  9:28               ` Tomasz Chmielewski
  2009-10-22 10:51                 ` Avi Kivity
  0 siblings, 1 reply; 10+ messages in thread
From: Tomasz Chmielewski @ 2009-10-22  9:28 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm

Avi Kivity wrote:

>> Some 1-CPU guests have only one thread though?
>>
> 
> Are you sure they're using kvm?  Try 'info kvm' in the monitor.  tcg 
> will only use on thread (more will be spawned for I/O, but will 
> eventually die).

Indeed, that was a good suggestion - they were not using KVM (support 
not compiled in, and kvm didn't complain when starting).

IO and CPU speed was rather OK, so I didn't notice ;)

To sum up the thread: I guess qemu _without_ KVM will only use one CPU, 
even when you assign more CPUs to the guest?


-- 
Tomasz Chmielewski
http://wpkg.org


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

* Re: 0.11: SMP guests using one host CPU only?
  2009-10-22  9:28               ` Tomasz Chmielewski
@ 2009-10-22 10:51                 ` Avi Kivity
  0 siblings, 0 replies; 10+ messages in thread
From: Avi Kivity @ 2009-10-22 10:51 UTC (permalink / raw)
  To: Tomasz Chmielewski; +Cc: kvm

On 10/22/2009 11:28 AM, Tomasz Chmielewski wrote:
> To sum up the thread: I guess qemu _without_ KVM will only use one 
> CPU, even when you assign more CPUs to the guest?
>

Yes.


-- 
error compiling committee.c: too many arguments to function


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

end of thread, other threads:[~2009-10-22 10:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-20  9:03 0.11: SMP guests using one host CPU only? Tomasz Chmielewski
2009-10-20  9:41 ` Avi Kivity
2009-10-20 10:17   ` Tomasz Chmielewski
2009-10-20 13:16     ` Avi Kivity
2009-10-20 13:19       ` Tomasz Chmielewski
2009-10-20 13:21         ` Avi Kivity
2009-10-20 13:48           ` Tomasz Chmielewski
2009-10-22  7:05             ` Avi Kivity
2009-10-22  9:28               ` Tomasz Chmielewski
2009-10-22 10:51                 ` Avi Kivity

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.