Re: file-backed guest memory

Avi Kivity
2007-04-14T14:14:51Z

Christian Borntraeger wrote:
> On Thursday 12 April 2007 17:38, Avi Kivity wrote:
>
>>> But wouldn't it also be possible to create a file in
>>> userspace and pass its descriptor to kvm?
>>>
> [...]
>
>> swap, hugetlbfs, and maybe other nifty stuff. I think I know how to do
>> this for the current mmu, but I'm worried that it will have a
>> performance impact with the nested page tables mmu.
>>
>
> Another thing to consider is the commit "mm: tracking shared dirty pages"
> (d08b3851da41d0ee60851f2c75b118e1f7a5fc89). We need a shared mapping to
> actually have guest memory written back to the file.
> The dirty page tracking change will cause the host kernel to write protect
> guest memory pages after writeback. This will often trigger guest exits due
> to host protection faults. If we want to have file backed guest memory we
> really should modify the VMA to be not eligible for dirty page tracking.
>

Actually the Linux mm does not know about the kvm page tables, and thus
cannot do the write protection. I'm worried that this will confuse it
horribly.

I also think that we should teach the mm how to write protect guest
pages, perhaps less aggressively to account for the large difference in
normal pagefault cost and vmexit pagefault cost. Hopefully this write
protection is throttled when memory is plentiful to avoid a large
performance hit, regardless of whether it's used for a virtual machine
or normal processes.

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

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.