diff mbox

[v1,2/3] KVM: s390: no need to inititalize kvm->arch members to 0

Message ID 20180427123613.20624-3-david@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

David Hildenbrand April 27, 2018, 12:36 p.m. UTC
KVM is allocated with kzalloc(), so these members are already 0.

Signed-off-by: David Hildenbrand <david@redhat.com>
---
 arch/s390/kvm/kvm-s390.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

Comments

Janosch Frank April 27, 2018, 1:39 p.m. UTC | #1
On 27.04.2018 14:36, David Hildenbrand wrote:
> KVM is allocated with kzalloc(), so these members are already 0.
> 
> Signed-off-by: David Hildenbrand <david@redhat.com>

Reviewed-by: Janosch Frank <frankja@linux.vnet.ibm.com>

> ---
>  arch/s390/kvm/kvm-s390.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
> index 6efe2b0ba5e1..b3eee3cc6e78 100644
> --- a/arch/s390/kvm/kvm-s390.c
> +++ b/arch/s390/kvm/kvm-s390.c
> @@ -1982,10 +1982,10 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
> 
>  	rc = -ENOMEM;
> 
> -	kvm->arch.use_esca = 0; /* start with basic SCA */
>  	if (!sclp.has_64bscao)
>  		alloc_flags |= GFP_DMA;
>  	rwlock_init(&kvm->arch.sca_lock);
> +	/* start with basic SCA */
>  	kvm->arch.sca = (struct bsca_block *) get_zeroed_page(alloc_flags);
>  	if (!kvm->arch.sca)
>  		goto out_err;
> @@ -2036,8 +2036,6 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
>  	kvm_s390_crypto_init(kvm);
> 
>  	mutex_init(&kvm->arch.float_int.ais_lock);
> -	kvm->arch.float_int.simm = 0;
> -	kvm->arch.float_int.nimm = 0;
>  	spin_lock_init(&kvm->arch.float_int.lock);
>  	for (i = 0; i < FIRQ_LIST_COUNT; i++)
>  		INIT_LIST_HEAD(&kvm->arch.float_int.lists[i]);
> @@ -2063,11 +2061,7 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
>  		kvm->arch.gmap->pfault_enabled = 0;
>  	}
> 
> -	kvm->arch.css_support = 0;
> -	kvm->arch.use_irqchip = 0;
>  	kvm->arch.use_pfmfi = sclp.has_pfmfi;
> -	kvm->arch.epoch = 0;
> -
>  	spin_lock_init(&kvm->arch.start_stop_lock);
>  	kvm_s390_vsie_init(kvm);
>  	kvm_s390_gisa_init(kvm);
>
Collin Walling April 27, 2018, 4:10 p.m. UTC | #2
On 04/27/2018 08:36 AM, David Hildenbrand wrote:
> KVM is allocated with kzalloc(), so these members are already 0.
> 
> Signed-off-by: David Hildenbrand <david@redhat.com>

Reviewed-by: Collin Walling <walling@linux.ibm.com>

> ---
>  arch/s390/kvm/kvm-s390.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
> index 6efe2b0ba5e1..b3eee3cc6e78 100644
> --- a/arch/s390/kvm/kvm-s390.c
> +++ b/arch/s390/kvm/kvm-s390.c
> @@ -1982,10 +1982,10 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
>  
>  	rc = -ENOMEM;
>  
> -	kvm->arch.use_esca = 0; /* start with basic SCA */
>  	if (!sclp.has_64bscao)
>  		alloc_flags |= GFP_DMA;
>  	rwlock_init(&kvm->arch.sca_lock);
> +	/* start with basic SCA */
>  	kvm->arch.sca = (struct bsca_block *) get_zeroed_page(alloc_flags);
>  	if (!kvm->arch.sca)
>  		goto out_err;
> @@ -2036,8 +2036,6 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
>  	kvm_s390_crypto_init(kvm);
>  
>  	mutex_init(&kvm->arch.float_int.ais_lock);
> -	kvm->arch.float_int.simm = 0;
> -	kvm->arch.float_int.nimm = 0;
>  	spin_lock_init(&kvm->arch.float_int.lock);
>  	for (i = 0; i < FIRQ_LIST_COUNT; i++)
>  		INIT_LIST_HEAD(&kvm->arch.float_int.lists[i]);
> @@ -2063,11 +2061,7 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
>  		kvm->arch.gmap->pfault_enabled = 0;
>  	}
>  
> -	kvm->arch.css_support = 0;
> -	kvm->arch.use_irqchip = 0;
>  	kvm->arch.use_pfmfi = sclp.has_pfmfi;
> -	kvm->arch.epoch = 0;
> -
>  	spin_lock_init(&kvm->arch.start_stop_lock);
>  	kvm_s390_vsie_init(kvm);
>  	kvm_s390_gisa_init(kvm);
>
Cornelia Huck April 30, 2018, 12:51 p.m. UTC | #3
On Fri, 27 Apr 2018 14:36:12 +0200
David Hildenbrand <david@redhat.com> wrote:

> KVM is allocated with kzalloc(), so these members are already 0.

I suppose that we will always have a zeroed allocation here, or things
may suddenly break anyway.

> 
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>  arch/s390/kvm/kvm-s390.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)

Reviewed-by: Cornelia Huck <cohuck@redhat.com>
diff mbox

Patch

diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 6efe2b0ba5e1..b3eee3cc6e78 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -1982,10 +1982,10 @@  int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
 
 	rc = -ENOMEM;
 
-	kvm->arch.use_esca = 0; /* start with basic SCA */
 	if (!sclp.has_64bscao)
 		alloc_flags |= GFP_DMA;
 	rwlock_init(&kvm->arch.sca_lock);
+	/* start with basic SCA */
 	kvm->arch.sca = (struct bsca_block *) get_zeroed_page(alloc_flags);
 	if (!kvm->arch.sca)
 		goto out_err;
@@ -2036,8 +2036,6 @@  int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
 	kvm_s390_crypto_init(kvm);
 
 	mutex_init(&kvm->arch.float_int.ais_lock);
-	kvm->arch.float_int.simm = 0;
-	kvm->arch.float_int.nimm = 0;
 	spin_lock_init(&kvm->arch.float_int.lock);
 	for (i = 0; i < FIRQ_LIST_COUNT; i++)
 		INIT_LIST_HEAD(&kvm->arch.float_int.lists[i]);
@@ -2063,11 +2061,7 @@  int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
 		kvm->arch.gmap->pfault_enabled = 0;
 	}
 
-	kvm->arch.css_support = 0;
-	kvm->arch.use_irqchip = 0;
 	kvm->arch.use_pfmfi = sclp.has_pfmfi;
-	kvm->arch.epoch = 0;
-
 	spin_lock_init(&kvm->arch.start_stop_lock);
 	kvm_s390_vsie_init(kvm);
 	kvm_s390_gisa_init(kvm);