public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Dor Laor <dor.laor@qumranet.com>
To: Arn <cse.syslab@gmail.com>
Cc: kvm@vger.kernel.org
Subject: Re: Need advice on timed access to guest pages
Date: Wed, 02 Jul 2008 14:41:59 +0300	[thread overview]
Message-ID: <1214998919.30300.0.camel@localhost.localdomain> (raw)
In-Reply-To: <896ae46a0807012311u7aa380d6v5fe36f854722b578@mail.gmail.com>

On Wed, 2008-07-02 at 02:11 -0400, Arn wrote:
> Hi KVM devs,
> 
> I'm trying to write a guest kernel module (or modify kernel code) to
> do the following :
> 
> Say I have a kvm guest with 512 MB RAM running on a host with 2 GB
> RAM. Now I run a process on the host that will cause increasing memory
> pressure which will in turn cause the host to swap out some of the
> guests pages (without the guest knowing). My guest kernel module will
> randomly access some of its physical pages (say read a byte from a
> page) and time the accesses.
> 
> In theory an attempt by the guest to access a page that has been
> swapped out by the host should take much longer than accessing a page
> that is in memory.

Your assumption is correct for userspace allocation inside the guest.
Let me explain:

The current kvm without mmu-notifiers, can transparently swap guest
pages only if they are not pointed by the shadow page tables.
One a spte is instantiated the page cannot go to swap. mmu notifiers
will cancel this limitation and we'll get notifications about page
swapping from the host MM.

IIRC guest kernel allocations has the global bit set, thus we optimize
the shadow mmu not to flush global guest pages, so if this assumption is
correct, you won't feel the difference.

Anyway what's your motivation for this module?


> 
> Since I'm still a novice can someone advise/guide me on this and let
> me know if I'm missing something crucial in my assumptions ? I'm using
> an amd64 machine with host/guest kernel 2.6.22 and kvm-64
> 
> Thanks in advance
> a. rn
> --
> 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


  reply	other threads:[~2008-07-02 11:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-02  6:11 Need advice on timed access to guest pages Arn
2008-07-02 11:41 ` Dor Laor [this message]
2008-07-02 21:06   ` Arn
  -- strict thread matches above, loose matches on Subject: below --
2008-07-03 15:04 Sukanto Ghosh
2008-07-03 15:41 ` Andrea Arcangeli
2008-07-04  7:10   ` Sukanto Ghosh

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=1214998919.30300.0.camel@localhost.localdomain \
    --to=dor.laor@qumranet.com \
    --cc=cse.syslab@gmail.com \
    --cc=kvm@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox