All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Christian Borntraeger <borntraeger@de.ibm.com>,
	Tianjia Zhang <tianjia.zhang@linux.alibaba.com>,
	Cornelia Huck <cohuck@redhat.com>
Cc: pbonzini@redhat.com, tsbogend@alpha.franken.de,
	paulus@ozlabs.org, mpe@ellerman.id.au, benh@kernel.crashing.org,
	frankja@linux.ibm.com, david@redhat.com,
	heiko.carstens@de.ibm.com, gor@linux.ibm.com,
	sean.j.christopherson@intel.com, vkuznets@redhat.com,
	wanpengli@tencent.com, jmattson@google.com, joro@8bytes.org,
	tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
	x86@kernel.org, hpa@zytor.com, maz@kernel.org,
	james.morse@arm.com, julien.thierry.kdev@gmail.com,
	suzuki.poulose@arm.com, christoffer.dall@arm.com,
	peterx@redhat.com, kvm@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	kvmarm@lists.cs.columbia.edu, linux-mips@vger.kernel.org,
	kvm-ppc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/7] KVM: s390: clean up redundant 'kvm_run' parameters
Date: Sun, 26 Apr 2020 14:59:18 +0200	[thread overview]
Message-ID: <73f6ecd0-ac47-eaad-0e4f-2d41c2b34450@redhat.com> (raw)
In-Reply-To: <1d73b700-4a20-3d7a-66d1-29b5afa03f4d@de.ibm.com>

On 23/04/2020 13.00, Christian Borntraeger wrote:
> 
> 
> On 23.04.20 12:58, Tianjia Zhang wrote:
>>
>>
>> On 2020/4/23 18:39, Cornelia Huck wrote:
>>> On Thu, 23 Apr 2020 11:01:43 +0800
>>> Tianjia Zhang <tianjia.zhang@linux.alibaba.com> wrote:
>>>
>>>> On 2020/4/23 0:04, Cornelia Huck wrote:
>>>>> On Wed, 22 Apr 2020 17:58:04 +0200
>>>>> Christian Borntraeger <borntraeger@de.ibm.com> wrote:
>>>>>   
>>>>>> On 22.04.20 15:45, Cornelia Huck wrote:
>>>>>>> On Wed, 22 Apr 2020 20:58:04 +0800
>>>>>>> Tianjia Zhang <tianjia.zhang@linux.alibaba.com> wrote:
>>>>>>>      
>>>>>>>> In the current kvm version, 'kvm_run' has been included in the 'kvm_vcpu'
>>>>>>>> structure. Earlier than historical reasons, many kvm-related function
>>>>>>>
>>>>>>> s/Earlier than/For/ ?
>>>>>>>      
>>>>>>>> parameters retain the 'kvm_run' and 'kvm_vcpu' parameters at the same time.
>>>>>>>> This patch does a unified cleanup of these remaining redundant parameters.
>>>>>>>>
>>>>>>>> Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
>>>>>>>> ---
>>>>>>>>    arch/s390/kvm/kvm-s390.c | 37 ++++++++++++++++++++++---------------
>>>>>>>>    1 file changed, 22 insertions(+), 15 deletions(-)
>>>>>>>>
>>>>>>>> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
>>>>>>>> index e335a7e5ead7..d7bb2e7a07ff 100644
>>>>>>>> --- a/arch/s390/kvm/kvm-s390.c
>>>>>>>> +++ b/arch/s390/kvm/kvm-s390.c
>>>>>>>> @@ -4176,8 +4176,9 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
>>>>>>>>        return rc;
>>>>>>>>    }
>>>>>>>>    -static void sync_regs_fmt2(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
>>>>>>>> +static void sync_regs_fmt2(struct kvm_vcpu *vcpu)
>>>>>>>>    {
>>>>>>>> +    struct kvm_run *kvm_run = vcpu->run;
>>>>>>>>        struct runtime_instr_cb *riccb;
>>>>>>>>        struct gs_cb *gscb;
>>>>>>>>    @@ -4235,7 +4236,7 @@ static void sync_regs_fmt2(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
>>>>>>>>            }
>>>>>>>>            if (vcpu->arch.gs_enabled) {
>>>>>>>>                current->thread.gs_cb = (struct gs_cb *)
>>>>>>>> -                        &vcpu->run->s.regs.gscb;
>>>>>>>> +                        &kvm_run->s.regs.gscb;
>>>>>>>
>>>>>>> Not sure if these changes (vcpu->run-> => kvm_run->) are really worth
>>>>>>> it. (It seems they amount to at least as much as the changes advertised
>>>>>>> in the patch description.)
>>>>>>>
>>>>>>> Other opinions?
>>>>>>
>>>>>> Agreed. It feels kind of random. Maybe just do the first line (move kvm_run from the
>>>>>> function parameter list into the variable declaration)? Not sure if this is better.
>>>>>>   
>>>>>
>>>>> There's more in this patch that I cut... but I think just moving
>>>>> kvm_run from the parameter list would be much less disruptive.
>>>>>    
>>>>
>>>> I think there are two kinds of code(`vcpu->run->` and `kvm_run->`), but
>>>> there will be more disruptive, not less.
>>>
>>> I just fail to see the benefit; sure, kvm_run-> is convenient, but the
>>> current code is just fine, and any rework should be balanced against
>>> the cost (e.g. cluttering git annotate).
>>>
>>
>> cluttering git annotate ? Does it mean Fix xxxx ("comment"). Is it possible to solve this problem by splitting this patch?
> 
> No its about breaking git blame (and bugfix backports) for just a cosmetic improvement.

It could be slightly more than a cosmetic improvement (depending on the
smartness of the compiler): vcpu->run-> are two dereferences, while
kvm_run-> is only one dereference. So it could be slightly more compact
and faster code.

 Thomas


WARNING: multiple messages have this Message-ID (diff)
From: Thomas Huth <thuth@redhat.com>
To: Christian Borntraeger <borntraeger@de.ibm.com>,
	Tianjia Zhang <tianjia.zhang@linux.alibaba.com>,
	Cornelia Huck <cohuck@redhat.com>
Cc: wanpengli@tencent.com, kvm@vger.kernel.org, david@redhat.com,
	heiko.carstens@de.ibm.com, peterx@redhat.com,
	linux-mips@vger.kernel.org, hpa@zytor.com,
	kvmarm@lists.cs.columbia.edu, linux-s390@vger.kernel.org,
	frankja@linux.ibm.com, maz@kernel.org, joro@8bytes.org,
	x86@kernel.org, mingo@redhat.com, julien.thierry.kdev@gmail.com,
	gor@linux.ibm.com, suzuki.poulose@arm.com,
	kvm-ppc@vger.kernel.org, bp@alien8.de, tglx@linutronix.de,
	linux-arm-kernel@lists.infradead.org, jmattson@google.com,
	tsbogend@alpha.franken.de, christoffer.dall@arm.com,
	sean.j.christopherson@intel.com, linux-kernel@vger.kernel.org,
	james.morse@arm.com, pbonzini@redhat.com, vkuznets@redhat.com,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v2 1/7] KVM: s390: clean up redundant 'kvm_run' parameters
Date: Sun, 26 Apr 2020 14:59:18 +0200	[thread overview]
Message-ID: <73f6ecd0-ac47-eaad-0e4f-2d41c2b34450@redhat.com> (raw)
In-Reply-To: <1d73b700-4a20-3d7a-66d1-29b5afa03f4d@de.ibm.com>

On 23/04/2020 13.00, Christian Borntraeger wrote:
> 
> 
> On 23.04.20 12:58, Tianjia Zhang wrote:
>>
>>
>> On 2020/4/23 18:39, Cornelia Huck wrote:
>>> On Thu, 23 Apr 2020 11:01:43 +0800
>>> Tianjia Zhang <tianjia.zhang@linux.alibaba.com> wrote:
>>>
>>>> On 2020/4/23 0:04, Cornelia Huck wrote:
>>>>> On Wed, 22 Apr 2020 17:58:04 +0200
>>>>> Christian Borntraeger <borntraeger@de.ibm.com> wrote:
>>>>>   
>>>>>> On 22.04.20 15:45, Cornelia Huck wrote:
>>>>>>> On Wed, 22 Apr 2020 20:58:04 +0800
>>>>>>> Tianjia Zhang <tianjia.zhang@linux.alibaba.com> wrote:
>>>>>>>      
>>>>>>>> In the current kvm version, 'kvm_run' has been included in the 'kvm_vcpu'
>>>>>>>> structure. Earlier than historical reasons, many kvm-related function
>>>>>>>
>>>>>>> s/Earlier than/For/ ?
>>>>>>>      
>>>>>>>> parameters retain the 'kvm_run' and 'kvm_vcpu' parameters at the same time.
>>>>>>>> This patch does a unified cleanup of these remaining redundant parameters.
>>>>>>>>
>>>>>>>> Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
>>>>>>>> ---
>>>>>>>>    arch/s390/kvm/kvm-s390.c | 37 ++++++++++++++++++++++---------------
>>>>>>>>    1 file changed, 22 insertions(+), 15 deletions(-)
>>>>>>>>
>>>>>>>> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
>>>>>>>> index e335a7e5ead7..d7bb2e7a07ff 100644
>>>>>>>> --- a/arch/s390/kvm/kvm-s390.c
>>>>>>>> +++ b/arch/s390/kvm/kvm-s390.c
>>>>>>>> @@ -4176,8 +4176,9 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
>>>>>>>>        return rc;
>>>>>>>>    }
>>>>>>>>    -static void sync_regs_fmt2(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
>>>>>>>> +static void sync_regs_fmt2(struct kvm_vcpu *vcpu)
>>>>>>>>    {
>>>>>>>> +    struct kvm_run *kvm_run = vcpu->run;
>>>>>>>>        struct runtime_instr_cb *riccb;
>>>>>>>>        struct gs_cb *gscb;
>>>>>>>>    @@ -4235,7 +4236,7 @@ static void sync_regs_fmt2(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
>>>>>>>>            }
>>>>>>>>            if (vcpu->arch.gs_enabled) {
>>>>>>>>                current->thread.gs_cb = (struct gs_cb *)
>>>>>>>> -                        &vcpu->run->s.regs.gscb;
>>>>>>>> +                        &kvm_run->s.regs.gscb;
>>>>>>>
>>>>>>> Not sure if these changes (vcpu->run-> => kvm_run->) are really worth
>>>>>>> it. (It seems they amount to at least as much as the changes advertised
>>>>>>> in the patch description.)
>>>>>>>
>>>>>>> Other opinions?
>>>>>>
>>>>>> Agreed. It feels kind of random. Maybe just do the first line (move kvm_run from the
>>>>>> function parameter list into the variable declaration)? Not sure if this is better.
>>>>>>   
>>>>>
>>>>> There's more in this patch that I cut... but I think just moving
>>>>> kvm_run from the parameter list would be much less disruptive.
>>>>>    
>>>>
>>>> I think there are two kinds of code(`vcpu->run->` and `kvm_run->`), but
>>>> there will be more disruptive, not less.
>>>
>>> I just fail to see the benefit; sure, kvm_run-> is convenient, but the
>>> current code is just fine, and any rework should be balanced against
>>> the cost (e.g. cluttering git annotate).
>>>
>>
>> cluttering git annotate ? Does it mean Fix xxxx ("comment"). Is it possible to solve this problem by splitting this patch?
> 
> No its about breaking git blame (and bugfix backports) for just a cosmetic improvement.

It could be slightly more than a cosmetic improvement (depending on the
smartness of the compiler): vcpu->run-> are two dereferences, while
kvm_run-> is only one dereference. So it could be slightly more compact
and faster code.

 Thomas


WARNING: multiple messages have this Message-ID (diff)
From: Thomas Huth <thuth@redhat.com>
To: Christian Borntraeger <borntraeger@de.ibm.com>,
	Tianjia Zhang <tianjia.zhang@linux.alibaba.com>,
	Cornelia Huck <cohuck@redhat.com>
Cc: wanpengli@tencent.com, kvm@vger.kernel.org, david@redhat.com,
	benh@kernel.crashing.org, heiko.carstens@de.ibm.com,
	linux-mips@vger.kernel.org, paulus@ozlabs.org, hpa@zytor.com,
	kvmarm@lists.cs.columbia.edu, linux-s390@vger.kernel.org,
	frankja@linux.ibm.com, maz@kernel.org, joro@8bytes.org,
	x86@kernel.org, mingo@redhat.com, gor@linux.ibm.com,
	kvm-ppc@vger.kernel.org, bp@alien8.de, tglx@linutronix.de,
	linux-arm-kernel@lists.infradead.org, jmattson@google.com,
	tsbogend@alpha.franken.de, sean.j.christopherson@intel.com,
	linux-kernel@vger.kernel.org, mpe@ellerman.id.au,
	pbonzini@redhat.com, vkuznets@redhat.com,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v2 1/7] KVM: s390: clean up redundant 'kvm_run' parameters
Date: Sun, 26 Apr 2020 14:59:18 +0200	[thread overview]
Message-ID: <73f6ecd0-ac47-eaad-0e4f-2d41c2b34450@redhat.com> (raw)
In-Reply-To: <1d73b700-4a20-3d7a-66d1-29b5afa03f4d@de.ibm.com>

On 23/04/2020 13.00, Christian Borntraeger wrote:
> 
> 
> On 23.04.20 12:58, Tianjia Zhang wrote:
>>
>>
>> On 2020/4/23 18:39, Cornelia Huck wrote:
>>> On Thu, 23 Apr 2020 11:01:43 +0800
>>> Tianjia Zhang <tianjia.zhang@linux.alibaba.com> wrote:
>>>
>>>> On 2020/4/23 0:04, Cornelia Huck wrote:
>>>>> On Wed, 22 Apr 2020 17:58:04 +0200
>>>>> Christian Borntraeger <borntraeger@de.ibm.com> wrote:
>>>>>   
>>>>>> On 22.04.20 15:45, Cornelia Huck wrote:
>>>>>>> On Wed, 22 Apr 2020 20:58:04 +0800
>>>>>>> Tianjia Zhang <tianjia.zhang@linux.alibaba.com> wrote:
>>>>>>>      
>>>>>>>> In the current kvm version, 'kvm_run' has been included in the 'kvm_vcpu'
>>>>>>>> structure. Earlier than historical reasons, many kvm-related function
>>>>>>>
>>>>>>> s/Earlier than/For/ ?
>>>>>>>      
>>>>>>>> parameters retain the 'kvm_run' and 'kvm_vcpu' parameters at the same time.
>>>>>>>> This patch does a unified cleanup of these remaining redundant parameters.
>>>>>>>>
>>>>>>>> Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
>>>>>>>> ---
>>>>>>>>    arch/s390/kvm/kvm-s390.c | 37 ++++++++++++++++++++++---------------
>>>>>>>>    1 file changed, 22 insertions(+), 15 deletions(-)
>>>>>>>>
>>>>>>>> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
>>>>>>>> index e335a7e5ead7..d7bb2e7a07ff 100644
>>>>>>>> --- a/arch/s390/kvm/kvm-s390.c
>>>>>>>> +++ b/arch/s390/kvm/kvm-s390.c
>>>>>>>> @@ -4176,8 +4176,9 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
>>>>>>>>        return rc;
>>>>>>>>    }
>>>>>>>>    -static void sync_regs_fmt2(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
>>>>>>>> +static void sync_regs_fmt2(struct kvm_vcpu *vcpu)
>>>>>>>>    {
>>>>>>>> +    struct kvm_run *kvm_run = vcpu->run;
>>>>>>>>        struct runtime_instr_cb *riccb;
>>>>>>>>        struct gs_cb *gscb;
>>>>>>>>    @@ -4235,7 +4236,7 @@ static void sync_regs_fmt2(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
>>>>>>>>            }
>>>>>>>>            if (vcpu->arch.gs_enabled) {
>>>>>>>>                current->thread.gs_cb = (struct gs_cb *)
>>>>>>>> -                        &vcpu->run->s.regs.gscb;
>>>>>>>> +                        &kvm_run->s.regs.gscb;
>>>>>>>
>>>>>>> Not sure if these changes (vcpu->run-> => kvm_run->) are really worth
>>>>>>> it. (It seems they amount to at least as much as the changes advertised
>>>>>>> in the patch description.)
>>>>>>>
>>>>>>> Other opinions?
>>>>>>
>>>>>> Agreed. It feels kind of random. Maybe just do the first line (move kvm_run from the
>>>>>> function parameter list into the variable declaration)? Not sure if this is better.
>>>>>>   
>>>>>
>>>>> There's more in this patch that I cut... but I think just moving
>>>>> kvm_run from the parameter list would be much less disruptive.
>>>>>    
>>>>
>>>> I think there are two kinds of code(`vcpu->run->` and `kvm_run->`), but
>>>> there will be more disruptive, not less.
>>>
>>> I just fail to see the benefit; sure, kvm_run-> is convenient, but the
>>> current code is just fine, and any rework should be balanced against
>>> the cost (e.g. cluttering git annotate).
>>>
>>
>> cluttering git annotate ? Does it mean Fix xxxx ("comment"). Is it possible to solve this problem by splitting this patch?
> 
> No its about breaking git blame (and bugfix backports) for just a cosmetic improvement.

It could be slightly more than a cosmetic improvement (depending on the
smartness of the compiler): vcpu->run-> are two dereferences, while
kvm_run-> is only one dereference. So it could be slightly more compact
and faster code.

 Thomas

_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

WARNING: multiple messages have this Message-ID (diff)
From: Thomas Huth <thuth@redhat.com>
To: Christian Borntraeger <borntraeger@de.ibm.com>,
	Tianjia Zhang <tianjia.zhang@linux.alibaba.com>,
	Cornelia Huck <cohuck@redhat.com>
Cc: wanpengli@tencent.com, kvm@vger.kernel.org, david@redhat.com,
	benh@kernel.crashing.org, heiko.carstens@de.ibm.com,
	peterx@redhat.com, linux-mips@vger.kernel.org, paulus@ozlabs.org,
	hpa@zytor.com, kvmarm@lists.cs.columbia.edu,
	linux-s390@vger.kernel.org, frankja@linux.ibm.com,
	maz@kernel.org, joro@8bytes.org, x86@kernel.org,
	mingo@redhat.com, julien.thierry.kdev@gmail.com,
	gor@linux.ibm.com, suzuki.poulose@arm.com,
	kvm-ppc@vger.kernel.org, bp@alien8.de, tglx@linutronix.de,
	linux-arm-kernel@lists.infradead.org, jmattson@google.com,
	tsbogend@alpha.franken.de, christoffer.dall@arm.com,
	sean.j.christopherson@intel.com, linux-kernel@vger.kernel.org,
	james.morse@arm.com, mpe@ellerman.id.au, pbonzini@redhat.com,
	vkuznets@redhat.com, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v2 1/7] KVM: s390: clean up redundant 'kvm_run' parameters
Date: Sun, 26 Apr 2020 14:59:18 +0200	[thread overview]
Message-ID: <73f6ecd0-ac47-eaad-0e4f-2d41c2b34450@redhat.com> (raw)
In-Reply-To: <1d73b700-4a20-3d7a-66d1-29b5afa03f4d@de.ibm.com>

On 23/04/2020 13.00, Christian Borntraeger wrote:
> 
> 
> On 23.04.20 12:58, Tianjia Zhang wrote:
>>
>>
>> On 2020/4/23 18:39, Cornelia Huck wrote:
>>> On Thu, 23 Apr 2020 11:01:43 +0800
>>> Tianjia Zhang <tianjia.zhang@linux.alibaba.com> wrote:
>>>
>>>> On 2020/4/23 0:04, Cornelia Huck wrote:
>>>>> On Wed, 22 Apr 2020 17:58:04 +0200
>>>>> Christian Borntraeger <borntraeger@de.ibm.com> wrote:
>>>>>   
>>>>>> On 22.04.20 15:45, Cornelia Huck wrote:
>>>>>>> On Wed, 22 Apr 2020 20:58:04 +0800
>>>>>>> Tianjia Zhang <tianjia.zhang@linux.alibaba.com> wrote:
>>>>>>>      
>>>>>>>> In the current kvm version, 'kvm_run' has been included in the 'kvm_vcpu'
>>>>>>>> structure. Earlier than historical reasons, many kvm-related function
>>>>>>>
>>>>>>> s/Earlier than/For/ ?
>>>>>>>      
>>>>>>>> parameters retain the 'kvm_run' and 'kvm_vcpu' parameters at the same time.
>>>>>>>> This patch does a unified cleanup of these remaining redundant parameters.
>>>>>>>>
>>>>>>>> Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
>>>>>>>> ---
>>>>>>>>    arch/s390/kvm/kvm-s390.c | 37 ++++++++++++++++++++++---------------
>>>>>>>>    1 file changed, 22 insertions(+), 15 deletions(-)
>>>>>>>>
>>>>>>>> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
>>>>>>>> index e335a7e5ead7..d7bb2e7a07ff 100644
>>>>>>>> --- a/arch/s390/kvm/kvm-s390.c
>>>>>>>> +++ b/arch/s390/kvm/kvm-s390.c
>>>>>>>> @@ -4176,8 +4176,9 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
>>>>>>>>        return rc;
>>>>>>>>    }
>>>>>>>>    -static void sync_regs_fmt2(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
>>>>>>>> +static void sync_regs_fmt2(struct kvm_vcpu *vcpu)
>>>>>>>>    {
>>>>>>>> +    struct kvm_run *kvm_run = vcpu->run;
>>>>>>>>        struct runtime_instr_cb *riccb;
>>>>>>>>        struct gs_cb *gscb;
>>>>>>>>    @@ -4235,7 +4236,7 @@ static void sync_regs_fmt2(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
>>>>>>>>            }
>>>>>>>>            if (vcpu->arch.gs_enabled) {
>>>>>>>>                current->thread.gs_cb = (struct gs_cb *)
>>>>>>>> -                        &vcpu->run->s.regs.gscb;
>>>>>>>> +                        &kvm_run->s.regs.gscb;
>>>>>>>
>>>>>>> Not sure if these changes (vcpu->run-> => kvm_run->) are really worth
>>>>>>> it. (It seems they amount to at least as much as the changes advertised
>>>>>>> in the patch description.)
>>>>>>>
>>>>>>> Other opinions?
>>>>>>
>>>>>> Agreed. It feels kind of random. Maybe just do the first line (move kvm_run from the
>>>>>> function parameter list into the variable declaration)? Not sure if this is better.
>>>>>>   
>>>>>
>>>>> There's more in this patch that I cut... but I think just moving
>>>>> kvm_run from the parameter list would be much less disruptive.
>>>>>    
>>>>
>>>> I think there are two kinds of code(`vcpu->run->` and `kvm_run->`), but
>>>> there will be more disruptive, not less.
>>>
>>> I just fail to see the benefit; sure, kvm_run-> is convenient, but the
>>> current code is just fine, and any rework should be balanced against
>>> the cost (e.g. cluttering git annotate).
>>>
>>
>> cluttering git annotate ? Does it mean Fix xxxx ("comment"). Is it possible to solve this problem by splitting this patch?
> 
> No its about breaking git blame (and bugfix backports) for just a cosmetic improvement.

It could be slightly more than a cosmetic improvement (depending on the
smartness of the compiler): vcpu->run-> are two dereferences, while
kvm_run-> is only one dereference. So it could be slightly more compact
and faster code.

 Thomas


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Thomas Huth <thuth@redhat.com>
To: Christian Borntraeger <borntraeger@de.ibm.com>,
	Tianjia Zhang <tianjia.zhang@linux.alibaba.com>,
	Cornelia Huck <cohuck@redhat.com>
Cc: pbonzini@redhat.com, tsbogend@alpha.franken.de,
	paulus@ozlabs.org, mpe@ellerman.id.au, benh@kernel.crashing.org,
	frankja@linux.ibm.com, david@redhat.com,
	heiko.carstens@de.ibm.com, gor@linux.ibm.com,
	sean.j.christopherson@intel.com, vkuznets@redhat.com,
	wanpengli@tencent.com, jmattson@google.com, joro@8bytes.org,
	tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
	x86@kernel.org, hpa@zytor.com, maz@kernel.org,
	james.morse@arm.com, julien.thierry.kdev@gmail.com,
	suzuki.poulose@arm.com, christoffer.dall@arm.com,
	peterx@redhat.com, kvm@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	kvmarm@lists.cs.columbia.edu, linux-mips@vger.kernel.org,
	kvm-ppc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/7] KVM: s390: clean up redundant 'kvm_run' parameters
Date: Sun, 26 Apr 2020 12:59:18 +0000	[thread overview]
Message-ID: <73f6ecd0-ac47-eaad-0e4f-2d41c2b34450@redhat.com> (raw)
In-Reply-To: <1d73b700-4a20-3d7a-66d1-29b5afa03f4d@de.ibm.com>

On 23/04/2020 13.00, Christian Borntraeger wrote:
> 
> 
> On 23.04.20 12:58, Tianjia Zhang wrote:
>>
>>
>> On 2020/4/23 18:39, Cornelia Huck wrote:
>>> On Thu, 23 Apr 2020 11:01:43 +0800
>>> Tianjia Zhang <tianjia.zhang@linux.alibaba.com> wrote:
>>>
>>>> On 2020/4/23 0:04, Cornelia Huck wrote:
>>>>> On Wed, 22 Apr 2020 17:58:04 +0200
>>>>> Christian Borntraeger <borntraeger@de.ibm.com> wrote:
>>>>>   
>>>>>> On 22.04.20 15:45, Cornelia Huck wrote:
>>>>>>> On Wed, 22 Apr 2020 20:58:04 +0800
>>>>>>> Tianjia Zhang <tianjia.zhang@linux.alibaba.com> wrote:
>>>>>>>      
>>>>>>>> In the current kvm version, 'kvm_run' has been included in the 'kvm_vcpu'
>>>>>>>> structure. Earlier than historical reasons, many kvm-related function
>>>>>>>
>>>>>>> s/Earlier than/For/ ?
>>>>>>>      
>>>>>>>> parameters retain the 'kvm_run' and 'kvm_vcpu' parameters at the same time.
>>>>>>>> This patch does a unified cleanup of these remaining redundant parameters.
>>>>>>>>
>>>>>>>> Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
>>>>>>>> ---
>>>>>>>>    arch/s390/kvm/kvm-s390.c | 37 ++++++++++++++++++++++---------------
>>>>>>>>    1 file changed, 22 insertions(+), 15 deletions(-)
>>>>>>>>
>>>>>>>> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
>>>>>>>> index e335a7e5ead7..d7bb2e7a07ff 100644
>>>>>>>> --- a/arch/s390/kvm/kvm-s390.c
>>>>>>>> +++ b/arch/s390/kvm/kvm-s390.c
>>>>>>>> @@ -4176,8 +4176,9 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
>>>>>>>>        return rc;
>>>>>>>>    }
>>>>>>>>    -static void sync_regs_fmt2(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
>>>>>>>> +static void sync_regs_fmt2(struct kvm_vcpu *vcpu)
>>>>>>>>    {
>>>>>>>> +    struct kvm_run *kvm_run = vcpu->run;
>>>>>>>>        struct runtime_instr_cb *riccb;
>>>>>>>>        struct gs_cb *gscb;
>>>>>>>>    @@ -4235,7 +4236,7 @@ static void sync_regs_fmt2(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
>>>>>>>>            }
>>>>>>>>            if (vcpu->arch.gs_enabled) {
>>>>>>>>                current->thread.gs_cb = (struct gs_cb *)
>>>>>>>> -                        &vcpu->run->s.regs.gscb;
>>>>>>>> +                        &kvm_run->s.regs.gscb;
>>>>>>>
>>>>>>> Not sure if these changes (vcpu->run-> => kvm_run->) are really worth
>>>>>>> it. (It seems they amount to at least as much as the changes advertised
>>>>>>> in the patch description.)
>>>>>>>
>>>>>>> Other opinions?
>>>>>>
>>>>>> Agreed. It feels kind of random. Maybe just do the first line (move kvm_run from the
>>>>>> function parameter list into the variable declaration)? Not sure if this is better.
>>>>>>   
>>>>>
>>>>> There's more in this patch that I cut... but I think just moving
>>>>> kvm_run from the parameter list would be much less disruptive.
>>>>>    
>>>>
>>>> I think there are two kinds of code(`vcpu->run->` and `kvm_run->`), but
>>>> there will be more disruptive, not less.
>>>
>>> I just fail to see the benefit; sure, kvm_run-> is convenient, but the
>>> current code is just fine, and any rework should be balanced against
>>> the cost (e.g. cluttering git annotate).
>>>
>>
>> cluttering git annotate ? Does it mean Fix xxxx ("comment"). Is it possible to solve this problem by splitting this patch?
> 
> No its about breaking git blame (and bugfix backports) for just a cosmetic improvement.

It could be slightly more than a cosmetic improvement (depending on the
smartness of the compiler): vcpu->run-> are two dereferences, while
kvm_run-> is only one dereference. So it could be slightly more compact
and faster code.

 Thomas

  parent reply	other threads:[~2020-04-26 12:59 UTC|newest]

Thread overview: 100+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-22 12:58 [PATCH v2 0/7] clean up redundant 'kvm_run' parameters Tianjia Zhang
2020-04-22 12:58 ` Tianjia Zhang
2020-04-22 12:58 ` Tianjia Zhang
2020-04-22 12:58 ` Tianjia Zhang
2020-04-22 12:58 ` Tianjia Zhang
2020-04-22 12:58 ` [PATCH v2 1/7] KVM: s390: " Tianjia Zhang
2020-04-22 12:58   ` Tianjia Zhang
2020-04-22 12:58   ` Tianjia Zhang
2020-04-22 12:58   ` Tianjia Zhang
2020-04-22 12:58   ` Tianjia Zhang
2020-04-22 13:45   ` Cornelia Huck
2020-04-22 13:45     ` Cornelia Huck
2020-04-22 13:45     ` Cornelia Huck
2020-04-22 13:45     ` Cornelia Huck
2020-04-22 13:45     ` Cornelia Huck
2020-04-22 15:58     ` Christian Borntraeger
2020-04-22 15:58       ` Christian Borntraeger
2020-04-22 15:58       ` Christian Borntraeger
2020-04-22 15:58       ` Christian Borntraeger
2020-04-22 15:58       ` Christian Borntraeger
2020-04-22 16:04       ` Cornelia Huck
2020-04-22 16:04         ` Cornelia Huck
2020-04-22 16:04         ` Cornelia Huck
2020-04-22 16:04         ` Cornelia Huck
2020-04-22 16:04         ` Cornelia Huck
2020-04-23  3:01         ` Tianjia Zhang
2020-04-23  3:01           ` Tianjia Zhang
2020-04-23  3:01           ` Tianjia Zhang
2020-04-23  3:01           ` Tianjia Zhang
2020-04-23  3:01           ` Tianjia Zhang
2020-04-23 10:39           ` Cornelia Huck
2020-04-23 10:39             ` Cornelia Huck
2020-04-23 10:39             ` Cornelia Huck
2020-04-23 10:39             ` Cornelia Huck
2020-04-23 10:39             ` Cornelia Huck
2020-04-23 10:58             ` Tianjia Zhang
2020-04-23 10:58               ` Tianjia Zhang
2020-04-23 10:58               ` Tianjia Zhang
2020-04-23 10:58               ` Tianjia Zhang
2020-04-23 10:58               ` Tianjia Zhang
2020-04-23 11:00               ` Christian Borntraeger
2020-04-23 11:00                 ` Christian Borntraeger
2020-04-23 11:00                 ` Christian Borntraeger
2020-04-23 11:00                 ` Christian Borntraeger
2020-04-23 11:00                 ` Christian Borntraeger
2020-04-23 11:11                 ` Tianjia Zhang
2020-04-23 11:11                   ` Tianjia Zhang
2020-04-23 11:11                   ` Tianjia Zhang
2020-04-23 11:11                   ` Tianjia Zhang
2020-04-23 11:11                   ` Tianjia Zhang
2020-04-26 12:59                 ` Thomas Huth [this message]
2020-04-26 12:59                   ` Thomas Huth
2020-04-26 12:59                   ` Thomas Huth
2020-04-26 12:59                   ` Thomas Huth
2020-04-26 12:59                   ` Thomas Huth
2020-04-29  2:20                   ` Tianjia Zhang
2020-04-29  2:20                     ` Tianjia Zhang
2020-04-29  2:20                     ` Tianjia Zhang
2020-04-29  2:20                     ` Tianjia Zhang
2020-04-29  2:20                     ` Tianjia Zhang
2020-04-23  3:14       ` Tianjia Zhang
2020-04-23  3:14         ` Tianjia Zhang
2020-04-23  3:14         ` Tianjia Zhang
2020-04-23  3:14         ` Tianjia Zhang
2020-04-23  3:14         ` Tianjia Zhang
2020-04-23  2:54     ` Tianjia Zhang
2020-04-23  2:54       ` Tianjia Zhang
2020-04-23  2:54       ` Tianjia Zhang
2020-04-23  2:54       ` Tianjia Zhang
2020-04-23  2:54       ` Tianjia Zhang
2020-04-22 12:58 ` [PATCH v2 2/7] KVM: arm64: " Tianjia Zhang
2020-04-22 12:58   ` Tianjia Zhang
2020-04-22 12:58   ` Tianjia Zhang
2020-04-22 12:58   ` Tianjia Zhang
2020-04-22 12:58   ` Tianjia Zhang
2020-04-22 12:58 ` [PATCH v2 3/7] KVM: PPC: Remove redundant kvm_run from vcpu_arch Tianjia Zhang
2020-04-22 12:58   ` Tianjia Zhang
2020-04-22 12:58   ` Tianjia Zhang
2020-04-22 12:58   ` Tianjia Zhang
2020-04-22 12:58   ` Tianjia Zhang
2020-04-22 12:58 ` [PATCH v2 4/7] KVM: PPC: clean up redundant 'kvm_run' parameters Tianjia Zhang
2020-04-22 12:58   ` Tianjia Zhang
2020-04-22 12:58   ` Tianjia Zhang
2020-04-22 12:58   ` Tianjia Zhang
2020-04-22 12:58   ` Tianjia Zhang
2020-04-22 12:58 ` [PATCH v2 5/7] KVM: PPC: clean up redundant kvm_run parameters in assembly Tianjia Zhang
2020-04-22 12:58   ` Tianjia Zhang
2020-04-22 12:58   ` Tianjia Zhang
2020-04-22 12:58   ` Tianjia Zhang
2020-04-22 12:58   ` Tianjia Zhang
2020-04-22 12:58 ` [PATCH v2 6/7] KVM: MIPS: clean up redundant 'kvm_run' parameters Tianjia Zhang
2020-04-22 12:58   ` Tianjia Zhang
2020-04-22 12:58   ` Tianjia Zhang
2020-04-22 12:58   ` Tianjia Zhang
2020-04-22 12:58   ` Tianjia Zhang
2020-04-22 12:58 ` [PATCH v2 7/7] KVM: MIPS: clean up redundant kvm_run parameters in assembly Tianjia Zhang
2020-04-22 12:58   ` Tianjia Zhang
2020-04-22 12:58   ` Tianjia Zhang
2020-04-22 12:58   ` Tianjia Zhang
2020-04-22 12:58   ` Tianjia Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=73f6ecd0-ac47-eaad-0e4f-2d41c2b34450@redhat.com \
    --to=thuth@redhat.com \
    --cc=benh@kernel.crashing.org \
    --cc=borntraeger@de.ibm.com \
    --cc=bp@alien8.de \
    --cc=christoffer.dall@arm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=hpa@zytor.com \
    --cc=james.morse@arm.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=julien.thierry.kdev@gmail.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maz@kernel.org \
    --cc=mingo@redhat.com \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@ozlabs.org \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=sean.j.christopherson@intel.com \
    --cc=suzuki.poulose@arm.com \
    --cc=tglx@linutronix.de \
    --cc=tianjia.zhang@linux.alibaba.com \
    --cc=tsbogend@alpha.franken.de \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.