From: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
To: Chen Haogang <chg-fuK+BI7+yZkjr28BhZ4uKczWQAQhF3cR@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: Swapping out kvm pages
Date: Wed, 11 Apr 2007 17:41:45 +0300 [thread overview]
Message-ID: <461CF3A9.8040804@qumranet.com> (raw)
In-Reply-To: <c4ebe0280704110634h19ddc60egbff264b8e3dbc503-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
Chen Haogang wrote:
>
> In kvm's TODO page, I saw the item "attach kvm memory to a Linux
> address_space so that guest memory can be paged out". But I don't
> think it is as simple as this. Because both host part page fault and
> guest part page fault interact.
>
> As I know, the creation of guest's shadow PTEs don't go through host's
> PTEs. When a shadow PTE is to be created, it always assumes the page
> pointer stored in memory region is vaild, and use the page struct to
> calcuate host physical address.
>
> So, if we want to implement a swap mechanism. It is important to mark
> the page struct pointer as invalid when host frame is swapped out. And
> replace the page pointer with the new one when a frame is swapped in.
>
> Moreover, we should not swapped out pages that are currently mapped by
> shadow PTEs unless we got a way to invalidate them. On the guest part,
> when a shadow PTE is to be created, we should make sure the page
> pointer in memory regeion is vaild ( i.e. the page is not swapped
> out), if not, we should ask to host to bring in the page before guest
> can resume.
>
> I want to know if I misunderstood anything, and wonder if there's any
> easier way to implement guest pages' swapping?
>
>
That's what I had in mind. I don't know exactly how you prevent a page
from being swapped; maybe it involves the page locked page flag, or
maybe just incrementing its reference count is enough. Paging in is
probably simpler; if the page isn't in the page cache, bring it in and
attach it to the shadow page table.
The only complication I see is with the upcoming nested/extended page
tables, which want shadow page tables for *all* guest pages, making this
scheme fail. We can make npt/ept demand paged like current shadow
paging, but it seems to be a pessimization.
--
error compiling committee.c: too many arguments to function
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
next prev parent reply other threads:[~2007-04-11 14:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-11 13:34 Swapping out kvm pages Chen Haogang
[not found] ` <c4ebe0280704110634h19ddc60egbff264b8e3dbc503-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-04-11 14:41 ` Avi Kivity [this message]
2007-04-15 6:00 ` Chen Haogang
[not found] ` <c4ebe0280704142300x379fb7b8u2a8df7101292b414-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-04-15 17:13 ` 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=461CF3A9.8040804@qumranet.com \
--to=avi-atkuwr5tajbwk0htik3j/w@public.gmane.org \
--cc=chg-fuK+BI7+yZkjr28BhZ4uKczWQAQhF3cR@public.gmane.org \
--cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
/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 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.