Re: KVM: MMU: only write protect mappings at pagetable level

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

 



On Wed, 2010-12-22 at 09:01 -0200, Marcelo Tosatti wrote:
> If a pagetable contains a writeable large spte, all of its sptes will be
> write protected, including non-leaf ones, leading to endless pagefaults.
> 
> Do not write protect pages above PT_PAGE_TABLE_LEVEL, as the spte fault
> paths assume non-leaf sptes are writable.
> 
> Signed-off-by: Marcelo Tosatti <mtosatti@xxxxxxxxxx>
> 
> diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
> index c3853d5..c716ff8 100644
> --- a/arch/x86/kvm/mmu.c
> +++ b/arch/x86/kvm/mmu.c
> @@ -3442,6 +3442,9 @@ void kvm_mmu_slot_remove_write_access(struct kvm *kvm, int slot)
>  		if (!test_bit(slot, sp->slot_bitmap))
>  			continue;
>  
> +		if (sp->role.level != PT_PAGE_TABLE_LEVEL)
> +			continue;
> +
>  		pt = sp->spt;
>  		for (i = 0; i < PT64_ENT_PER_PAGE; ++i)
>  			/* avoid RMW */

Works for me.

Tested-by: Alex Williamson <alex.williamson@xxxxxxxxxx>

--
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