All of lore.kernel.org
 help / color / mirror / Atom feed
* Question about host CPU usage/allocation by KVM
@ 2012-04-17 21:54 Alexander Lyakas
  2012-04-18 15:58 ` Avi Kivity
  2012-04-18 17:24 ` Stuart Yoder
  0 siblings, 2 replies; 7+ messages in thread
From: Alexander Lyakas @ 2012-04-17 21:54 UTC (permalink / raw)
  To: kvm

Greetings everybody,

Can anybody please point me to code/documentation regarding the
following questions I have:

- What does it actually mean using "-smp N" option, in terms of CPU
sharing between the host and the guest?
- How are guest CPUs mapped to host CPUs (if at all)?
- Is it possible to hard-allocate one or more CPUs to a particular
guest, preventing the host from using them?
- Is it possible to limit guest usage of host CPUs?
(- Do my questions make sense?)

I am running stock ubuntu-natty 2.6.38-8, with KVM 0.14.0.

Thanks!

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

* Re: Question about host CPU usage/allocation by KVM
  2012-04-17 21:54 Question about host CPU usage/allocation by KVM Alexander Lyakas
@ 2012-04-18 15:58 ` Avi Kivity
  2012-04-18 17:24 ` Stuart Yoder
  1 sibling, 0 replies; 7+ messages in thread
From: Avi Kivity @ 2012-04-18 15:58 UTC (permalink / raw)
  To: Alexander Lyakas; +Cc: kvm

On 04/18/2012 12:54 AM, Alexander Lyakas wrote:
> Greetings everybody,
>
> Can anybody please point me to code/documentation regarding the
> following questions I have:
>
> - What does it actually mean using "-smp N" option, in terms of CPU
> sharing between the host and the guest?

What does cpu sharing mean?

> - How are guest CPUs mapped to host CPUs (if at all)?

The host scheduler allocates guest vcpus to host cpus.  This allocation
changes with demand from other processes (or guests) on the host.

> - Is it possible to hard-allocate one or more CPUs to a particular
> guest, preventing the host from using them?

Look up 'cpusets'.

> - Is it possible to limit guest usage of host CPUs?

Look up 'cgroups cpu controller'.

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


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

* Re: Question about host CPU usage/allocation by KVM
  2012-04-17 21:54 Question about host CPU usage/allocation by KVM Alexander Lyakas
  2012-04-18 15:58 ` Avi Kivity
@ 2012-04-18 17:24 ` Stuart Yoder
  2012-04-18 20:55   ` Alexander Lyakas
  2012-04-19 18:01   ` Alexander Lyakas
  1 sibling, 2 replies; 7+ messages in thread
From: Stuart Yoder @ 2012-04-18 17:24 UTC (permalink / raw)
  To: Alexander Lyakas; +Cc: kvm

On Tue, Apr 17, 2012 at 4:54 PM, Alexander Lyakas
<alex.bolshoy@gmail.com> wrote:
> Greetings everybody,
>
> Can anybody please point me to code/documentation regarding the
> following questions I have:
>
> - What does it actually mean using "-smp N" option, in terms of CPU
> sharing between the host and the guest?
> - How are guest CPUs mapped to host CPUs (if at all)?

Each guest CPU (vcpu) corresponds to a QEMU thread.
You can see the thread ids in QEMU with "info cpus" in the
QEMU monitor.

Since a vcpu is a thread you can apply standard Linux
mechanisms to managing those threads-- CPU affinity, etc.

Stuart

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

* Re: Question about host CPU usage/allocation by KVM
  2012-04-18 17:24 ` Stuart Yoder
@ 2012-04-18 20:55   ` Alexander Lyakas
  2012-04-19 18:01   ` Alexander Lyakas
  1 sibling, 0 replies; 7+ messages in thread
From: Alexander Lyakas @ 2012-04-18 20:55 UTC (permalink / raw)
  To: Stuart Yoder; +Cc: kvm

Thanks Avi and Stuart!

On Wed, Apr 18, 2012 at 8:24 PM, Stuart Yoder <b08248@gmail.com> wrote:
> On Tue, Apr 17, 2012 at 4:54 PM, Alexander Lyakas
> <alex.bolshoy@gmail.com> wrote:
>> Greetings everybody,
>>
>> Can anybody please point me to code/documentation regarding the
>> following questions I have:
>>
>> - What does it actually mean using "-smp N" option, in terms of CPU
>> sharing between the host and the guest?
>> - How are guest CPUs mapped to host CPUs (if at all)?
>
> Each guest CPU (vcpu) corresponds to a QEMU thread.
> You can see the thread ids in QEMU with "info cpus" in the
> QEMU monitor.
>
> Since a vcpu is a thread you can apply standard Linux
> mechanisms to managing those threads-- CPU affinity, etc.
>
> Stuart

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

* Re: Question about host CPU usage/allocation by KVM
  2012-04-18 17:24 ` Stuart Yoder
  2012-04-18 20:55   ` Alexander Lyakas
@ 2012-04-19 18:01   ` Alexander Lyakas
  2012-04-20 15:01     ` Brian Jackson
  1 sibling, 1 reply; 7+ messages in thread
From: Alexander Lyakas @ 2012-04-19 18:01 UTC (permalink / raw)
  To: Stuart Yoder; +Cc: kvm

Hi Stuart,
I have been doing some experiments, and I noticed that there are
additional QEMU threads, besides the ones reported by "info cpus"
command. In particular, the main QEMU thread (the one whose LWP is the
same as its PID), also consumes significant CPU time. Is this
expected?

Alex.


On Wed, Apr 18, 2012 at 8:24 PM, Stuart Yoder <b08248@gmail.com> wrote:
> On Tue, Apr 17, 2012 at 4:54 PM, Alexander Lyakas
> <alex.bolshoy@gmail.com> wrote:
>> Greetings everybody,
>>
>> Can anybody please point me to code/documentation regarding the
>> following questions I have:
>>
>> - What does it actually mean using "-smp N" option, in terms of CPU
>> sharing between the host and the guest?
>> - How are guest CPUs mapped to host CPUs (if at all)?
>
> Each guest CPU (vcpu) corresponds to a QEMU thread.
> You can see the thread ids in QEMU with "info cpus" in the
> QEMU monitor.
>
> Since a vcpu is a thread you can apply standard Linux
> mechanisms to managing those threads-- CPU affinity, etc.
>
> Stuart

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

* Re: Question about host CPU usage/allocation by KVM
  2012-04-19 18:01   ` Alexander Lyakas
@ 2012-04-20 15:01     ` Brian Jackson
  2012-04-20 23:12       ` Shergill, Gurinder
  0 siblings, 1 reply; 7+ messages in thread
From: Brian Jackson @ 2012-04-20 15:01 UTC (permalink / raw)
  To: Stuart Yoder, Alexander Lyakas; +Cc: kvm

On Thu, 19 Apr 2012 13:01:54 -0500, Alexander Lyakas  
<alex.bolshoy@gmail.com> wrote:

> Hi Stuart,
> I have been doing some experiments, and I noticed that there are
> additional QEMU threads, besides the ones reported by "info cpus"
> command. In particular, the main QEMU thread (the one whose LWP is the
> same as its PID), also consumes significant CPU time. Is this
> expected?

The extra threads are for various things. It can be for the vnc server if  
you are using it. Threads are used to mimic aio in certain situations.  
Etc. The main thread also does a lot of the device emulation work  
(console, network, serial, block, etc.)


>
> Alex.
>
>
> On Wed, Apr 18, 2012 at 8:24 PM, Stuart Yoder <b08248@gmail.com> wrote:
>> On Tue, Apr 17, 2012 at 4:54 PM, Alexander Lyakas
>> <alex.bolshoy@gmail.com> wrote:
>>> Greetings everybody,
>>>
>>> Can anybody please point me to code/documentation regarding the
>>> following questions I have:
>>>
>>> - What does it actually mean using "-smp N" option, in terms of CPU
>>> sharing between the host and the guest?
>>> - How are guest CPUs mapped to host CPUs (if at all)?
>>
>> Each guest CPU (vcpu) corresponds to a QEMU thread.
>> You can see the thread ids in QEMU with "info cpus" in the
>> QEMU monitor.
>>
>> Since a vcpu is a thread you can apply standard Linux
>> mechanisms to managing those threads-- CPU affinity, etc.
>>
>> Stuart
> --
> 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

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

* RE: Question about host CPU usage/allocation by KVM
  2012-04-20 15:01     ` Brian Jackson
@ 2012-04-20 23:12       ` Shergill, Gurinder
  0 siblings, 0 replies; 7+ messages in thread
From: Shergill, Gurinder @ 2012-04-20 23:12 UTC (permalink / raw)
  To: Brian Jackson, Stuart Yoder, Alexander Lyakas; +Cc: kvm



| -----Original Message-----
| From: kvm-owner@vger.kernel.org [mailto:kvm-owner@vger.kernel.org] On
| Behalf Of Brian Jackson
| Sent: Friday, April 20, 2012 8:01 AM
| To: Stuart Yoder; Alexander Lyakas
| Cc: kvm@vger.kernel.org
| Subject: Re: Question about host CPU usage/allocation by KVM
| 
| On Thu, 19 Apr 2012 13:01:54 -0500, Alexander Lyakas
| <alex.bolshoy@gmail.com> wrote:
| 
| > Hi Stuart,
| > I have been doing some experiments, and I noticed that there are
| > additional QEMU threads, besides the ones reported by "info cpus"
| > command. In particular, the main QEMU thread (the one whose LWP is the
| > same as its PID), also consumes significant CPU time. Is this
| > expected?
| 
| The extra threads are for various things. It can be for the vnc server if
| you are using it. Threads are used to mimic aio in certain situations.
| Etc. The main thread also does a lot of the device emulation work
| (console, network, serial, block, etc.)

Is there some way to know what they are for ? or how many can get created ?

I noticed that the number of threads go from ~4 to ~70 if I do some I/O inside the guest.

Sunny

| 
| 
| >
| > Alex.
| >
| >
| > On Wed, Apr 18, 2012 at 8:24 PM, Stuart Yoder <b08248@gmail.com> wrote:
| >> On Tue, Apr 17, 2012 at 4:54 PM, Alexander Lyakas
| >> <alex.bolshoy@gmail.com> wrote:
| >>> Greetings everybody,
| >>>
| >>> Can anybody please point me to code/documentation regarding the
| >>> following questions I have:
| >>>
| >>> - What does it actually mean using "-smp N" option, in terms of CPU
| >>> sharing between the host and the guest?
| >>> - How are guest CPUs mapped to host CPUs (if at all)?
| >>
| >> Each guest CPU (vcpu) corresponds to a QEMU thread.
| >> You can see the thread ids in QEMU with "info cpus" in the QEMU
| >> monitor.
| >>
| >> Since a vcpu is a thread you can apply standard Linux mechanisms to
| >> managing those threads-- CPU affinity, etc.
| >>
| >> Stuart
| > --
| > 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
| --
| 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

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

end of thread, other threads:[~2012-04-20 23:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-17 21:54 Question about host CPU usage/allocation by KVM Alexander Lyakas
2012-04-18 15:58 ` Avi Kivity
2012-04-18 17:24 ` Stuart Yoder
2012-04-18 20:55   ` Alexander Lyakas
2012-04-19 18:01   ` Alexander Lyakas
2012-04-20 15:01     ` Brian Jackson
2012-04-20 23:12       ` Shergill, Gurinder

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.