public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@qumranet.com>
To: Sukanto Ghosh <sukanto@cse.iitb.ac.in>
Cc: kvm@vger.kernel.org
Subject: Re: Scheduling of VCPUs and allocation of Guest Physical Memory
Date: Mon, 09 Jun 2008 19:19:20 +0300	[thread overview]
Message-ID: <484D5808.9010907@qumranet.com> (raw)
In-Reply-To: <484D0F8F.4010807@cse.iitb.ac.in>

Sukanto Ghosh wrote:
>>
>> Yes, the guest has a different address space from the host.  The QEMU 
>> process malloc()'s the physical memory for the guest, and tells KVM 
>> what the region is (via an ioctl to /dev/kvm).
>
>
> Why does the QEMU process needs to malloc() the physical memory for 
> the guest ? Why can't it be done by the kernel itself ? Is it because 
> the said pages will be sharable between the QEMU process and the 
> guest, which will aid the QEMU process while performing DMA.
>

Userspace allocation is done in order to allow flexibility in how memory 
is allocated.  Userspace can choose to allocate large pages, apply a 
numa policy to the memory, mlock() it, etc.

It also makes swapping simple, as Linux already knows how to swap 
userspace memory.

Also, s390 has to do it this way.

>
>
> Also, when and how are host-initiated virtual interrupts delivered?  I 
> guess, that it is done at the time of VM-entry. 

Yes.

> But what about the interrupts that need to be delivered immediately 
> and while the VM is executing (assume interrupts are enabled in the 
> guest). Is any kind of signal-based mechanism employed to force a 
> VM-exit ?
>

Sending a signal to a task that is executing guest code will force it to 
exit to userspace immediately.  The in-kernel interrupt controller 
emulation also forces guest exits by sending inter-processor interrupts.


-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


  reply	other threads:[~2008-06-09 16:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-05  7:29 Scheduling of VCPUs and allocation of Guest Physical Memory Sukanto Ghosh
2008-06-05 12:54 ` Anthony Liguori
2008-06-06 14:22   ` Sukanto Ghosh
2008-06-06 14:40     ` Anthony Liguori
2008-06-09 11:10       ` Sukanto Ghosh
2008-06-09 16:19         ` Avi Kivity [this message]
2008-06-16 14:23           ` Sukanto Ghosh
2008-06-18 14:12             ` Avi Kivity

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=484D5808.9010907@qumranet.com \
    --to=avi@qumranet.com \
    --cc=kvm@vger.kernel.org \
    --cc=sukanto@cse.iitb.ac.in \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox