Re: [PATCH v8 13/15] ARM: KVM: Handle guest faults in KVM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 19, 2012 at 6:41 AM, Andrea Arcangeli <aarcange@xxxxxxxxxx> wrote:
> On Tue, Jun 19, 2012 at 12:32:06PM +0300, Avi Kivity wrote:
>> On 06/19/2012 01:20 AM, Christoffer Dall wrote:
>> > On Mon, Jun 18, 2012 at 9:45 AM, Avi Kivity <avi@xxxxxxxxxx> wrote:
>> >> On 06/15/2012 10:09 PM, Christoffer Dall wrote:
>> >>> From: Christoffer Dall <cdall@xxxxxxxxxxxxxxx>
>> >>>
>> >>> Handles the guest faults in KVM by mapping in corresponding user pages
>> >>> in the 2nd stage page tables.
>> >>>
>> >>> Introduces new ARM-specific kernel memory types, PAGE_KVM_GUEST and
>> >>> pgprot_guest variables used to map 2nd stage memory for KVM guests.
>> >>>
>> >>> Leverages MMU notifiers on KVM/ARM by supporting the kvm_unmap_hva() operation,
>> >>> where we remove the HVA from the 2nd stage translation. All other KVM MMU
>> >>> notifierhooks are NOPs.
>> >>
>> >> I think you must at least support change_pte (possibly by unmapping).
>> >> Andrea?
>> >>
>> > hmmm, at least for KSM support we need to support change_pte (are
>> > there other callers for this type of memory?)
>> >
>> > It's not trivial I guess, since we would need to support COW and
>> > thereby stage-2 permission faults... Marc, right?
>>
>> As I mentioned, you can support change_pte by unmapping.  This will
>> cause ksm to be ineffective (pages will only be shared if the guest
>> doesn't touch them at all), but it's enough to get started.
>
> The main reason change_pte initially was required for KSM to be
> effective was because gup_fast was called with write=1
> unconditionally. change_pte was also responsible to set the spte
> readonly. But that should have been fixed now on x86, so KSM should be
> effective even despite lack of change_pte on x86.
>
> If the KVM page fault is calling gfn_to_pfn_async(write=0/1) depending
> if the vmexit was caused by a write or read access (instead of
> gfn_to_pfn which still has the unconditional write=1), and in turn
> it's forced to sete the spte readonly after calling
> gfn_to_pfn_async(write=0), change_pte is still useful but it's only a
> worthwhile optimization to avoid a spte read fault after every KSM
> page merged, it's not strictly required for KSM effectiveness anymore.
>
> In short if ARM does the right thing with regard of KVM read faults
> passed to gup_fast(write=0) and setting the spte readonly, all should
> work good with KSM (even if not as optimal as with change_pte).

ah, we don't do things right, we use gfn_to_pfn() flat out and will
always break the COW :)

I guess now, when change_pte is a nop, it's outright incorrect if
anyone runs KSM.

This has just been added to my todo-list.

-Christoffer
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux