public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: Get rid of kvm_kvfree()
@ 2015-02-24 20:29 Thomas Huth
  2015-02-24 21:21 ` Bandan Das
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Thomas Huth @ 2015-02-24 20:29 UTC (permalink / raw)
  To: kvm; +Cc: Thomas Huth

kvm_kvfree() provides exactly the same functionality as the
new common kvfree() function - so let's simply replace the
kvm function with the common function.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
---
 arch/x86/kvm/x86.c       |    8 ++++----
 include/linux/kvm_host.h |    1 -
 virt/kvm/kvm_main.c      |   10 +---------
 3 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index bd7a70b..c5f7e03 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -7429,7 +7429,7 @@ void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
 
 	for (i = 0; i < KVM_NR_PAGE_SIZES; ++i) {
 		if (!dont || free->arch.rmap[i] != dont->arch.rmap[i]) {
-			kvm_kvfree(free->arch.rmap[i]);
+			kvfree(free->arch.rmap[i]);
 			free->arch.rmap[i] = NULL;
 		}
 		if (i == 0)
@@ -7437,7 +7437,7 @@ void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
 
 		if (!dont || free->arch.lpage_info[i - 1] !=
 			     dont->arch.lpage_info[i - 1]) {
-			kvm_kvfree(free->arch.lpage_info[i - 1]);
+			kvfree(free->arch.lpage_info[i - 1]);
 			free->arch.lpage_info[i - 1] = NULL;
 		}
 	}
@@ -7491,12 +7491,12 @@ int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
 
 out_free:
 	for (i = 0; i < KVM_NR_PAGE_SIZES; ++i) {
-		kvm_kvfree(slot->arch.rmap[i]);
+		kvfree(slot->arch.rmap[i]);
 		slot->arch.rmap[i] = NULL;
 		if (i == 0)
 			continue;
 
-		kvm_kvfree(slot->arch.lpage_info[i - 1]);
+		kvfree(slot->arch.lpage_info[i - 1]);
 		slot->arch.lpage_info[i - 1] = NULL;
 	}
 	return -ENOMEM;
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index d12b210..0f574eb 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -658,7 +658,6 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu);
 int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu);
 
 void *kvm_kvzalloc(unsigned long size);
-void kvm_kvfree(const void *addr);
 
 #ifndef __KVM_HAVE_ARCH_VM_ALLOC
 static inline struct kvm *kvm_arch_alloc_vm(void)
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index a109370..6f1a9c2 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -539,20 +539,12 @@ void *kvm_kvzalloc(unsigned long size)
 		return kzalloc(size, GFP_KERNEL);
 }
 
-void kvm_kvfree(const void *addr)
-{
-	if (is_vmalloc_addr(addr))
-		vfree(addr);
-	else
-		kfree(addr);
-}
-
 static void kvm_destroy_dirty_bitmap(struct kvm_memory_slot *memslot)
 {
 	if (!memslot->dirty_bitmap)
 		return;
 
-	kvm_kvfree(memslot->dirty_bitmap);
+	kvfree(memslot->dirty_bitmap);
 	memslot->dirty_bitmap = NULL;
 }
 
-- 
1.7.1


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

* Re: [PATCH] KVM: Get rid of kvm_kvfree()
  2015-02-24 20:29 [PATCH] KVM: Get rid of kvm_kvfree() Thomas Huth
@ 2015-02-24 21:21 ` Bandan Das
  2015-03-09 15:39 ` Thomas Huth
  2015-03-09 21:40 ` Marcelo Tosatti
  2 siblings, 0 replies; 5+ messages in thread
From: Bandan Das @ 2015-02-24 21:21 UTC (permalink / raw)
  To: Thomas Huth; +Cc: kvm

Thomas Huth <thuth@linux.vnet.ibm.com> writes:

> kvm_kvfree() provides exactly the same functionality as the
> new common kvfree() function - so let's simply replace the
> kvm function with the common function.

I assumed there would be a wrapper kvzalloc as well, seems not :)

> Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
> ---
>  arch/x86/kvm/x86.c       |    8 ++++----
>  include/linux/kvm_host.h |    1 -
>  virt/kvm/kvm_main.c      |   10 +---------
>  3 files changed, 5 insertions(+), 14 deletions(-)
>
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index bd7a70b..c5f7e03 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -7429,7 +7429,7 @@ void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
>  
>  	for (i = 0; i < KVM_NR_PAGE_SIZES; ++i) {
>  		if (!dont || free->arch.rmap[i] != dont->arch.rmap[i]) {
> -			kvm_kvfree(free->arch.rmap[i]);
> +			kvfree(free->arch.rmap[i]);
>  			free->arch.rmap[i] = NULL;
>  		}
>  		if (i == 0)
> @@ -7437,7 +7437,7 @@ void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
>  
>  		if (!dont || free->arch.lpage_info[i - 1] !=
>  			     dont->arch.lpage_info[i - 1]) {
> -			kvm_kvfree(free->arch.lpage_info[i - 1]);
> +			kvfree(free->arch.lpage_info[i - 1]);
>  			free->arch.lpage_info[i - 1] = NULL;
>  		}
>  	}
> @@ -7491,12 +7491,12 @@ int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
>  
>  out_free:
>  	for (i = 0; i < KVM_NR_PAGE_SIZES; ++i) {
> -		kvm_kvfree(slot->arch.rmap[i]);
> +		kvfree(slot->arch.rmap[i]);
>  		slot->arch.rmap[i] = NULL;
>  		if (i == 0)
>  			continue;
>  
> -		kvm_kvfree(slot->arch.lpage_info[i - 1]);
> +		kvfree(slot->arch.lpage_info[i - 1]);
>  		slot->arch.lpage_info[i - 1] = NULL;
>  	}
>  	return -ENOMEM;
> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
> index d12b210..0f574eb 100644
> --- a/include/linux/kvm_host.h
> +++ b/include/linux/kvm_host.h
> @@ -658,7 +658,6 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu);
>  int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu);
>  
>  void *kvm_kvzalloc(unsigned long size);
> -void kvm_kvfree(const void *addr);
>  
>  #ifndef __KVM_HAVE_ARCH_VM_ALLOC
>  static inline struct kvm *kvm_arch_alloc_vm(void)
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index a109370..6f1a9c2 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -539,20 +539,12 @@ void *kvm_kvzalloc(unsigned long size)
>  		return kzalloc(size, GFP_KERNEL);
>  }
>  
> -void kvm_kvfree(const void *addr)
> -{
> -	if (is_vmalloc_addr(addr))
> -		vfree(addr);
> -	else
> -		kfree(addr);
> -}
> -
>  static void kvm_destroy_dirty_bitmap(struct kvm_memory_slot *memslot)
>  {
>  	if (!memslot->dirty_bitmap)
>  		return;
>  
> -	kvm_kvfree(memslot->dirty_bitmap);
> +	kvfree(memslot->dirty_bitmap);
>  	memslot->dirty_bitmap = NULL;
>  }

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

* Re: [PATCH] KVM: Get rid of kvm_kvfree()
  2015-02-24 20:29 [PATCH] KVM: Get rid of kvm_kvfree() Thomas Huth
  2015-02-24 21:21 ` Bandan Das
@ 2015-03-09 15:39 ` Thomas Huth
  2015-03-09 16:14   ` Paolo Bonzini
  2015-03-09 21:40 ` Marcelo Tosatti
  2 siblings, 1 reply; 5+ messages in thread
From: Thomas Huth @ 2015-03-09 15:39 UTC (permalink / raw)
  To: kvm; +Cc: Gleb Natapov, Paolo Bonzini

On Tue, 24 Feb 2015 21:29:25 +0100
Thomas Huth <thuth@linux.vnet.ibm.com> wrote:

> kvm_kvfree() provides exactly the same functionality as the
> new common kvfree() function - so let's simply replace the
> kvm function with the common function.
> 
> Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
> ---
>  arch/x86/kvm/x86.c       |    8 ++++----
>  include/linux/kvm_host.h |    1 -
>  virt/kvm/kvm_main.c      |   10 +---------
>  3 files changed, 5 insertions(+), 14 deletions(-)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index bd7a70b..c5f7e03 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -7429,7 +7429,7 @@ void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
> 
>  	for (i = 0; i < KVM_NR_PAGE_SIZES; ++i) {
>  		if (!dont || free->arch.rmap[i] != dont->arch.rmap[i]) {
> -			kvm_kvfree(free->arch.rmap[i]);
> +			kvfree(free->arch.rmap[i]);
>  			free->arch.rmap[i] = NULL;
>  		}
>  		if (i == 0)
> @@ -7437,7 +7437,7 @@ void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
> 
>  		if (!dont || free->arch.lpage_info[i - 1] !=
>  			     dont->arch.lpage_info[i - 1]) {
> -			kvm_kvfree(free->arch.lpage_info[i - 1]);
> +			kvfree(free->arch.lpage_info[i - 1]);
>  			free->arch.lpage_info[i - 1] = NULL;
>  		}
>  	}
> @@ -7491,12 +7491,12 @@ int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
> 
>  out_free:
>  	for (i = 0; i < KVM_NR_PAGE_SIZES; ++i) {
> -		kvm_kvfree(slot->arch.rmap[i]);
> +		kvfree(slot->arch.rmap[i]);
>  		slot->arch.rmap[i] = NULL;
>  		if (i == 0)
>  			continue;
> 
> -		kvm_kvfree(slot->arch.lpage_info[i - 1]);
> +		kvfree(slot->arch.lpage_info[i - 1]);
>  		slot->arch.lpage_info[i - 1] = NULL;
>  	}
>  	return -ENOMEM;
> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
> index d12b210..0f574eb 100644
> --- a/include/linux/kvm_host.h
> +++ b/include/linux/kvm_host.h
> @@ -658,7 +658,6 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu);
>  int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu);
> 
>  void *kvm_kvzalloc(unsigned long size);
> -void kvm_kvfree(const void *addr);
> 
>  #ifndef __KVM_HAVE_ARCH_VM_ALLOC
>  static inline struct kvm *kvm_arch_alloc_vm(void)
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index a109370..6f1a9c2 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -539,20 +539,12 @@ void *kvm_kvzalloc(unsigned long size)
>  		return kzalloc(size, GFP_KERNEL);
>  }
> 
> -void kvm_kvfree(const void *addr)
> -{
> -	if (is_vmalloc_addr(addr))
> -		vfree(addr);
> -	else
> -		kfree(addr);
> -}
> -
>  static void kvm_destroy_dirty_bitmap(struct kvm_memory_slot *memslot)
>  {
>  	if (!memslot->dirty_bitmap)
>  		return;
> 
> -	kvm_kvfree(memslot->dirty_bitmap);
> +	kvfree(memslot->dirty_bitmap);
>  	memslot->dirty_bitmap = NULL;
>  }
> 

ping?

 Thomas


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

* Re: [PATCH] KVM: Get rid of kvm_kvfree()
  2015-03-09 15:39 ` Thomas Huth
@ 2015-03-09 16:14   ` Paolo Bonzini
  0 siblings, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2015-03-09 16:14 UTC (permalink / raw)
  To: Thomas Huth, kvm; +Cc: Gleb Natapov, Marcelo Tosatti



On 09/03/2015 16:39, Thomas Huth wrote:
> On Tue, 24 Feb 2015 21:29:25 +0100
> Thomas Huth <thuth@linux.vnet.ibm.com> wrote:
> 
>> kvm_kvfree() provides exactly the same functionality as the
>> new common kvfree() function - so let's simply replace the
>> kvm function with the common function.
>>
>> Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
>> ---
>>  arch/x86/kvm/x86.c       |    8 ++++----
>>  include/linux/kvm_host.h |    1 -
>>  virt/kvm/kvm_main.c      |   10 +---------
>>  3 files changed, 5 insertions(+), 14 deletions(-)
>>
>> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
>> index bd7a70b..c5f7e03 100644
>> --- a/arch/x86/kvm/x86.c
>> +++ b/arch/x86/kvm/x86.c
>> @@ -7429,7 +7429,7 @@ void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
>>
>>  	for (i = 0; i < KVM_NR_PAGE_SIZES; ++i) {
>>  		if (!dont || free->arch.rmap[i] != dont->arch.rmap[i]) {
>> -			kvm_kvfree(free->arch.rmap[i]);
>> +			kvfree(free->arch.rmap[i]);
>>  			free->arch.rmap[i] = NULL;
>>  		}
>>  		if (i == 0)
>> @@ -7437,7 +7437,7 @@ void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
>>
>>  		if (!dont || free->arch.lpage_info[i - 1] !=
>>  			     dont->arch.lpage_info[i - 1]) {
>> -			kvm_kvfree(free->arch.lpage_info[i - 1]);
>> +			kvfree(free->arch.lpage_info[i - 1]);
>>  			free->arch.lpage_info[i - 1] = NULL;
>>  		}
>>  	}
>> @@ -7491,12 +7491,12 @@ int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
>>
>>  out_free:
>>  	for (i = 0; i < KVM_NR_PAGE_SIZES; ++i) {
>> -		kvm_kvfree(slot->arch.rmap[i]);
>> +		kvfree(slot->arch.rmap[i]);
>>  		slot->arch.rmap[i] = NULL;
>>  		if (i == 0)
>>  			continue;
>>
>> -		kvm_kvfree(slot->arch.lpage_info[i - 1]);
>> +		kvfree(slot->arch.lpage_info[i - 1]);
>>  		slot->arch.lpage_info[i - 1] = NULL;
>>  	}
>>  	return -ENOMEM;
>> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
>> index d12b210..0f574eb 100644
>> --- a/include/linux/kvm_host.h
>> +++ b/include/linux/kvm_host.h
>> @@ -658,7 +658,6 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu);
>>  int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu);
>>
>>  void *kvm_kvzalloc(unsigned long size);
>> -void kvm_kvfree(const void *addr);
>>
>>  #ifndef __KVM_HAVE_ARCH_VM_ALLOC
>>  static inline struct kvm *kvm_arch_alloc_vm(void)
>> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
>> index a109370..6f1a9c2 100644
>> --- a/virt/kvm/kvm_main.c
>> +++ b/virt/kvm/kvm_main.c
>> @@ -539,20 +539,12 @@ void *kvm_kvzalloc(unsigned long size)
>>  		return kzalloc(size, GFP_KERNEL);
>>  }
>>
>> -void kvm_kvfree(const void *addr)
>> -{
>> -	if (is_vmalloc_addr(addr))
>> -		vfree(addr);
>> -	else
>> -		kfree(addr);
>> -}
>> -
>>  static void kvm_destroy_dirty_bitmap(struct kvm_memory_slot *memslot)
>>  {
>>  	if (!memslot->dirty_bitmap)
>>  		return;
>>
>> -	kvm_kvfree(memslot->dirty_bitmap);
>> +	kvfree(memslot->dirty_bitmap);
>>  	memslot->dirty_bitmap = NULL;
>>  }
>>
> 
> ping?

This must have slipped through the cracks.

Acked-by: Paolo Bonzini <pbonzini@redhat.com>

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

* Re: [PATCH] KVM: Get rid of kvm_kvfree()
  2015-02-24 20:29 [PATCH] KVM: Get rid of kvm_kvfree() Thomas Huth
  2015-02-24 21:21 ` Bandan Das
  2015-03-09 15:39 ` Thomas Huth
@ 2015-03-09 21:40 ` Marcelo Tosatti
  2 siblings, 0 replies; 5+ messages in thread
From: Marcelo Tosatti @ 2015-03-09 21:40 UTC (permalink / raw)
  To: Thomas Huth; +Cc: kvm

On Tue, Feb 24, 2015 at 09:29:25PM +0100, Thomas Huth wrote:
> kvm_kvfree() provides exactly the same functionality as the
> new common kvfree() function - so let's simply replace the
> kvm function with the common function.
> 
> Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>

Applied, thanks.


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

end of thread, other threads:[~2015-03-09 21:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-24 20:29 [PATCH] KVM: Get rid of kvm_kvfree() Thomas Huth
2015-02-24 21:21 ` Bandan Das
2015-03-09 15:39 ` Thomas Huth
2015-03-09 16:14   ` Paolo Bonzini
2015-03-09 21:40 ` Marcelo Tosatti

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