RFC: alias rework
PATCH 1/1 RFC: alias rework
Quoted 1 line
From
f94dcd1ccabbcdb51ed7c37c5f58f00a5c1b7eecMon Sep 17 00:00:00 2001
From: Izik Eidus <[email protected]>
Date: Mon, 25 Jan 2010 15:49:41 +0200
Subject: [PATCH] RFC: alias rework
This patch remove the old way of aliasing inside kvm and move into using aliasing with the same virtual addresses
This patch is really just early RFC just to know if you guys like this direction, and I need to clean some parts of it and test it more before I feel it ready to be merged...
Comments are more than welcome.
Thanks.
--- arch/ia64/include/asm/kvm_host.h | 1 + arch/ia64/kvm/kvm-ia64.c | 5 -- arch/powerpc/kvm/powerpc.c | 5 -- arch/s390/include/asm/kvm_host.h | 1 + arch/s390/kvm/kvm-s390.c | 5 -- arch/x86/include/asm/kvm_host.h | 19 ------ arch/x86/include/asm/vmx.h | 6 +- arch/x86/kvm/mmu.c | 19 ++----- arch/x86/kvm/x86.c | 114 +++++++++++-------------------------- include/linux/kvm_host.h | 11 +-- virt/kvm/kvm_main.c | 80 +++++++++++++++++++------- 11 files changed, 107 insertions(+), 159 deletions(-)
arch/ia64/include/asm/kvm_host.h +1 -0
@@ -24,6 +24,7 @@#define __ASM_KVM_HOST_H#define KVM_MEMORY_SLOTS 32 +#define KVM_ALIAS_SLOTS 0/* memory slots that does not exposed to userspace */ #define KVM_PRIVATE_MEM_SLOTS 4
arch/ia64/kvm/kvm-ia64.c +0 -5
@@ -1947,11 +1947,6 @@ int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu)return vcpu->arch.timer_fired; } -gfn_t unalias_gfn (struct kvm *kvm,gfn_t gfn) -{ -return gfn; -} -int kvm_arch_vcpu_runnable (struct kvm_vcpu *vcpu) { return (vcpu->arch.mp_state == KVM_MP_STATE_RUNNABLE) ||
arch/powerpc/kvm/powerpc.c +0 -5
@@ -35,11 +35,6 @@#define CREATE_TRACE_POINTS #include "trace.h" -gfn_t unalias_gfn (struct kvm *kvm,gfn_t gfn) -{ -return gfn; -} -int kvm_arch_vcpu_runnable (struct kvm_vcpu *v) {return !(v->arch.msr &MSR_WE ) || !!(v->arch.pending_exceptions);
arch/s390/include/asm/kvm_host.h +1 -0
@@ -21,6 +21,7 @@#define KVM_MAX_VCPUS 64#define KVM_MEMORY_SLOTS 32 +#define KVM_ALIAS_SLOTS 0/* memory slots that does not exposed to userspace */ #define KVM_PRIVATE_MEM_SLOTS 4
arch/s390/kvm/kvm-s390.c +0 -5
@@ -741,11 +741,6 @@ void kvm_arch_flush_shadow(struct kvm *kvm) { } -gfn_t unalias_gfn (struct kvm *kvm,gfn_t gfn) -{ -return gfn; -} -static int __init kvm_s390_init (void ) {int ret;
arch/x86/include/asm/kvm_host.h +0 -19
@@ -367,24 +367,7 @@ struct kvm_vcpu_arch {u64 hv_vapic; }; -struct kvm_mem_alias { -gfn_t base_gfn; -unsigned long npages; -gfn_t target_gfn; -#define KVM_ALIAS_INVALID 1UL -unsigned long flags; -}; - -#define KVM_ARCH_HAS_UNALIAS_INSTANTIATION - -struct kvm_mem_aliases { -struct kvm_mem_alias aliases[KVM_ALIAS_SLOTS ]; -int naliases; -}; -struct kvm_arch { -struct kvm_mem_aliases *aliases; -unsigned int n_free_mmu_pages;unsigned int n_requested_mmu_pages;unsigned int n_alloc_mmu_pages;
@@ -674,8 +657,6 @@ void kvm_disable_tdp(void);int load_pdptrs (struct kvm_vcpu *vcpu,unsigned long cr3);int complete_pio (struct kvm_vcpu *vcpu); -struct kvm_memory_slot *gfn_to_memslot_unaliased (struct kvm *kvm,gfn_t gfn); -static inline struct kvm_mmu_page *page_header (hpa_t shadow_page) {struct page *page =pfn_to_page (shadow_page >>PAGE_SHIFT );
arch/x86/include/asm/vmx.h +3 -3
@@ -347,9 +347,9 @@ enum vmcs_field {#define AR_RESERVD_MASK 0xfffe0f00 -#define TSS_PRIVATE_MEMSLOT (KVM_MEMORY_SLOTS + 0) -#define APIC_ACCESS_PAGE_PRIVATE_MEMSLOT (KVM_MEMORY_SLOTS + 1) -#define IDENTITY_PAGETABLE_PRIVATE_MEMSLOT (KVM_MEMORY_SLOTS + 2) +#define TSS_PRIVATE_MEMSLOT (KVM_MEMORY_SLOTS + KVM_ALIAS_SLOTS + 0) +#define APIC_ACCESS_PAGE_PRIVATE_MEMSLOT (KVM_MEMORY_SLOTS + KVM_ALIAS_SLOTS + 1) +#define IDENTITY_PAGETABLE_PRIVATE_MEMSLOT (KVM_MEMORY_SLOTS + KVM_ALIAS_SLOTS + 2)#define VMX_NR_VPIDS (1 << 16)#define VMX_VPID_EXTENT_SINGLE_CONTEXT 1
arch/x86/kvm/mmu.c +5 -14
@@ -422,9 +422,7 @@ static void account_shadowed(struct kvm *kvm, gfn_t gfn)int *write_count;int i; - gfn =unalias_gfn (kvm, gfn); - - slot =gfn_to_memslot_unaliased (kvm, gfn); + slot =gfn_to_memslot (kvm, gfn);for (i =PT_DIRECTORY_LEVEL ; i <PT_PAGE_TABLE_LEVEL +KVM_NR_PAGE_SIZES ; ++i) { write_count =slot_largepage_idx (gfn, slot, i);
@@ -438,10 +436,9 @@ static void unaccount_shadowed(struct kvm *kvm, gfn_t gfn)int *write_count;int i; - gfn =unalias_gfn (kvm, gfn);for (i =PT_DIRECTORY_LEVEL ; i <PT_PAGE_TABLE_LEVEL +KVM_NR_PAGE_SIZES ; ++i) { - slot =gfn_to_memslot_unaliased (kvm, gfn); + slot =gfn_to_memslot (kvm, gfn); write_count =slot_largepage_idx (gfn, slot, i); *write_count -=1 ;WARN_ON (*write_count <0 );
@@ -455,8 +452,7 @@ static int has_wrprotected_page(struct kvm *kvm,struct kvm_memory_slot *slot;int *largepage_idx; - gfn =unalias_gfn (kvm, gfn); - slot =gfn_to_memslot_unaliased (kvm, gfn); + slot =gfn_to_memslot (kvm, gfn);if (slot) { largepage_idx =slot_largepage_idx (gfn, slot, level);return *largepage_idx;
@@ -523,7 +519,6 @@ static int mapping_level(struct kvm_vcpu *vcpu, gfn_t large_gfn)/* * Take gfn and return the reverse mapping to it. -* Note: gfn must be unaliased before this function get called */ static unsigned long *gfn_to_rmap (struct kvm *kvm,gfn_t gfn,int level)
@@ -563,7 +558,6 @@ static int rmap_add(struct kvm_vcpu *vcpu, u64 *spte, gfn_t gfn)if (!is_rmap_spte (*spte))return count; - gfn =unalias_gfn (vcpu->kvm, gfn); sp =page_header (__pa (spte)); sp->gfns[spte - sp->spt] = gfn; rmapp =gfn_to_rmap (vcpu->kvm, gfn, sp->role.level);
@@ -700,7 +694,6 @@ static int rmap_write_protect(struct kvm *kvm, u64 gfn)u64 *spte;int i, write_protected =0 ; - gfn =unalias_gfn (kvm, gfn); rmapp =gfn_to_rmap (kvm, gfn,PT_PAGE_TABLE_LEVEL ); spte =rmap_next (kvm, rmapp,NULL );
@@ -879,7 +872,6 @@ static void rmap_recycle(struct kvm_vcpu *vcpu, u64 *spte, gfn_t gfn) sp =page_header (__pa (spte)); - gfn =unalias_gfn (vcpu->kvm, gfn); rmapp =gfn_to_rmap (vcpu->kvm, gfn, sp->role.level);kvm_unmap_rmapp (vcpu->kvm, rmapp,0 );
@@ -2896,7 +2888,6 @@ void kvm_mmu_slot_remove_write_access(struct kvm *kvm, int slot)if (pt[i] &PT_WRITABLE_MASK ) pt[i] &= ~PT_WRITABLE_MASK ; } -kvm_flush_remote_tlbs (kvm); }void kvm_mmu_zap_all (struct kvm *kvm)
@@ -3403,8 +3394,8 @@ static void audit_write_protection(struct kvm_vcpu *vcpu)if (sp->unsync)continue ; - gfn =unalias_gfn (vcpu->kvm, sp->gfn); - slot =gfn_to_memslot_unaliased (vcpu->kvm, sp->gfn); + gfn = sp->gfn; + slot =gfn_to_memslot (vcpu->kvm, gfn); rmapp = &slot->rmap[gfn - slot->base_gfn]; spte =rmap_next (vcpu->kvm, rmapp,NULL );
arch/x86/kvm/x86.c +34 -80
169 lines not on this page · raw message
include/linux/kvm_host.h +4 -7
@@ -117,6 +117,8 @@ struct kvm_memory_slot { } *lpage_info[KVM_NR_PAGE_SIZES -1 ];unsigned long userspace_addr;int user_alloc; +gfn_t real_base_gfn; +unsigned long real_npages; };struct kvm_kernel_irq_routing_entry {
@@ -156,7 +158,8 @@ struct kvm_irq_routing_table {};struct kvm_memslots {int nmemslots;struct kvm_memory_slot memslots[KVM_MEMORY_SLOTS + -KVM_PRIVATE_MEM_SLOTS ]; +KVM_PRIVATE_MEM_SLOTS + +KVM_ALIAS_SLOTS ]; };struct kvm {
@@ -267,8 +270,6 @@ void kvm_arch_commit_memory_region(struct kvm *kvm, int user_alloc);void kvm_disable_largepages (void );void kvm_arch_flush_shadow (struct kvm *kvm); -gfn_t unalias_gfn (struct kvm *kvm,gfn_t gfn); -gfn_t unalias_gfn_instantiation (struct kvm *kvm,gfn_t gfn);struct page *gfn_to_page (struct kvm *kvm,gfn_t gfn);unsigned long gfn_to_hva (struct kvm *kvm,gfn_t gfn);
@@ -543,10 +544,6 @@ static inline int mmu_notifier_retry(struct kvm_vcpu *vcpu, unsigned long mmu_se }#endif -#ifndef KVM_ARCH_HAS_UNALIAS_INSTANTIATION -#define unalias_gfn_instantiation unalias_gfn -#endif -#ifdef CONFIG_HAVE_KVM_IRQCHIP #define KVM_MAX_IRQ_ROUTES 1024
virt/kvm/kvm_main.c +59 -21
163 lines not on this page · raw message
Signature · 1 line
1.6.5.2
Izik,
Quoted 33 lines · Izik Eidus
Quoted 1 line
From
f94dcd1ccabbcdb51ed7c37c5f58f00a5c1b7eecMon Sep 17 00:00:00 2001From: Izik Eidus <[email protected]>
Date: Mon, 25 Jan 2010 15:49:41 +0200
Subject: [PATCH] RFC: alias reworkThis patch remove the old way of aliasing inside kvm and move into using aliasing with the same virtual addresses
This patch is really just early RFC just to know if you guys like this direction, and I need to clean some parts of it and test it more before I feel it ready to be merged...
Comments are more than welcome.
Thanks.
Signed-off-by Izik Eidus <[email protected]>--- arch/ia64/include/asm/kvm_host.h | 1 + arch/ia64/kvm/kvm-ia64.c | 5 -- arch/powerpc/kvm/powerpc.c | 5 -- arch/s390/include/asm/kvm_host.h | 1 + arch/s390/kvm/kvm-s390.c | 5 -- arch/x86/include/asm/kvm_host.h | 19 ------ arch/x86/include/asm/vmx.h | 6 +- arch/x86/kvm/mmu.c | 19 ++----- arch/x86/kvm/x86.c | 114 +++++++++++-------------------------- include/linux/kvm_host.h | 11 +-- virt/kvm/kvm_main.c | 80 +++++++++++++++++++------- 11 files changed, 107 insertions(+), 159 deletions(-)
arch/x86/kvm/x86.c int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, · line 2615
Quoted 5 lines
arch/x86/kvm/x86.c +2
-0@@ -2661,7 +2611,18 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,struct kvm_memslots *slots, *old_slots;spin_lock (&kvm->mmu_lock); +for (i =KVM_MEMORY_SLOTS ; i <KVM_MEMORY_SLOTS + +KVM_ALIAS_SLOTS ; ++i) {
The plan is to kill KVM_ALIAS_SLOTS (aliases will share the 32 mem slots), right?
Quoted 29 lines
virt/kvm/kvm_main.c +29
-0+#ifdef CONFIG_X86 + +static void update_alias_slots (struct kvm *kvm,struct kvm_memory_slot *slot) +{ +int i; + +for (i =KVM_MEMORY_SLOTS ; i <KVM_MEMORY_SLOTS +KVM_ALIAS_SLOTS ; + ++i) { +struct kvm_memory_slot *alias_memslot = + &kvm->memslots->memslots[i]; +unsigned long size = slot->npages <<PAGE_SHIFT ; + +if (alias_memslot->real_base_gfn >= slot->base_gfn && + alias_memslot->real_base_gfn < slot->base_gfn + size) { +if (slot->dirty_bitmap) { +unsigned long bitmap_addr; +unsigned long dirty_offset; +unsigned long offset_addr = + (alias_memslot->real_base_gfn - + slot->base_gfn) <<PAGE_SHIFT ; + alias_memslot->userspace_addr = + slot->userspace_addr + offset_addr; + + dirty_offset = +ALIGN (offset_addr,BITS_PER_LONG ) /8 ; + bitmap_addr = (unsigned long ) slot->dirty_bitmap; + bitmap_addr += dirty_offset; + alias_memslot->dirty_bitmap = (unsigned long *)bitmap_addr; + alias_memslot->base_gfn = alias_memslot->real_base_gfn;
virt/kvm/kvm_main.c out_err_nodisable: · line 491
Quoted 10 lines
virt/kvm/kvm_main.c +10
-0+ alias_memslot->npages = alias_memslot->real_npages; + }else if (!slot->rmap) { + alias_memslot->base_gfn =0 ; + alias_memslot->npages =0 ; + } + } + } +} + +#endif
Can't see why is this needed. What is the problem with nuking "child" aliases when deleting a real memslot?
Quoted 38 lines · On Mon, 25 Jan 2010 17:45:53 -0200 Marcelo Tosatti <[email protected]> wrote:
Izik,
Quoted 35 lines · Izik Eidus
Quoted 1 line
From
f94dcd1ccabbcdb51ed7c37c5f58f00a5c1b7eecMon Sep 17 00:00:00 2001From: Izik Eidus <[email protected]>
Date: Mon, 25 Jan 2010 15:49:41 +0200
Subject: [PATCH] RFC: alias reworkThis patch remove the old way of aliasing inside kvm and move into using aliasing with the same virtual addresses
This patch is really just early RFC just to know if you guys like this direction, and I need to clean some parts of it and test it more before I feel it ready to be merged...
Comments are more than welcome.
Thanks.
Signed-off-by Izik Eidus <[email protected]>--- arch/ia64/include/asm/kvm_host.h | 1 + arch/ia64/kvm/kvm-ia64.c | 5 -- arch/powerpc/kvm/powerpc.c | 5 -- arch/s390/include/asm/kvm_host.h | 1 + arch/s390/kvm/kvm-s390.c | 5 -- arch/x86/include/asm/kvm_host.h | 19 ------ arch/x86/include/asm/vmx.h | 6 +- arch/x86/kvm/mmu.c | 19 ++----- arch/x86/kvm/x86.c | 114 +++++++++++-------------------------- include/linux/kvm_host.h | 11 +-- virt/kvm/kvm_main.c | 80 +++++++++++++++++++------- 11 files changed, 107 insertions(+), 159 deletions(-)arch/x86/kvm/x86.c +0
-0@@ -2661,7 +2611,18 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,struct kvm_memslots *slots, *old_slots;
Quoted 6 lines
arch/x86/kvm/x86.c int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, · line 2615
Quoted 3 lines
arch/x86/kvm/x86.c +2
-0spin_lock (&kvm->mmu_lock); +for (i =KVM_MEMORY_SLOTS ; i <KVM_MEMORY_SLOTS + +KVM_ALIAS_SLOTS ; ++i) {The plan is to kill
KVM_ALIAS_SLOTS(aliases will share the 32 mem slots), right?
Hrmm I think we got to have this addition 4 KVM_MEMORY_SLOTS to keep the same beahivor with old userspaces
beacuse maybe some userspace apps use 32 slots already?
I dont mind remove it if you guys don`t think this is the case.
Quoted 35 lines
Quoted 35 lines
virt/kvm/kvm_main.c +34
-0+#ifdef CONFIG_X86 + +static void update_alias_slots (struct kvm *kvm,struct kvm_memory_slot *slot) +{ +int i; + +for (i =KVM_MEMORY_SLOTS ; i <KVM_MEMORY_SLOTS +KVM_ALIAS_SLOTS ; + ++i) { +struct kvm_memory_slot *alias_memslot = + &kvm->memslots->memslots[i]; +unsigned long size = slot->npages <<PAGE_SHIFT ; + +if (alias_memslot->real_base_gfn >= slot->base_gfn && + alias_memslot->real_base_gfn < slot->base_gfn + size) { +if (slot->dirty_bitmap) { +unsigned long bitmap_addr; +unsigned long dirty_offset; +unsigned long offset_addr = + (alias_memslot->real_base_gfn - + slot->base_gfn) <<PAGE_SHIFT ; + alias_memslot->userspace_addr = + slot->userspace_addr + offset_addr; + + dirty_offset = +ALIGN (offset_addr,BITS_PER_LONG ) /8 ; + bitmap_addr = (unsigned long ) slot->dirty_bitmap; + bitmap_addr += dirty_offset; + alias_memslot->dirty_bitmap = (unsigned long *)bitmap_addr; + alias_memslot->base_gfn = alias_memslot->real_base_gfn; + alias_memslot->npages = alias_memslot->real_npages; + }else if (!slot->rmap) { + alias_memslot->base_gfn =0 ; + alias_memslot->npages =0 ; + }
Quoted 8 lines
virt/kvm/kvm_main.c out_err_nodisable: · line 491
Quoted 5 lines
virt/kvm/kvm_main.c +5
-0+ } + } +} + +#endif Can't see why is this needed. What is the problem with nuking "child" aliases when deleting a real memslot?
The problem is that this memslot still point in the virtual address of the host, This mean that gfn_to_memslot/page will still work on gfns and will result in pages that are mapped into the virtual address that the userspace requested to remove from KVM.
Thanks.
Quoted 48 lines · Izik Eidus
Quoted 38 lines · On Mon, 25 Jan 2010 17:45:53 -0200 Marcelo Tosatti <[email protected]> wrote:
Izik,
Quoted 35 lines · Izik Eidus
Quoted 1 line
From
f94dcd1ccabbcdb51ed7c37c5f58f00a5c1b7eecMon Sep 17 00:00:00 2001From: Izik Eidus <[email protected]>
Date: Mon, 25 Jan 2010 15:49:41 +0200
Subject: [PATCH] RFC: alias reworkThis patch remove the old way of aliasing inside kvm and move into using aliasing with the same virtual addresses
This patch is really just early RFC just to know if you guys like this direction, and I need to clean some parts of it and test it more before I feel it ready to be merged...
Comments are more than welcome.
Thanks.
Signed-off-by Izik Eidus <[email protected]>--- arch/ia64/include/asm/kvm_host.h | 1 + arch/ia64/kvm/kvm-ia64.c | 5 -- arch/powerpc/kvm/powerpc.c | 5 -- arch/s390/include/asm/kvm_host.h | 1 + arch/s390/kvm/kvm-s390.c | 5 -- arch/x86/include/asm/kvm_host.h | 19 ------ arch/x86/include/asm/vmx.h | 6 +- arch/x86/kvm/mmu.c | 19 ++----- arch/x86/kvm/x86.c | 114 +++++++++++-------------------------- include/linux/kvm_host.h | 11 +-- virt/kvm/kvm_main.c | 80 +++++++++++++++++++------- 11 files changed, 107 insertions(+), 159 deletions(-)arch/x86/kvm/x86.c +0
-0@@ -2661,7 +2611,18 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,struct kvm_memslots *slots, *old_slots;Quoted 6 lines
arch/x86/kvm/x86.c int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, · line 2615
Quoted 3 lines
arch/x86/kvm/x86.c +2
-0spin_lock (&kvm->mmu_lock); +for (i =KVM_MEMORY_SLOTS ; i <KVM_MEMORY_SLOTS + +KVM_ALIAS_SLOTS ; ++i) {The plan is to kill
KVM_ALIAS_SLOTS(aliases will share the 32 mem slots), right?
Quoted 5 lines
Hrmm I think we got to have this addition 4
KVM_MEMORY_SLOTSto keep the same beahivor with old userspaces
beacuse maybe some userspace apps use 32 slots already?I dont mind remove it if you guys don`t think this is the case.
I'm fine with sharing (it also makes the code simpler).
Don't know of any apps/configs using more than (or close to) 32 slots.
Quoted 43 lines
Quoted 34 lines
Quoted 34 lines
virt/kvm/kvm_main.c +34
-0+#ifdef CONFIG_X86 + +static void update_alias_slots (struct kvm *kvm,struct kvm_memory_slot *slot) +{ +int i; + +for (i =KVM_MEMORY_SLOTS ; i <KVM_MEMORY_SLOTS +KVM_ALIAS_SLOTS ; + ++i) { +struct kvm_memory_slot *alias_memslot = + &kvm->memslots->memslots[i]; +unsigned long size = slot->npages <<PAGE_SHIFT ; + +if (alias_memslot->real_base_gfn >= slot->base_gfn && + alias_memslot->real_base_gfn < slot->base_gfn + size) { +if (slot->dirty_bitmap) { +unsigned long bitmap_addr; +unsigned long dirty_offset; +unsigned long offset_addr = + (alias_memslot->real_base_gfn - + slot->base_gfn) <<PAGE_SHIFT ; + alias_memslot->userspace_addr = + slot->userspace_addr + offset_addr; + + dirty_offset = +ALIGN (offset_addr,BITS_PER_LONG ) /8 ; + bitmap_addr = (unsigned long ) slot->dirty_bitmap; + bitmap_addr += dirty_offset; + alias_memslot->dirty_bitmap = (unsigned long *)bitmap_addr; + alias_memslot->base_gfn = alias_memslot->real_base_gfn; + alias_memslot->npages = alias_memslot->real_npages; + }else if (!slot->rmap) { + alias_memslot->base_gfn =0 ; + alias_memslot->npages =0 ; + }Quoted 8 lines
virt/kvm/kvm_main.c out_err_nodisable: · line 491
Quoted 5 lines
virt/kvm/kvm_main.c +5
-0+ } + } +} + +#endif Can't see why is this needed. What is the problem with nuking "child" aliases when deleting a real memslot?
Quoted 4 lines
The problem is that this memslot still point in the virtual address of the host, This mean that gfn_to_memslot/page will still work on gfns and will result in pages that are mapped into the virtual address that the userspace requested to remove from KVM.
With current code, if a memslot is deleted, access through any aliases that use it will fail (BTW it looks this is not properly handled, but thats a separate problem).
So AFAICS there is no requirement for an alias to continue "operable" if its parent memslot is deleted.
Or is this a feature you need?
Motivation is that nukeing aliases is simpler than adjusting them.
Quoted 3 lines · On Mon, 25 Jan 2010 18:20:39 -0200 Marcelo Tosatti <[email protected]> wrote:
With current code, if a memslot is deleted, access through any aliases that use it will fail (BTW it looks this is not properly handled, but thats a separate problem).
Yea I had some still open concerns about this code (this why I sent it on RFC)
Quoted 3 lines
So AFAICS there is no requirement for an alias to continue "operable" if its parent memslot is deleted.
With this patch alias will stop to opearte when the parent is deleted just like the behivor with the current code...
base_gfn will be set to 0 and npages will be set to 0 as well (the true values wil be hide in real_base_gfn...), so gfn_to_memslot and gfn_to_page will fail....
Quoted 2 lines
Or is this a feature you need?
I dont need it (I asked Avi to do something), So he said he want to nuke the aliasing from kvm and keep supporting the old userspace`s
Do you have any other way to achive this?
Btw I do realize it might be better not to push this patch and just keep the old way of treating aliasing as we have now, I really don`t mind.
Quoted 3 lines
Motivation is that nukeing aliases is simpler than adjusting them.
Agree.
Quoted 15 lines · Izik Eidus
Quoted 3 lines · On Mon, 25 Jan 2010 18:20:39 -0200 Marcelo Tosatti <[email protected]> wrote:
With current code, if a memslot is deleted, access through any aliases that use it will fail (BTW it looks this is not properly handled, but thats a separate problem).
Yea I had some still open concerns about this code (this why I sent it on RFC)
Quoted 3 lines
So AFAICS there is no requirement for an alias to continue "operable" if its parent memslot is deleted.
Quoted 6 lines
With this patch alias will stop to opearte when the parent is deleted just like the behivor with the current code...
base_gfnwill be set to 0 and npages will be set to 0 as well (the true values wil be hide inreal_base_gfn...), sogfn_to_memslotandgfn_to_pagewill fail....
But you adjust the alias (and keep it valid) if dirty logging is enabled?
Quoted 6 lines
Quoted 2 lines
Or is this a feature you need?
I dont need it (I asked Avi to do something), So he said he want to nuke the aliasing from kvm and keep supporting the old userspace`s
With feature i meant keeping the alias around when parent slot is deleted.
Quoted 1 line
Do you have any other way to achive this?
No.
Quoted 8 lines
Btw I do realize it might be better not to push this patch and just keep the old way of treating aliasing as we have now, I really don`t mind.
Quoted 3 lines
Motivation is that nukeing aliases is simpler than adjusting them.
Agree.
Quoted 19 lines · On Mon, 25 Jan 2010 18:49:25 -0200 Marcelo Tosatti <[email protected]> wrote:
Quoted 18 lines · Izik Eidus
Quoted 3 lines · On Mon, 25 Jan 2010 18:20:39 -0200 Marcelo Tosatti <[email protected]> wrote:
With current code, if a memslot is deleted, access through any aliases that use it will fail (BTW it looks this is not properly handled, but thats a separate problem).
Yea I had some still open concerns about this code (this why I sent it on RFC)
Quoted 3 lines
So AFAICS there is no requirement for an alias to continue "operable" if its parent memslot is deleted.
With this patch alias will stop to opearte when the parent is deleted just like the behivor with the current code...
Quoted 6 lines
Quoted 3 lines
base_gfnwill be set to 0 and npages will be set to 0 as well (the true values wil be hide inreal_base_gfn...), sogfn_to_memslotandgfn_to_pagewill fail....But you adjust the alias (and keep it valid) if dirty logging is enabled?
I am sorry, but probaby you got confused beacuse the code is wrong the adjust of aliasing should happen in every case of:
if(slot->rmap -> valid (!NULL)):
this mean we got NEW parent slot that mapped into the gfn that the alias is mapped to, and we want the userspace address of the alias slot to intersect with the new parent slot.
and the latter adjustmant of the dirty_bitmap should happen only in case of - if(slot->dirty_bitmap -> valid (!NULL)):
the alias slot need to mark_page_dirty the bitmap of the new parent slot
I hope this will make things more clear
(I think there is another small issue there, but I will send it when it wont be RFC)
Quoted 10 lines
Quoted 7 lines
Quoted 3 lines
Or is this a feature you need?
I dont need it (I asked Avi to do something), So he said he want to nuke the aliasing from kvm and keep supporting the old userspace`s
With feature i meant keeping the alias around when parent slot is deleted.
The code doesnt try to do this, infact:
} else if (!slot->rmap) {
alias_memslot->base_gfn = 0;
alias_memslot->npages = 0;
}came to invalidate the alias slot.
Sorry if I made to much mess :).
Quoted 14 lines
Quoted 2 lines
Do you have any other way to achive this?
No.
Quoted 8 lines
Btw I do realize it might be better not to push this patch and just keep the old way of treating aliasing as we have now, I really don`t mind.
Quoted 3 lines
Motivation is that nukeing aliases is simpler than adjusting them.
Agree.
Quoted 4 lines · Izik Eidus
Quoted 3 lines
Or is this a feature you need?
Quoted 8 lines
I dont need it (I asked Avi to do something), So he said he want to nuke the aliasing from kvm and keep supporting the old userspace`s
Do you have any other way to achive this?
Btw I do realize it might be better not to push this patch and just keep the old way of treating aliasing as we have now, I really don`t mind.
How about implementing an alias pointing at a deleted slot as an invalid slot?
If the slot comes back later, we can revalidate it.
Signature · 1 line
error compiling committee.c: too many arguments to function
Quoted 10 lines · On Tue, 26 Jan 2010 16:14:47 +0200 Avi Kivity <[email protected]> wrote:
Quoted 9 lines · Izik Eidus
Quoted 3 lines
Or is this a feature you need?
I dont need it (I asked Avi to do something), So he said he want to nuke the aliasing from kvm and keep supporting the old userspace`s
Do you have any other way to achive this?
Quoted 9 lines
Quoted 3 lines
Btw I do realize it might be better not to push this patch and just keep the old way of treating aliasing as we have now, I really don`t mind.
How about implementing an alias pointing at a deleted slot as an invalid slot?
If the slot comes back later, we can revalidate it.
Ok, didn`t notice this invalid memslot flag,
I will add this, I will still leave the update_aliased_memslot() in order to update the userspace virtual address...