[patch 5/5] KVM: MMU: pinned sps are not candidates for deletion.

2014-06-18 Thread mtosatti
Skip pinned shadow pages when selecting pages to zap. Signed-off-by: Marcelo Tosatti --- arch/x86/kvm/mmu.c | 26 ++ 1 file changed, 18 insertions(+), 8 deletions(-) Index: kvm/arch/x86/kvm/mmu.c === ---

[patch 3/5] KVM: MMU: notifiers support for pinned sptes

2014-06-18 Thread mtosatti
Request KVM_REQ_MMU_RELOAD when deleting sptes from MMU notifiers. Keep pinned sptes intact if page aging. Signed-off-by: Marcelo Tosatti --- arch/x86/kvm/mmu.c | 71 ++--- 1 file changed, 62 insertions(+), 9 deletions(-) Index: kvm.pinned-spt

[patch 1/5] KVM: x86: add pinned parameter to page_fault methods

2014-06-18 Thread mtosatti
To be used by next patch. Signed-off-by: Marcelo Tosatti --- arch/x86/include/asm/kvm_host.h |2 +- arch/x86/kvm/mmu.c | 11 ++- arch/x86/kvm/paging_tmpl.h |2 +- arch/x86/kvm/x86.c |2 +- 4 files changed, 9 insertions(+), 8 deletions(-) Ind

[patch 2/5] KVM: MMU: allow pinning spte translations (TDP-only)

2014-06-18 Thread mtosatti
Allow vcpus to pin spte translations by: 1) Creating a per-vcpu list of pinned ranges. 2) On mmu reload request: - Fault ranges. - Mark sptes with a pinned bit. - Mark shadow pages as pinned. 3) Then modify the following actions: - Page age => skip spte flush.

[patch 0/5] KVM: support for pinning sptes

2014-06-18 Thread mtosatti
Required by PEBS support as discussed at Subject: [patch 0/5] Implement PEBS virtualization for Silvermont Message-Id: <1401412327-14810-1-git-send-email-a...@firstfloor.org> Thread. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.k

[patch 4/5] KVM: MMU: reload request from GET_DIRTY_LOG path

2014-06-18 Thread mtosatti
Reload remote vcpus MMU from GET_DIRTY_LOG codepath, before deleting a pinned spte. Signed-off-by: Marcelo Tosatti --- arch/x86/kvm/mmu.c |3 +++ 1 file changed, 3 insertions(+) Index: kvm.pinned-sptes/arch/x86/kvm/mmu.c === -

[patch 0/4] KVM: support for pinning sptes (v2)

2014-07-09 Thread mtosatti
Required by PEBS support as discussed at Subject: [patch 0/4] [patch 0/5] Implement PEBS virtualization for Silvermont Message-Id: <1401412327-14810-1-git-send-email-a...@firstfloor.org> Thread. -- v2: - unify remote kick function (Gleb) - keep sptes

[patch 2/4] KVM: MMU: allow pinning spte translations (TDP-only)

2014-07-09 Thread mtosatti
Allow vcpus to pin spte translations by: 1) Creating a per-vcpu list of pinned ranges. 2) On mmu reload request: - Fault ranges. - Mark sptes with a pinned bit. - Mark shadow pages as pinned. 3) Then modify the following actions: - Page age => skip spte flush.

[patch 4/4] KVM: MMU: pinned sps are not candidates for deletion.

2014-07-09 Thread mtosatti
Skip pinned shadow pages when selecting pages to zap. Signed-off-by: Marcelo Tosatti --- arch/x86/kvm/mmu.c | 26 ++ 1 file changed, 18 insertions(+), 8 deletions(-) Index: kvm.pinned-sptes/arch/x86/kvm/mmu.c ===

[patch 1/4] KVM: x86: add pinned parameter to page_fault methods

2014-07-09 Thread mtosatti
To be used by next patch. Signed-off-by: Marcelo Tosatti --- arch/x86/include/asm/kvm_host.h |2 +- arch/x86/kvm/mmu.c | 11 ++- arch/x86/kvm/paging_tmpl.h |2 +- arch/x86/kvm/x86.c |2 +- 4 files changed, 9 insertions(+), 8 deletions(-) Ind

[patch 3/4] KVM: MMU: reload request from GET_DIRTY_LOG path

2014-07-09 Thread mtosatti
Reload remote vcpus MMU from GET_DIRTY_LOG codepath, before deleting a pinned spte. Signed-off-by: Marcelo Tosatti --- arch/x86/kvm/mmu.c | 29 +++-- 1 file changed, 23 insertions(+), 6 deletions(-) Index: kvm.pinned-sptes/arch/x86/kvm/mmu.c ==

[patch 1/4] KVM: MMU: protect kvm_mmu_change_mmu_pages with mmu_lock

2009-04-27 Thread mtosatti
kvm_handle_hva, called by MMU notifiers, manipulates mmu data only with the protection of mmu_lock. Update kvm_mmu_change_mmu_pages callers to take mmu_lock, thus protecting against kvm_handle_hva. CC: Andrea Arcangeli Signed-off-by: Marcelo Tosatti Index: kvm/arch/x86/kvm/mmu.c ==

[patch 4/4] KVM: x86: disallow changing a slots size

2009-04-27 Thread mtosatti
Support to shrinking aliases complicates kernel code unnecessarily, while userspace can do the same with two operations, delete an alias, and create a new alias. Signed-off-by: Marcelo Tosatti Index: kvm/arch/x86/kvm/x86.c === --- k

[patch 2/4] KVM: take mmu_lock when updating a deleted slot

2009-04-27 Thread mtosatti
kvm_handle_hva relies on mmu_lock protection to safely access the memslot structures. Signed-off-by: Marcelo Tosatti Index: kvm/virt/kvm/kvm_main.c === --- kvm.orig/virt/kvm/kvm_main.c +++ kvm/virt/kvm/kvm_main.c @@ -1199,8 +1199,1

[patch 0/4] set_memory_region locking fixes / vcpu->arch.cr3 + removal of memslots

2009-04-27 Thread mtosatti
-- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

[patch 3/4] KVM: introduce kvm_arch_can_free_memslot, disallow slot deletion if cached cr3

2009-04-27 Thread mtosatti
Disallow the deletion of memory slots (and aliases, for x86 case), if a vcpu contains a cr3 that points to such slot/alias. This complements commit 6c20e1442bb1c62914bb85b7f4a38973d2a423ba. Signed-off-by: Marcelo Tosatti Index: kvm/arch/ia64/kvm/kvm-ia64.c ==

[patch 0/4] use smp_send_reschedule in vcpu_kick / assigned dev host intx race fix

2009-04-27 Thread mtosatti
-- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

[patch 1/4] qemu: external module: smp_send_reschedule compat

2009-04-27 Thread mtosatti
smp_send_reschedule was exported (via smp_ops) in v2.6.24. Create a compat function which schedules the IPI to keventd context, in case interrupts are disabled, for kernels < 2.6.24. Signed-off-by: Marcelo Tosatti diff --git a/kvm/kernel/external-module-compat-comm.h b/kvm/kernel/external-modu

[patch 3/4] KVM: use smp_send_reschedule in kvm_vcpu_kick

2009-04-27 Thread mtosatti
KVM uses a function call IPI to cause the exit of a guest running on a physical cpu. For virtual interrupt notification there is no need to wait on IPI receival, or to execute any function. This is exactly what the reschedule IPI does, without the overhead of function IPI. So use it instead of smp

[patch 4/4] KVM: protect assigned dev workqueue, int handler and irq acker

2009-04-27 Thread mtosatti
kvm_assigned_dev_ack_irq is vulnerable to a race condition with the interrupt handler function. It does: if (dev->host_irq_disabled) { enable_irq(dev->host_irq); dev->host_irq_disabled = false; } If an interrupt triggers before the host->dev_irq_dis

[patch 2/4] KVM: x86: wake up waitqueue before calling get_cpu()

2009-04-27 Thread mtosatti
From: Jan Blunck This moves the get_cpu() call down to be called after we wake up the waiters. Therefore the waitqueue locks can savely be rt mutex. Signed-off-by: Jan Blunck Signed-off-by: Sven-Thorsten Dietrich Signed-off-by: Marcelo Tosatti Index: kvm/arch/x86/kvm/x86.c

[patch 1/4] KVM: MMU: protect kvm_mmu_change_mmu_pages with mmu_lock

2009-05-07 Thread mtosatti
kvm_handle_hva, called by MMU notifiers, manipulates mmu data only with the protection of mmu_lock. Update kvm_mmu_change_mmu_pages callers to take mmu_lock, thus protecting against kvm_handle_hva. CC: Andrea Arcangeli Signed-off-by: Marcelo Tosatti Index: kvm-pending/arch/x86/kvm/mmu.c ==

[patch 2/4] KVM: take mmu_lock when updating a deleted slot

2009-05-07 Thread mtosatti
kvm_handle_hva relies on mmu_lock protection to safely access the memslot structures. Signed-off-by: Marcelo Tosatti Index: kvm-pending/virt/kvm/kvm_main.c === --- kvm-pending.orig/virt/kvm/kvm_main.c +++ kvm-pending/virt/kvm/kvm_m

[patch 1/4] kvm-kmod: nr_cpu_ids compat

2009-05-07 Thread mtosatti
Signed-off-by: Marcelo Tosatti Index: kvm-kmod/external-module-compat-comm.h === --- kvm-kmod.orig/external-module-compat-comm.h +++ kvm-kmod/external-module-compat-comm.h @@ -116,6 +116,10 @@ int kvm_smp_call_function_single(int cpu

[patch 0/4] set_memory_region locking fixes / cr3 vs removal of memslots v2

2009-05-07 Thread mtosatti
Addressing comments. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

[patch 4/4] KVM: protect assigned dev workqueue, int handler and irq acker

2009-05-07 Thread mtosatti
kvm_assigned_dev_ack_irq is vulnerable to a race condition with the interrupt handler function. It does: if (dev->host_irq_disabled) { enable_irq(dev->host_irq); dev->host_irq_disabled = false; } If an interrupt triggers before the host->dev_irq_dis

[patch 4/4] KVM: x86: disallow changing a slots size

2009-05-07 Thread mtosatti
Support to shrinking aliases complicates kernel code unnecessarily, while userspace can do the same with two operations, delete an alias, and create a new alias. Signed-off-by: Marcelo Tosatti Index: kvm-pending/arch/x86/kvm/x86.c =

[patch 0/4] smp_send_reschedule / assigned dev host intx race v2

2009-05-07 Thread mtosatti
Addressing comments. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

[patch 2/4] kvm-kmod: smp_send_reschedule compat

2009-05-07 Thread mtosatti
smp_send_reschedule was exported (via smp_ops) in v2.6.24. Create a compat function which schedules the IPI to keventd context, in case interrupts are disabled, for kernels < 2.6.24. Signed-off-by: Marcelo Tosatti Index: kvm-kmod/ia64/hack-module.awk =

[patch 3/4] KVM: use smp_send_reschedule in kvm_vcpu_kick

2009-05-07 Thread mtosatti
KVM uses a function call IPI to cause the exit of a guest running on a physical cpu. For virtual interrupt notification there is no need to wait on IPI receival, or to execute any function. This is exactly what the reschedule IPI does, without the overhead of function IPI. So use it instead of smp

[patch 3/4] KVM: introduce kvm_arch_can_free_memslot, disallow slot deletion if cached cr3

2009-05-07 Thread mtosatti
Disallow the deletion of memory slots (and aliases, for x86 case), if a vcpu contains a cr3 that points to such slot/alias. This complements commit 6c20e1442bb1c62914bb85b7f4a38973d2a423ba. v2: - set KVM_REQ_TRIPLE_FAULT - use __KVM_HAVE_ARCH_CAN_FREE_MEMSLOT to avoid duplication of stub Signed-

[patch 2/3] KVM: take mmu_lock when updating a deleted slot

2009-05-12 Thread mtosatti
kvm_handle_hva relies on mmu_lock protection to safely access the memslot structures. Signed-off-by: Marcelo Tosatti Index: kvm-pending/virt/kvm/kvm_main.c === --- kvm-pending.orig/virt/kvm/kvm_main.c +++ kvm-pending/virt/kvm/kvm_m

[patch 1/3] KVM: MMU: protect kvm_mmu_change_mmu_pages with mmu_lock

2009-05-12 Thread mtosatti
kvm_handle_hva, called by MMU notifiers, manipulates mmu data only with the protection of mmu_lock. Update kvm_mmu_change_mmu_pages callers to take mmu_lock, thus protecting against kvm_handle_hva. Signed-off-by: Marcelo Tosatti Index: kvm-pending/arch/x86/kvm/mmu.c

[patch 0/3] locking fixes / cr3 validation v3

2009-05-12 Thread mtosatti
Addressing comments. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

[patch 3/3] KVM: x86: check for cr3 validity in mmu_alloc_roots

2009-05-12 Thread mtosatti
Verify the cr3 address stored in vcpu->arch.cr3 points to an existant memslot. If not, inject a triple fault. Signed-off-by: Marcelo Tosatti Index: kvm/arch/x86/kvm/mmu.c === --- kvm.orig/arch/x86/kvm/mmu.c +++ kvm/arch/x86/kvm/mmu.