public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
To: Anthony Liguori <anthony-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [PATCH 0/4] Swapping
Date: Tue, 16 Oct 2007 11:35:30 +0200	[thread overview]
Message-ID: <471485E2.8090301@qumranet.com> (raw)
In-Reply-To: <4713C7A3.4050805-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>

Anthony Liguori wrote:
> Izik Eidus wrote:
>   
>>> That's not quite what I was wondering.
>>>
>>> When you do an madvise() in userspace, the result is that when that 
>>> memory is accessed again, linux will demand-fault in a zero page and 
>>> COW it appropriately.  If we do madvise() on the VA representing 
>>> guest physical memory, what I'm curious about is whether the guest 
>>> will actually see this change.  If the guest happens to have the page 
>>> mapped before we do the madvise(), what triggers KVM to kick any 
>>> shadow page table entries out of it's cache?
>>>
>>> IIUC, today, after the madvise, the guest will have access to the old 
>>> page until that entry gets evicted and reloaded from the shadow page 
>>> table cache.
>>>       
>> ok i am no familier with madvise() so i might talk nonsense but,
>> if the guest have the page mapped before the madvise(), this mean we 
>> have high refernce to it, this is our only protection and as far as i 
>> understand this should be enough
>>     
>
> Right, we will have a reference to the page.  But we want to propagate 
> this change to the guest.   So madvise() may be a bad example.
>
> What if you wanted to do shared memory for multiple guests.  You start 
> out with an anonymous mmap(), and you now what to mmap() a file in 
> /dev/shm to be shared among multiple guests so you mmap(MAP_FIXED) to 
> phys_ram_base + guest_pa in each guest.
>
> So what if guest_pa was in the guest's shadow page cache?  In order for 
> the guest to see the right hpa (the new shared memory), we have to be 
> able to evict guest_pa.  We could do this with something like 
> mmu_unshadow().
>
> What I don't understand, is how we can have something like 
> mmu_unshadow() called automatically when an mmap() is initiated from 
> userspace.  We could just add an ioctl() to do it from userspace but I 
> think it would be nicer if it Just Worked.
>   

Behold the magic of pte notifiers!  Every time the host touches a host 
page table entry, it calls kvm which zaps the corresponding shadow pte 
entries and invalidates any tlb entries in running vcpus.

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


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/

  parent reply	other threads:[~2007-10-16  9:35 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-13  2:06 [PATCH 0/4] Swapping Izik Eidus
     [not found] ` <47102823.2000600-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-10-13 19:48   ` Anthony Liguori
     [not found]     ` <4711210F.40802-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
2007-10-13 20:06       ` Izik Eidus
     [not found]         ` <4711252F.7020505-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-10-13 20:21           ` Izik Eidus
     [not found]             ` <471128B5.5090104-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-10-13 23:17               ` Anthony Liguori
2007-10-14  0:10   ` Anthony Liguori
     [not found]     ` <47115E75.1040203-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
2007-10-14  0:14       ` Anthony Liguori
     [not found]         ` <47115F6A.7080800-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
2007-10-14  6:10           ` Izik Eidus
2007-10-15  9:13   ` Carsten Otte
     [not found]     ` <47132F57.3040703-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
2007-10-15 12:18       ` Izik Eidus
2007-10-15 18:10   ` Anthony Liguori
     [not found]     ` <4713ACF8.6010809-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
2007-10-15 18:21       ` Izik Eidus
     [not found]         ` <4713AF9C.8000609-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-10-15 19:03           ` Anthony Liguori
     [not found]             ` <4713B97F.7090403-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
2007-10-15 19:16               ` Izik Eidus
     [not found]                 ` <4713BCA4.3080103-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-10-15 19:29                   ` Anthony Liguori
     [not found]                     ` <4713BFB3.8060701-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
2007-10-15 19:50                       ` Izik Eidus
     [not found]                         ` <4713C46E.9020107-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-10-15 20:03                           ` Anthony Liguori
     [not found]                             ` <4713C7A3.4050805-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
2007-10-15 20:15                               ` Izik Eidus
2007-10-16  9:35                               ` Avi Kivity [this message]
     [not found]                                 ` <471485E2.8090301-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-10-16 18:29                                   ` Anthony Liguori
     [not found]                                     ` <47150325.3070009-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
2007-10-16 20:01                                       ` Avi Kivity
2007-10-16  7:37                   ` Avi Kivity
2007-10-16  7:38               ` Avi Kivity
2007-10-16  7:36       ` 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=471485E2.8090301@qumranet.com \
    --to=avi-atkuwr5tajbwk0htik3j/w@public.gmane.org \
    --cc=anthony-rdkfGonbjUSkNkDKm+mE6A@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox