Re: [PATCH v14 0/7] KVM/arm/x86: dirty page logging for ARMv7 (3.17.0-rc1)

2014-11-14 Thread Cornelia Huck
On Thu, 13 Nov 2014 17:57:41 -0800 Mario Smarduch m.smard...@samsung.com wrote: Patch series adds support for ARMv7 and generic dirty page logging support. As we try to move towards generic dirty page logging additional logic is moved to generic code. Initially x86, armv7 KVM_GET_DIRTY_LOG

[RFC][PATCH 1/2] kvm: x86: mmu: return zero if s e in rsvd_bits()

2014-11-14 Thread Tiejun Chen
In some real scenarios 'start' may not be less than 'end' like maxphyaddr = 52. Signed-off-by: Tiejun Chen tiejun.c...@intel.com --- arch/x86/kvm/mmu.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h index bde8ee7..0e98b5e 100644 ---

[RFC][PATCH 2/2] kvm: x86: mmio: fix setting the present bit of mmio spte

2014-11-14 Thread Tiejun Chen
In PAE case maxphyaddr may be 52bit as well, we also need to disable mmio page fault. Here we can check MMIO_SPTE_GEN_HIGH_SHIFT directly to determine if we should set the present bit, and bring a little cleanup. Signed-off-by: Tiejun Chen tiejun.c...@intel.com ---

Re: [PATCH v2] kvm: memslots: replace heap sort with insertion sort

2014-11-14 Thread Paolo Bonzini
On 14/11/2014 00:00, Igor Mammedov wrote: memslots is a sorted array, when slot changes in it with current heapsort it would take O(n log n) time to update array, while using insertion sort like algorithm on array with 1 item out of order will take only O(n) time. Replace current

Re: [PATCH v14 3/7] KVM: x86: switch to kvm_get_dirty_log_protect

2014-11-14 Thread Paolo Bonzini
On 14/11/2014 03:06, Mario Smarduch wrote: Hi Paolo, I changed your patch a little to use a Kconfig symbol, hope that's fine with you. Of course, thanks. Paolo - Mario On 11/13/2014 05:57 PM, Mario Smarduch wrote: From: Paolo Bonzini pbonz...@redhat.com We now have a generic

Re: [RFC][PATCH 1/2] kvm: x86: mmu: return zero if s e in rsvd_bits()

2014-11-14 Thread Paolo Bonzini
On 14/11/2014 10:31, Tiejun Chen wrote: In some real scenarios 'start' may not be less than 'end' like maxphyaddr = 52. Signed-off-by: Tiejun Chen tiejun.c...@intel.com --- arch/x86/kvm/mmu.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h

Re: [RFC][PATCH 2/2] kvm: x86: mmio: fix setting the present bit of mmio spte

2014-11-14 Thread Paolo Bonzini
On 14/11/2014 10:31, Tiejun Chen wrote: In PAE case maxphyaddr may be 52bit as well, we also need to disable mmio page fault. Here we can check MMIO_SPTE_GEN_HIGH_SHIFT directly to determine if we should set the present bit, and bring a little cleanup. Signed-off-by: Tiejun Chen

Re: [PATCH] KVM: PPC: Book3S HV: Tracepoints for KVM HV guest interactions

2014-11-14 Thread Alexander Graf
Am 14.11.2014 um 00:29 schrieb Suresh E. Warrier warr...@linux.vnet.ibm.com: This patch adds trace points in the guest entry and exit code and also for exceptions handled by the host in kernel mode - hypercalls and page faults. The new events are added to /sys/kernel/debug/tracing/events

Re: [PATCH v2] kvm: memslots: replace heap sort with insertion sort

2014-11-14 Thread Igor Mammedov
On Fri, 14 Nov 2014 10:57:10 +0100 Paolo Bonzini pbonz...@redhat.com wrote: On 14/11/2014 00:00, Igor Mammedov wrote: memslots is a sorted array, when slot changes in it with current heapsort it would take O(n log n) time to update array, while using insertion sort like algorithm on

[PATCH 3/3] kvm: simplify update_memslots invocation

2014-11-14 Thread Paolo Bonzini
The update_memslots invocation is only needed in one case. Make the code clearer by moving it to __kvm_set_memory_region, and removing the wrapper around insert_memslot. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- virt/kvm/kvm_main.c | 20 ++-- 1 file changed, 6

[PATCH 1/3] kvm: memslots: track id_to_index changes during the insertion sort

2014-11-14 Thread Paolo Bonzini
This completes the optimization from the previous patch, by removing the KVM_MEM_SLOTS_NUM-iteration loop from insert_memslot. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- virt/kvm/kvm_main.c | 39 +++ 1 file changed, 19 insertions(+), 20 deletions(-)

[PATCH 2/3] kvm: commonize allocation of the new memory slots

2014-11-14 Thread Paolo Bonzini
The two kmemdup invocations can be unified. I find that the new placement of the comment makes it easier to see what happens. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- virt/kvm/kvm_main.c | 28 +++- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git

[PATCH 0/3] KVM: simplification to the memslots code

2014-11-14 Thread Paolo Bonzini
Hi Igor and Takuya, here are a few small patches that simplify __kvm_set_memory_region and associated code. Can you please review them? Thanks, Paolo Paolo Bonzini (3): kvm: memslots: track id_to_index changes during the insertion sort kvm: commonize allocation of the new memory slots

Re: [PATCH 1/3] kvm: memslots: track id_to_index changes during the insertion sort

2014-11-14 Thread Igor Mammedov
On Fri, 14 Nov 2014 12:12:00 +0100 Paolo Bonzini pbonz...@redhat.com wrote: This completes the optimization from the previous patch, by removing the KVM_MEM_SLOTS_NUM-iteration loop from insert_memslot. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- virt/kvm/kvm_main.c | 39

Re: [PATCH 1/3] kvm: memslots: track id_to_index changes during the insertion sort

2014-11-14 Thread Radim Krčmář
2014-11-14 12:12+0100, Paolo Bonzini: This completes the optimization from the previous patch, by removing the KVM_MEM_SLOTS_NUM-iteration loop from insert_memslot. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- virt/kvm/kvm_main.c | 39 +++ 1

Re: [PATCH] virt: kvm: arm: vgic: Process the failure case when kvm_register_device_ops() fails

2014-11-14 Thread Chen Gang
On 11/13/2014 11:30 PM, Marc Zyngier wrote: On 13/11/14 15:04, Chen Gang wrote: When kvm_register_device_ops() fails, also need call free_percpu_irq() just like others have down within kvm_vgic_hyp_init(). Signed-off-by: Chen Gang gang.chen.5...@gmail.com --- virt/kvm/arm/vgic.c | 10

Re: [PATCH] virt: kvm: arm: vgic: Process the failure case when kvm_register_device_ops() fails

2014-11-14 Thread Chen Gang
On 11/13/2014 11:30 PM, Marc Zyngier wrote: On 13/11/14 15:04, Chen Gang wrote: When kvm_register_device_ops() fails, also need call free_percpu_irq() just like others have down within kvm_vgic_hyp_init(). Signed-off-by: Chen Gang gang.chen.5...@gmail.com --- virt/kvm/arm/vgic.c | 10

Re: [PATCH] kvm: x86: increase user memory slots to 509

2014-11-14 Thread Igor Mammedov
On Thu, 06 Nov 2014 17:23:58 +0100 Paolo Bonzini pbonz...@redhat.com wrote: On 06/11/2014 16:52, Igor Mammedov wrote: With the 3 private slots, this gives us 512 slots total. Motivation for this is in addition to assigned devices support more memory hotplug slots, where 1 slot is

Re: [PATCH] virt: kvm: arm: vgic: Process the failure case when kvm_register_device_ops() fails

2014-11-14 Thread Marc Zyngier
On 14/11/14 14:05, Chen Gang wrote: On 11/13/2014 11:30 PM, Marc Zyngier wrote: On 13/11/14 15:04, Chen Gang wrote: When kvm_register_device_ops() fails, also need call free_percpu_irq() just like others have down within kvm_vgic_hyp_init(). Signed-off-by: Chen Gang gang.chen.5...@gmail.com

Re: [PATCH 1/3] kvm: memslots: track id_to_index changes during the insertion sort

2014-11-14 Thread Igor Mammedov
On Fri, 14 Nov 2014 14:35:00 +0100 Radim Krčmář rkrc...@redhat.com wrote: 2014-11-14 12:12+0100, Paolo Bonzini: This completes the optimization from the previous patch, by removing the KVM_MEM_SLOTS_NUM-iteration loop from insert_memslot. Signed-off-by: Paolo Bonzini pbonz...@redhat.com

Re: [PATCH 2/3] kvm: commonize allocation of the new memory slots

2014-11-14 Thread Igor Mammedov
On Fri, 14 Nov 2014 12:12:01 +0100 Paolo Bonzini pbonz...@redhat.com wrote: The two kmemdup invocations can be unified. I find that the new placement of the comment makes it easier to see what happens. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- virt/kvm/kvm_main.c | 28

Re: [PATCH 3/3] kvm: simplify update_memslots invocation

2014-11-14 Thread Igor Mammedov
On Fri, 14 Nov 2014 12:12:02 +0100 Paolo Bonzini pbonz...@redhat.com wrote: The update_memslots invocation is only needed in one case. Make the code clearer by moving it to __kvm_set_memory_region, and removing the wrapper around insert_memslot. Signed-off-by: Paolo Bonzini

Re: [PATCH] virt: kvm: arm: vgic: Process the failure case when kvm_register_device_ops() fails

2014-11-14 Thread Chen Gang
On 11/14/2014 10:09 PM, Marc Zyngier wrote: On 14/11/14 14:05, Chen Gang wrote: On 11/13/2014 11:30 PM, Marc Zyngier wrote: On 13/11/14 15:04, Chen Gang wrote: When kvm_register_device_ops() fails, also need call free_percpu_irq() just like others have down within kvm_vgic_hyp_init().

Re: [PATCH 1/3] kvm: memslots: track id_to_index changes during the insertion sort

2014-11-14 Thread Paolo Bonzini
On 14/11/2014 14:35, Radim Krčmář wrote: We are replacing in a sorted array, so the the direction of our traversal doesn't change, (and we could lose one tab level here,) if (new-npages mslots[i].npages) { while (i (KVM_MEM_SLOTS_NUM - 1)

Re: [PATCH 1/3] kvm: memslots: track id_to_index changes during the insertion sort

2014-11-14 Thread Radim Krčmář
2014-11-14 15:17+0100, Igor Mammedov: (We'll have to change it into an interval tree, or something, if the number of slots rises anyway.) Only if it rises to huge amount, I've played with proposed 512 memslots and it takes ~1 cycles which is 5% of current heapsort overhead. Taking in

Re: [PATCH 1/3] kvm: memslots: track id_to_index changes during the insertion sort

2014-11-14 Thread Paolo Bonzini
On 14/11/2014 15:41, Radim Krčmář wrote: Yes, your improvement is great and would work even for higher amounts. I meant that our lookup is currently pretty sad -- O(N) that is presumably optimized by looking at the largest regions first. Yes, that's the optimization. Maybe we would

Re: [PATCH 1/3] kvm: memslots: track id_to_index changes during the insertion sort

2014-11-14 Thread Radim Krčmář
2014-11-14 15:29+0100, Paolo Bonzini: On 14/11/2014 14:35, Radim Krčmář wrote: We are replacing in a sorted array, so the the direction of our traversal doesn't change, (and we could lose one tab level here,) if (new-npages mslots[i].npages) { while (i

Re: [PATCH] kvm: x86: increase user memory slots to 509

2014-11-14 Thread Paolo Bonzini
On 14/11/2014 15:10, Igor Mammedov wrote: On Thu, 06 Nov 2014 17:23:58 +0100 Paolo Bonzini pbonz...@redhat.com wrote: It would use more memory, and some loops are now becoming more expensive. In general adding a memory slot to a VM is not cheap, and I question the wisdom of having 256 hotplug

Re: [PATCH] virt: kvm: arm: vgic: Process the failure case when kvm_register_device_ops() fails

2014-11-14 Thread Marc Zyngier
On 14/11/14 14:27, Chen Gang wrote: On 11/14/2014 10:09 PM, Marc Zyngier wrote: On 14/11/14 14:05, Chen Gang wrote: On 11/13/2014 11:30 PM, Marc Zyngier wrote: On 13/11/14 15:04, Chen Gang wrote: When kvm_register_device_ops() fails, also need call free_percpu_irq() just like others have

Re: [PATCH 14/21] KVM: x86: Software disabled APIC should still deliver NMIs

2014-11-14 Thread Paolo Bonzini
On 06/11/2014 17:45, Radim Krčmář wrote: 2014-11-06 10:34+0100, Paolo Bonzini: On 05/11/2014 21:45, Nadav Amit wrote: If I understand the SDM correctly, in such scenario (all APICs are software disabled) the mode is left as the default - flat mode (see APIC doesn't have any global mode

[PATCH v2] virt: kvm: arm: vgic: Process the failure case when kvm_register_device_ops() fails

2014-11-14 Thread Chen Gang
When kvm_register_device_ops() fails, need disable_percpu_irq(), need vgic_arch_unsetup(), need __unregister_cpu_notifier(), and also need free_percpu_irq(). At present, there is no vgic_arch_unsetup(), so add it for resetting '__vgic_sr_vectors'. Signed-off-by: Chen Gang

Re: [PATCH] virt: kvm: arm: vgic: Process the failure case when kvm_register_device_ops() fails

2014-11-14 Thread Chen Gang
On 11/14/2014 10:53 PM, Marc Zyngier wrote: On 14/11/14 14:27, Chen Gang wrote: On 11/14/2014 10:09 PM, Marc Zyngier wrote: On 14/11/14 14:05, Chen Gang wrote: On 11/13/2014 11:30 PM, Marc Zyngier wrote: On 13/11/14 15:04, Chen Gang wrote: When kvm_register_device_ops() fails, also need call

Re: [PATCH v2] virt: kvm: arm: vgic: Process the failure case when kvm_register_device_ops() fails

2014-11-14 Thread Marc Zyngier
On 14/11/14 15:18, Chen Gang wrote: When kvm_register_device_ops() fails, need disable_percpu_irq(), need vgic_arch_unsetup(), need __unregister_cpu_notifier(), and also need free_percpu_irq(). At present, there is no vgic_arch_unsetup(), so add it for resetting '__vgic_sr_vectors'.

Re: [PATCH v2] virt: kvm: arm: vgic: Process the failure case when kvm_register_device_ops() fails

2014-11-14 Thread Chen Gang
According to your taste, we need improve 2 contents below: On 11/14/2014 11:55 PM, Marc Zyngier wrote: No. This is completely overdesigned, and fixes something that really cannot happen. What is wrong with: diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c index 3aaca49..b7dffa80

Re: [PATCH v14 7/7] KVM: arm: page logging 2nd stage fault handling

2014-11-14 Thread Marc Zyngier
Hi Mario, On 14/11/14 01:57, Mario Smarduch wrote: This patch adds support for handling 2nd stage page faults during migration, it disables faulting in huge pages, and dissolves huge pages to page tables. In case migration is canceled huge pages are used again. Reviewed-by: Christoffer Dall

Re: KVM: x86: add module parameter to disable periodic kvmclock sync

2014-11-14 Thread Marcelo Tosatti
On Thu, Nov 13, 2014 at 09:40:41AM +0100, Andrew Jones wrote: On Thu, Nov 13, 2014 at 12:44:39AM -0200, Marcelo Tosatti wrote: The periodic kvmclock sync can be an undesired source of latencies. Signed-off-by: Marcelo Tosatti mtosa...@redhat.com diff --git a/arch/x86/kvm/x86.c

Re: [PATCH v14 7/7] KVM: arm: page logging 2nd stage fault handling

2014-11-14 Thread Mario Smarduch
On 11/14/2014 08:45 AM, Marc Zyngier wrote: Hi Mario, On 14/11/14 01:57, Mario Smarduch wrote: This patch adds support for handling 2nd stage page faults during migration, it disables faulting in huge pages, and dissolves huge pages to page tables. In case migration is canceled huge pages

Re: [PATCH v14 0/7] KVM/arm/x86: dirty page logging for ARMv7 (3.17.0-rc1)

2014-11-14 Thread Mario Smarduch
On 11/14/2014 12:06 AM, Cornelia Huck wrote: On Thu, 13 Nov 2014 17:57:41 -0800 Mario Smarduch m.smard...@samsung.com wrote: Patch series adds support for ARMv7 and generic dirty page logging support. As we try to move towards generic dirty page logging additional logic is moved to

[RESEND PATCH v14 7/7] KVM: arm: page logging 2nd stage fault handling

2014-11-14 Thread Mario Smarduch
This patch adds support for handling 2nd stage page faults during migration, it disables faulting in huge pages, and dissolves huge pages to page tables. In case migration is canceled huge pages are used again. Resending to addresse Marc's comments to simplify stage2_set_pte() handling of

Re: [PATCH v14 0/7] KVM/arm/x86: dirty page logging for ARMv7 (3.17.0-rc1)

2014-11-14 Thread Cornelia Huck
On Thu, 13 Nov 2014 17:57:41 -0800 Mario Smarduch m.smard...@samsung.com wrote: Patch series adds support for ARMv7 and generic dirty page logging support. As we try to move towards generic dirty page logging additional logic is moved to generic code. Initially x86, armv7 KVM_GET_DIRTY_LOG

Re: [PATCH v14 3/7] KVM: x86: switch to kvm_get_dirty_log_protect

2014-11-14 Thread Paolo Bonzini
On 14/11/2014 03:06, Mario Smarduch wrote: Hi Paolo, I changed your patch a little to use a Kconfig symbol, hope that's fine with you. Of course, thanks. Paolo - Mario On 11/13/2014 05:57 PM, Mario Smarduch wrote: From: Paolo Bonzini pbonz...@redhat.com We now have a generic

Re: [PATCH] KVM: PPC: Book3S HV: Tracepoints for KVM HV guest interactions

2014-11-14 Thread Alexander Graf
Am 14.11.2014 um 00:29 schrieb Suresh E. Warrier warr...@linux.vnet.ibm.com: This patch adds trace points in the guest entry and exit code and also for exceptions handled by the host in kernel mode - hypercalls and page faults. The new events are added to /sys/kernel/debug/tracing/events

Re: [PATCH v14 7/7] KVM: arm: page logging 2nd stage fault handling

2014-11-14 Thread Marc Zyngier
Hi Mario, On 14/11/14 01:57, Mario Smarduch wrote: This patch adds support for handling 2nd stage page faults during migration, it disables faulting in huge pages, and dissolves huge pages to page tables. In case migration is canceled huge pages are used again. Reviewed-by: Christoffer Dall

Re: [PATCH v14 7/7] KVM: arm: page logging 2nd stage fault handling

2014-11-14 Thread Mario Smarduch
On 11/14/2014 08:45 AM, Marc Zyngier wrote: Hi Mario, On 14/11/14 01:57, Mario Smarduch wrote: This patch adds support for handling 2nd stage page faults during migration, it disables faulting in huge pages, and dissolves huge pages to page tables. In case migration is canceled huge pages

Re: [PATCH v14 0/7] KVM/arm/x86: dirty page logging for ARMv7 (3.17.0-rc1)

2014-11-14 Thread Mario Smarduch
On 11/14/2014 12:06 AM, Cornelia Huck wrote: On Thu, 13 Nov 2014 17:57:41 -0800 Mario Smarduch m.smard...@samsung.com wrote: Patch series adds support for ARMv7 and generic dirty page logging support. As we try to move towards generic dirty page logging additional logic is moved to