Re: [PATCH 4/4] kvm, mem-hotplug: Update apic access page when it is migrated.

2014-07-08 Thread Nadav Amit
Tang, I am sorry if I caused any confusion. Following Gleb response, there is no apparent need for dealing with the scenario I mentioned (relocating the APIC base), so you don't need to do any changes to your patch, and I will post another patch later to warn if the guest relocates its APIC

Re: [PATCH 4/4] kvm, mem-hotplug: Update apic access page when it is migrated.

2014-07-08 Thread Tang Chen
Hi Wanpeng, On 07/07/2014 06:35 PM, Wanpeng Li wrote: On Wed, Jul 02, 2014 at 05:00:37PM +0800, Tang Chen wrote: apic access page is pinned in memory, and as a result it cannot be migrated/hot-removed. Actually it doesn't need to be pinned in memory. This patch introduces a new vcpu request:

Re: [PATCH 4/4] kvm, mem-hotplug: Update apic access page when it is migrated.

2014-07-07 Thread Tang Chen
Hi Gleb, Thanks for all the advices. Please see below. On 07/04/2014 06:13 PM, Gleb Natapov wrote: .. +static void vmx_set_apic_access_page_addr(struct kvm *kvm, hpa_t hpa) +{ + if (vm_need_virtualize_apic_accesses(kvm)) This shouldn't even been called if apic access page is not

Re: [PATCH 4/4] kvm, mem-hotplug: Update apic access page when it is migrated.

2014-07-07 Thread Tang Chen
Hi Gleb, The guest hang problem has been solved. When mmu_notifier is called, I set VMCS APIC_ACCESS_ADDR to the new value instead of setting it to 0. And only update kvm-arch.apic_access_page in the next ept violation. The guest is running well now. I'll post the new patches tomorrow. ;)

Re: [PATCH 4/4] kvm, mem-hotplug: Update apic access page when it is migrated.

2014-07-07 Thread Wanpeng Li
On Wed, Jul 02, 2014 at 05:00:37PM +0800, Tang Chen wrote: apic access page is pinned in memory, and as a result it cannot be migrated/hot-removed. Actually it doesn't need to be pinned in memory. This patch introduces a new vcpu request: KVM_REQ_MIGRATE_EPT. This requet

Re: [PATCH 4/4] kvm, mem-hotplug: Update apic access page when it is migrated.

2014-07-07 Thread Nadav Amit
Tang, Running some (unrelated) tests I see that KVM does not handle APIC base relocation correctly. When the base is changed, kvm_lapic_set_base just changes lapic-base_address without taking further action (i.e., modifying the VMCS apic address in VMX). This patch follows KVM bad behavior

Re: [PATCH 4/4] kvm, mem-hotplug: Update apic access page when it is migrated.

2014-07-07 Thread Gleb Natapov
On Mon, Jul 07, 2014 at 02:42:27PM +0300, Nadav Amit wrote: Tang, Running some (unrelated) tests I see that KVM does not handle APIC base relocation correctly. When the base is changed, kvm_lapic_set_base just changes lapic-base_address without taking further action (i.e., modifying the

Re: [PATCH 4/4] kvm, mem-hotplug: Update apic access page when it is migrated.

2014-07-07 Thread Nadav Amit
On 7/7/14, 2:54 PM, Gleb Natapov wrote: On Mon, Jul 07, 2014 at 02:42:27PM +0300, Nadav Amit wrote: Tang, Running some (unrelated) tests I see that KVM does not handle APIC base relocation correctly. When the base is changed, kvm_lapic_set_base just changes lapic-base_address without taking

Re: [PATCH 4/4] kvm, mem-hotplug: Update apic access page when it is migrated.

2014-07-07 Thread Gleb Natapov
On Mon, Jul 07, 2014 at 03:10:23PM +0300, Nadav Amit wrote: On 7/7/14, 2:54 PM, Gleb Natapov wrote: On Mon, Jul 07, 2014 at 02:42:27PM +0300, Nadav Amit wrote: Tang, Running some (unrelated) tests I see that KVM does not handle APIC base relocation correctly. When the base is changed,

Re: [PATCH 4/4] kvm, mem-hotplug: Update apic access page when it is migrated.

2014-07-07 Thread Tang Chen
Hi Nadav, Thanks for the reply, please see below. On 07/07/2014 08:10 PM, Nadav Amit wrote: On 7/7/14, 2:54 PM, Gleb Natapov wrote: On Mon, Jul 07, 2014 at 02:42:27PM +0300, Nadav Amit wrote: Tang, Running some (unrelated) tests I see that KVM does not handle APIC base relocation correctly.

Re: [PATCH 4/4] kvm, mem-hotplug: Update apic access page when it is migrated.

2014-07-04 Thread Gleb Natapov
On Fri, Jul 04, 2014 at 10:18:25AM +0800, Tang Chen wrote: Hi Gleb, Thanks for the advices. Please see below. On 07/03/2014 09:55 PM, Gleb Natapov wrote: .. @@ -575,6 +575,7 @@ struct kvm_arch { unsigned int tss_addr; struct page *apic_access_page; + bool

Re: [PATCH 4/4] kvm, mem-hotplug: Update apic access page when it is migrated.

2014-07-03 Thread Gleb Natapov
On Wed, Jul 02, 2014 at 05:00:37PM +0800, Tang Chen wrote: apic access page is pinned in memory, and as a result it cannot be migrated/hot-removed. Actually it doesn't need to be pinned in memory. This patch introduces a new vcpu request: KVM_REQ_MIGRATE_EPT. This requet will be made when

Re: [PATCH 4/4] kvm, mem-hotplug: Update apic access page when it is migrated.

2014-07-03 Thread Tang Chen
Hi Gleb, Thanks for the advices. Please see below. On 07/03/2014 09:55 PM, Gleb Natapov wrote: .. @@ -575,6 +575,7 @@ struct kvm_arch { unsigned int tss_addr; struct page *apic_access_page; + bool apic_access_page_migrated; Better have two requests

Re: [PATCH 4/4] kvm, mem-hotplug: Update apic access page when it is migrated.

2014-07-03 Thread Tang Chen
Hi Gleb, Thanks for the advices. Please see below. On 07/03/2014 09:55 PM, Gleb Natapov wrote: .. @@ -575,6 +575,7 @@ struct kvm_arch { unsigned int tss_addr; struct page *apic_access_page; + bool apic_access_page_migrated; Better have two requests

[PATCH 4/4] kvm, mem-hotplug: Update apic access page when it is migrated.

2014-07-02 Thread Tang Chen
apic access page is pinned in memory, and as a result it cannot be migrated/hot-removed. Actually it doesn't need to be pinned in memory. This patch introduces a new vcpu request: KVM_REQ_MIGRATE_EPT. This requet will be made when kvm_mmu_notifier_invalidate_page() is called when the page is