public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] KVM: VMX: Clean up private memory slot allocation
@ 2008-11-11  7:31 Sheng Yang
  2008-11-13 12:27 ` Avi Kivity
  0 siblings, 1 reply; 3+ messages in thread
From: Sheng Yang @ 2008-11-11  7:31 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm, Sheng Yang

userspace_addr should be a meaningless value.
(Any suggestion on this "meaningless value"?)

Signed-off-by: Sheng Yang <sheng@linux.intel.com>
---
 arch/x86/kvm/vmx.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 8043352..640d11a 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -2022,6 +2022,8 @@ static int alloc_apic_access_page(struct kvm *kvm)
 	kvm_userspace_mem.flags = 0;
 	kvm_userspace_mem.guest_phys_addr = 0xfee00000ULL;
 	kvm_userspace_mem.memory_size = PAGE_SIZE;
+	/* userspace_addr is invalid, make it unaligned */
+	kvm_userspace_mem.userspace_addr = PAGE_SIZE - 1;
 	r = __kvm_set_memory_region(kvm, &kvm_userspace_mem, 0);
 	if (r)
 		goto out;
@@ -2044,6 +2046,8 @@ static int alloc_identity_pagetable(struct kvm *kvm)
 	kvm_userspace_mem.flags = 0;
 	kvm_userspace_mem.guest_phys_addr = VMX_EPT_IDENTITY_PAGETABLE_ADDR;
 	kvm_userspace_mem.memory_size = PAGE_SIZE;
+	/* userspace_addr is invalid, make it unaligned */
+	kvm_userspace_mem.userspace_addr = PAGE_SIZE - 1;
 	r = __kvm_set_memory_region(kvm, &kvm_userspace_mem, 0);
 	if (r)
 		goto out;
-- 
1.5.4.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] KVM: VMX: Clean up private memory slot allocation
  2008-11-11  7:31 [PATCH 1/1] KVM: VMX: Clean up private memory slot allocation Sheng Yang
@ 2008-11-13 12:27 ` Avi Kivity
  2008-11-14  2:27   ` Sheng Yang
  0 siblings, 1 reply; 3+ messages in thread
From: Avi Kivity @ 2008-11-13 12:27 UTC (permalink / raw)
  To: Sheng Yang; +Cc: kvm

Sheng Yang wrote:
> userspace_addr should be a meaningless value.
>   

Perhaps in __kvm_set_memory_region(), if !user_alloc?

Why is it needed?  Did you observe any problem?

> @@ -2022,6 +2022,8 @@ static int alloc_apic_access_page(struct kvm *kvm)
>  	kvm_userspace_mem.flags = 0;
>  	kvm_userspace_mem.guest_phys_addr = 0xfee00000ULL;
>  	kvm_userspace_mem.memory_size = PAGE_SIZE;
> +	/* userspace_addr is invalid, make it unaligned */
> +	kvm_userspace_mem.userspace_addr = PAGE_SIZE - 1;
>  	r = __kvm_set_memory_region(kvm, &kvm_userspace_mem, 0);
>  	if (r)
>  		goto out;
> @@ -2044,6 +2046,8 @@ static int alloc_identity_pagetable(struct kvm *kvm)
>  	kvm_userspace_mem.flags = 0;
>  	kvm_userspace_mem.guest_phys_addr = VMX_EPT_IDENTITY_PAGETABLE_ADDR;
>  	kvm_userspace_mem.memory_size = PAGE_SIZE;
> +	/* userspace_addr is invalid, make it unaligned */
> +	kvm_userspace_mem.userspace_addr = PAGE_SIZE - 1;
>  	r = __kvm_set_memory_region(kvm, &kvm_userspace_mem, 0);
>  	if (r)
>  		goto out;
>   


-- 
error compiling committee.c: too many arguments to function


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] KVM: VMX: Clean up private memory slot allocation
  2008-11-13 12:27 ` Avi Kivity
@ 2008-11-14  2:27   ` Sheng Yang
  0 siblings, 0 replies; 3+ messages in thread
From: Sheng Yang @ 2008-11-14  2:27 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm

On Thursday 13 November 2008 20:27:13 Avi Kivity wrote:
> Sheng Yang wrote:
> > userspace_addr should be a meaningless value.
>
> Perhaps in __kvm_set_memory_region(), if !user_alloc?
>
> Why is it needed?  Did you observe any problem?

A potential issue is kvm_userspace_mem.userspace_addr don't have value, so for 
the recent case, it won't show stably everytime... So I think it's a potential 
issue, to prevent further confusing on this (if necessary).

-- 
regards
Yang, Sheng

>
> > @@ -2022,6 +2022,8 @@ static int alloc_apic_access_page(struct kvm *kvm)
> >  	kvm_userspace_mem.flags = 0;
> >  	kvm_userspace_mem.guest_phys_addr = 0xfee00000ULL;
> >  	kvm_userspace_mem.memory_size = PAGE_SIZE;
> > +	/* userspace_addr is invalid, make it unaligned */
> > +	kvm_userspace_mem.userspace_addr = PAGE_SIZE - 1;
> >  	r = __kvm_set_memory_region(kvm, &kvm_userspace_mem, 0);
> >  	if (r)
> >  		goto out;
> > @@ -2044,6 +2046,8 @@ static int alloc_identity_pagetable(struct kvm
> > *kvm) kvm_userspace_mem.flags = 0;
> >  	kvm_userspace_mem.guest_phys_addr = VMX_EPT_IDENTITY_PAGETABLE_ADDR;
> >  	kvm_userspace_mem.memory_size = PAGE_SIZE;
> > +	/* userspace_addr is invalid, make it unaligned */
> > +	kvm_userspace_mem.userspace_addr = PAGE_SIZE - 1;
> >  	r = __kvm_set_memory_region(kvm, &kvm_userspace_mem, 0);
> >  	if (r)
> >  		goto out;


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-11-14  2:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-11  7:31 [PATCH 1/1] KVM: VMX: Clean up private memory slot allocation Sheng Yang
2008-11-13 12:27 ` Avi Kivity
2008-11-14  2:27   ` Sheng Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox