Re: [PATCH 12/13] KVM: x86: add KVM_MEM_X86_SMRAM memory slot flag

2015-05-18 Thread Paolo Bonzini
On 15/05/2015 22:32, Avi Kivity wrote: > Alternative approach: store the memslot pointer in the vcpu, instead of > of vcpu->kvm. The uapi interface code can generate two memslot tables > to be stored in kvm->, one for smm and one for !smm. That's a great suggestion---and easy to implement too.

Re: [PATCH 12/13] KVM: x86: add KVM_MEM_X86_SMRAM memory slot flag

2015-05-18 Thread Paolo Bonzini
On 15/05/2015 22:32, Avi Kivity wrote: Alternative approach: store the memslot pointer in the vcpu, instead of of vcpu-kvm. The uapi interface code can generate two memslot tables to be stored in kvm-, one for smm and one for !smm. That's a great suggestion---and easy to implement too.

Re: [PATCH 12/13] KVM: x86: add KVM_MEM_X86_SMRAM memory slot flag

2015-05-15 Thread Avi Kivity
On 04/30/2015 02:36 PM, Paolo Bonzini wrote: This adds an arch-specific memslot flag that hides slots unless the VCPU is in system management mode. Some care is needed in order to limit the overhead of x86_gfn_to_memslot when compared with gfn_to_memslot. Thankfully, we have __gfn_to_memslot

Re: [PATCH 12/13] KVM: x86: add KVM_MEM_X86_SMRAM memory slot flag

2015-05-15 Thread Avi Kivity
On 04/30/2015 02:36 PM, Paolo Bonzini wrote: This adds an arch-specific memslot flag that hides slots unless the VCPU is in system management mode. Some care is needed in order to limit the overhead of x86_gfn_to_memslot when compared with gfn_to_memslot. Thankfully, we have __gfn_to_memslot

Re: [PATCH 12/13] KVM: x86: add KVM_MEM_X86_SMRAM memory slot flag

2015-05-06 Thread Paolo Bonzini
On 06/05/2015 18:24, Radim Krčmář wrote: > The feature you wanted exposed a flaw in the code, so an extension was > needed. Copying code is the last resort after all options of > abstracting were exhausted ... I might be forcing common paths when > writing it twice requires less brain power,

Re: [PATCH 12/13] KVM: x86: add KVM_MEM_X86_SMRAM memory slot flag

2015-05-06 Thread Bandan Das
Radim Krčmář writes: ... > > That doesn't improve the main issue, so x86 is good. > >>> Another option is adding something like "vcpu kvm_arch_fake_vcpu(kvm)" >>> for cases where the access doesn't have an associated vcpu, so it would >>> always succeed. (Might not be generic enough.) >> >>

Re: [PATCH 12/13] KVM: x86: add KVM_MEM_X86_SMRAM memory slot flag

2015-05-06 Thread Radim Krčmář
2015-05-06 11:47+0200, Paolo Bonzini: > On 05/05/2015 19:17, Radim Krčmář wrote: >> 2015-04-30 13:36+0200, Paolo Bonzini: >>> struct kvm_memory_slot *x86_gfn_to_memslot(struct kvm_vcpu *vcpu, gfn_t >>> gfn) >>> { >>> - struct kvm_memory_slot *slot = gfn_to_memslot(vcpu->kvm, gfn); >>> +

Re: [PATCH 12/13] KVM: x86: add KVM_MEM_X86_SMRAM memory slot flag

2015-05-06 Thread Paolo Bonzini
On 05/05/2015 19:17, Radim Krčmář wrote: > 2015-04-30 13:36+0200, Paolo Bonzini: >> This adds an arch-specific memslot flag that hides slots unless the >> VCPU is in system management mode. >> >> Some care is needed in order to limit the overhead of x86_gfn_to_memslot >> when compared with

Re: [PATCH 12/13] KVM: x86: add KVM_MEM_X86_SMRAM memory slot flag

2015-05-06 Thread Paolo Bonzini
On 05/05/2015 19:17, Radim Krčmář wrote: 2015-04-30 13:36+0200, Paolo Bonzini: This adds an arch-specific memslot flag that hides slots unless the VCPU is in system management mode. Some care is needed in order to limit the overhead of x86_gfn_to_memslot when compared with gfn_to_memslot.

Re: [PATCH 12/13] KVM: x86: add KVM_MEM_X86_SMRAM memory slot flag

2015-05-06 Thread Paolo Bonzini
On 06/05/2015 18:24, Radim Krčmář wrote: The feature you wanted exposed a flaw in the code, so an extension was needed. Copying code is the last resort after all options of abstracting were exhausted ... I might be forcing common paths when writing it twice requires less brain power, but

Re: [PATCH 12/13] KVM: x86: add KVM_MEM_X86_SMRAM memory slot flag

2015-05-06 Thread Bandan Das
Radim Krčmář rkrc...@redhat.com writes: ... That doesn't improve the main issue, so x86 is good. Another option is adding something like vcpu kvm_arch_fake_vcpu(kvm) for cases where the access doesn't have an associated vcpu, so it would always succeed. (Might not be generic enough.)

Re: [PATCH 12/13] KVM: x86: add KVM_MEM_X86_SMRAM memory slot flag

2015-05-06 Thread Radim Krčmář
2015-05-06 11:47+0200, Paolo Bonzini: On 05/05/2015 19:17, Radim Krčmář wrote: 2015-04-30 13:36+0200, Paolo Bonzini: struct kvm_memory_slot *x86_gfn_to_memslot(struct kvm_vcpu *vcpu, gfn_t gfn) { - struct kvm_memory_slot *slot = gfn_to_memslot(vcpu-kvm, gfn); + bool found; +

Re: [PATCH 12/13] KVM: x86: add KVM_MEM_X86_SMRAM memory slot flag

2015-05-05 Thread Radim Krčmář
2015-04-30 13:36+0200, Paolo Bonzini: > This adds an arch-specific memslot flag that hides slots unless the > VCPU is in system management mode. > > Some care is needed in order to limit the overhead of x86_gfn_to_memslot > when compared with gfn_to_memslot. Thankfully, we have __gfn_to_memslot

Re: [PATCH 12/13] KVM: x86: add KVM_MEM_X86_SMRAM memory slot flag

2015-05-05 Thread Radim Krčmář
2015-04-30 13:36+0200, Paolo Bonzini: This adds an arch-specific memslot flag that hides slots unless the VCPU is in system management mode. Some care is needed in order to limit the overhead of x86_gfn_to_memslot when compared with gfn_to_memslot. Thankfully, we have __gfn_to_memslot and

[PATCH 12/13] KVM: x86: add KVM_MEM_X86_SMRAM memory slot flag

2015-04-30 Thread Paolo Bonzini
This adds an arch-specific memslot flag that hides slots unless the VCPU is in system management mode. Some care is needed in order to limit the overhead of x86_gfn_to_memslot when compared with gfn_to_memslot. Thankfully, we have __gfn_to_memslot and search_memslots which are the same, so we

[PATCH 12/13] KVM: x86: add KVM_MEM_X86_SMRAM memory slot flag

2015-04-30 Thread Paolo Bonzini
This adds an arch-specific memslot flag that hides slots unless the VCPU is in system management mode. Some care is needed in order to limit the overhead of x86_gfn_to_memslot when compared with gfn_to_memslot. Thankfully, we have __gfn_to_memslot and search_memslots which are the same, so we