qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] multiprocessor on kvm
@ 2011-11-08 11:55 Xin Tong
  2011-11-08 12:04 ` 陳韋任
  0 siblings, 1 reply; 9+ messages in thread
From: Xin Tong @ 2011-11-08 11:55 UTC (permalink / raw)
  To: qemu-devel

I am wondering that when one uses qemu with kvm. How many cores are
exposed and available to the guest os ( assuming the host has 4 cores
). is this configurable ?

Thanks

Xin

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

* Re: [Qemu-devel] multiprocessor on kvm
  2011-11-08 11:55 [Qemu-devel] multiprocessor on kvm Xin Tong
@ 2011-11-08 12:04 ` 陳韋任
  2011-11-08 12:10   ` 陳韋任
  0 siblings, 1 reply; 9+ messages in thread
From: 陳韋任 @ 2011-11-08 12:04 UTC (permalink / raw)
  To: Xin Tong; +Cc: qemu-devel

> I am wondering that when one uses qemu with kvm. How many cores are
> exposed and available to the guest os ( assuming the host has 4 cores
> ). is this configurable ?

  QEMU provides "-smp" option, but those virtual cpus are scheduled in
round-robin fashion. In other words, it's not real parallelism. I don't
know if there is any difference with kvm enabled.

Regards,
chenwj

-- 
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667

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

* Re: [Qemu-devel] multiprocessor on kvm
  2011-11-08 12:04 ` 陳韋任
@ 2011-11-08 12:10   ` 陳韋任
  2011-11-08 12:23     ` Stefan Hajnoczi
  0 siblings, 1 reply; 9+ messages in thread
From: 陳韋任 @ 2011-11-08 12:10 UTC (permalink / raw)
  To: Xin Tong, qemu-devel

On Tue, Nov 08, 2011 at 08:04:44PM +0800, 陳韋任 wrote:
> > I am wondering that when one uses qemu with kvm. How many cores are
> > exposed and available to the guest os ( assuming the host has 4 cores
> > ). is this configurable ?
> 
>   QEMU provides "-smp" option, but those virtual cpus are scheduled in
> round-robin fashion. In other words, it's not real parallelism. I don't
> know if there is any difference with kvm enabled.

  IIRC, kvm uses QEMU for device emulation only. Those virtual cpus are
ran on physical cpus simultaneously.

Regards,
chenwj

-- 
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667

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

* Re: [Qemu-devel] multiprocessor on kvm
  2011-11-08 12:10   ` 陳韋任
@ 2011-11-08 12:23     ` Stefan Hajnoczi
  2011-11-08 12:37       ` Xin Tong
  0 siblings, 1 reply; 9+ messages in thread
From: Stefan Hajnoczi @ 2011-11-08 12:23 UTC (permalink / raw)
  To: 陳韋任; +Cc: qemu-devel, Xin Tong

On Tue, Nov 8, 2011 at 12:10 PM, 陳韋任 <chenwj@iis.sinica.edu.tw> wrote:
> On Tue, Nov 08, 2011 at 08:04:44PM +0800, 陳韋任 wrote:
>> > I am wondering that when one uses qemu with kvm. How many cores are
>> > exposed and available to the guest os ( assuming the host has 4 cores
>> > ). is this configurable ?
>>
>>   QEMU provides "-smp" option, but those virtual cpus are scheduled in
>> round-robin fashion. In other words, it's not real parallelism. I don't
>> know if there is any difference with kvm enabled.
>
>  IIRC, kvm uses QEMU for device emulation only. Those virtual cpus are
> ran on physical cpus simultaneously.

Right, qemu -enable-kvm will run a thread for each vCPU.  So you get
true SMP parallelism.

QEMU without KVM mode, on the other hand, does round-robin scheduling
of vCPUs and does not take advantage of multiprocessor hosts.

Stefan

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

* Re: [Qemu-devel] multiprocessor on kvm
  2011-11-08 12:23     ` Stefan Hajnoczi
@ 2011-11-08 12:37       ` Xin Tong
  2011-11-08 13:08         ` 陳韋任
  2011-11-08 14:21         ` Xin Tong
  0 siblings, 2 replies; 9+ messages in thread
From: Xin Tong @ 2011-11-08 12:37 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: qemu-devel, 陳韋任

so qemu exposes multiple processors to the guest os by having multiple
vCPUs. and it realizes the multiple vCPUs by either using RR on a
single host cpu (qemu ) or using multiple host cpus (kvm).

Thanks

Xin


2011/11/8 Stefan Hajnoczi <stefanha@gmail.com>:
> On Tue, Nov 8, 2011 at 12:10 PM, 陳韋任 <chenwj@iis.sinica.edu.tw> wrote:
>> On Tue, Nov 08, 2011 at 08:04:44PM +0800, 陳韋任 wrote:
>>> > I am wondering that when one uses qemu with kvm. How many cores are
>>> > exposed and available to the guest os ( assuming the host has 4 cores
>>> > ). is this configurable ?
>>>
>>>   QEMU provides "-smp" option, but those virtual cpus are scheduled in
>>> round-robin fashion. In other words, it's not real parallelism. I don't
>>> know if there is any difference with kvm enabled.
>>
>>  IIRC, kvm uses QEMU for device emulation only. Those virtual cpus are
>> ran on physical cpus simultaneously.
>
> Right, qemu -enable-kvm will run a thread for each vCPU.  So you get
> true SMP parallelism.
>
> QEMU without KVM mode, on the other hand, does round-robin scheduling
> of vCPUs and does not take advantage of multiprocessor hosts.
>
> Stefan
>

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

* Re: [Qemu-devel] multiprocessor on kvm
  2011-11-08 12:37       ` Xin Tong
@ 2011-11-08 13:08         ` 陳韋任
  2011-11-09  2:45           ` Dong Xu Wang
  2011-11-08 14:21         ` Xin Tong
  1 sibling, 1 reply; 9+ messages in thread
From: 陳韋任 @ 2011-11-08 13:08 UTC (permalink / raw)
  To: Xin Tong; +Cc: Stefan Hajnoczi, qemu-devel, 陳韋任

> so qemu exposes multiple processors to the guest os by having multiple
> vCPUs. and it realizes the multiple vCPUs by either using RR on a
> single host cpu (qemu ) or using multiple host cpus (kvm).

  yes.

Regards,
chenwj

-- 
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667

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

* Re: [Qemu-devel] multiprocessor on kvm
  2011-11-08 12:37       ` Xin Tong
  2011-11-08 13:08         ` 陳韋任
@ 2011-11-08 14:21         ` Xin Tong
  1 sibling, 0 replies; 9+ messages in thread
From: Xin Tong @ 2011-11-08 14:21 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: qemu-devel, 陳韋任

now question is if one of the cpu vmexits the guest due to trapping
instruction ( i.e. PIO), the host linux will have only one physical
cpu to run on as the other cpus are still running the guest os ? Am I
right ?

Thanks


Xin

2011/11/8 Xin Tong <xerox.time.tech@gmail.com>:
> so qemu exposes multiple processors to the guest os by having multiple
> vCPUs. and it realizes the multiple vCPUs by either using RR on a
> single host cpu (qemu ) or using multiple host cpus (kvm).
>
> Thanks
>
> Xin
>
>
> 2011/11/8 Stefan Hajnoczi <stefanha@gmail.com>:
>> On Tue, Nov 8, 2011 at 12:10 PM, 陳韋任 <chenwj@iis.sinica.edu.tw> wrote:
>>> On Tue, Nov 08, 2011 at 08:04:44PM +0800, 陳韋任 wrote:
>>>> > I am wondering that when one uses qemu with kvm. How many cores are
>>>> > exposed and available to the guest os ( assuming the host has 4 cores
>>>> > ). is this configurable ?
>>>>
>>>>   QEMU provides "-smp" option, but those virtual cpus are scheduled in
>>>> round-robin fashion. In other words, it's not real parallelism. I don't
>>>> know if there is any difference with kvm enabled.
>>>
>>>  IIRC, kvm uses QEMU for device emulation only. Those virtual cpus are
>>> ran on physical cpus simultaneously.
>>
>> Right, qemu -enable-kvm will run a thread for each vCPU.  So you get
>> true SMP parallelism.
>>
>> QEMU without KVM mode, on the other hand, does round-robin scheduling
>> of vCPUs and does not take advantage of multiprocessor hosts.
>>
>> Stefan
>>
>

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

* Re: [Qemu-devel] multiprocessor on kvm
  2011-11-08 13:08         ` 陳韋任
@ 2011-11-09  2:45           ` Dong Xu Wang
  2011-11-09  2:50             ` 陳韋任
  0 siblings, 1 reply; 9+ messages in thread
From: Dong Xu Wang @ 2011-11-09  2:45 UTC (permalink / raw)
  To: 陳韋任; +Cc: Stefan Hajnoczi, qemu-devel, Xin Tong

I am wondering when using -smp 16 and --enable-kvm at the same time
(while the host has 4 cores), what will happen?

在 2011年11月8日 下午9:08,陳韋任 <chenwj@iis.sinica.edu.tw> 写道:
>> so qemu exposes multiple processors to the guest os by having multiple
>> vCPUs. and it realizes the multiple vCPUs by either using RR on a
>> single host cpu (qemu ) or using multiple host cpus (kvm).
>
>  yes.
>
> Regards,
> chenwj
>
> --
> Wei-Ren Chen (陳韋任)
> Computer Systems Lab, Institute of Information Science,
> Academia Sinica, Taiwan (R.O.C.)
> Tel:886-2-2788-3799 #1667
>
>

Regards
Robert Wang

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

* Re: [Qemu-devel] multiprocessor on kvm
  2011-11-09  2:45           ` Dong Xu Wang
@ 2011-11-09  2:50             ` 陳韋任
  0 siblings, 0 replies; 9+ messages in thread
From: 陳韋任 @ 2011-11-09  2:50 UTC (permalink / raw)
  To: Dong Xu Wang
  Cc: Stefan Hajnoczi, qemu-devel, 陳韋任, Xin Tong

> I am wondering when using -smp 16 and --enable-kvm at the same time
> (while the host has 4 cores), what will happen?

  "-smp 16" will lauch 16 virtual cpu threads, and "--enable-kvm" means
you run those threads on physical cpus *at the same time*. How 16 virtual
cpu threads are scheduled on 4 physical cpus is done by host OS.

Regards,
chenwj

-- 
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667

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

end of thread, other threads:[~2011-11-09  2:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-08 11:55 [Qemu-devel] multiprocessor on kvm Xin Tong
2011-11-08 12:04 ` 陳韋任
2011-11-08 12:10   ` 陳韋任
2011-11-08 12:23     ` Stefan Hajnoczi
2011-11-08 12:37       ` Xin Tong
2011-11-08 13:08         ` 陳韋任
2011-11-09  2:45           ` Dong Xu Wang
2011-11-09  2:50             ` 陳韋任
2011-11-08 14:21         ` Xin Tong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).