[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87a73dxgk6.fsf@vitty.brq.redhat.com>
Date: Wed, 15 Apr 2020 11:07:53 +0200
From: Vitaly Kuznetsov <vkuznets@...hat.com>
To: Tianjia Zhang <tianjia.zhang@...ux.alibaba.com>
Cc: kvm@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
kvmarm@...ts.cs.columbia.edu, linux-kernel@...r.kernel.org,
pbonzini@...hat.com, sean.j.christopherson@...el.com,
wanpengli@...cent.com, jmattson@...gle.com, joro@...tes.org,
tglx@...utronix.de, mingo@...hat.com, bp@...en8.de, x86@...nel.org,
hpa@...or.com, maz@...nel.org, james.morse@....com,
julien.thierry.kdev@...il.com, suzuki.poulose@....com
Subject: Re: [PATCH] KVM: Optimize kvm_arch_vcpu_ioctl_run function
Tianjia Zhang <tianjia.zhang@...ux.alibaba.com> writes:
> On 2020/4/14 22:26, Vitaly Kuznetsov wrote:
>> Tianjia Zhang <tianjia.zhang@...ux.alibaba.com> writes:
>>
>>> kvm_arch_vcpu_ioctl_run() is only called in the file kvm_main.c,
>>> where vcpu->run is the kvm_run parameter, so it has been replaced.
>>>
>>> Signed-off-by: Tianjia Zhang <tianjia.zhang@...ux.alibaba.com>
>>> ---
>>> arch/x86/kvm/x86.c | 8 ++++----
>>> virt/kvm/arm/arm.c | 2 +-
>>> 2 files changed, 5 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
>>> index 3bf2ecafd027..70e3f4abbd4d 100644
>>> --- a/arch/x86/kvm/x86.c
>>> +++ b/arch/x86/kvm/x86.c
>>> @@ -8726,18 +8726,18 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
>>> r = -EAGAIN;
>>> if (signal_pending(current)) {
>>> r = -EINTR;
>>> - vcpu->run->exit_reason = KVM_EXIT_INTR;
>>> + kvm_run->exit_reason = KVM_EXIT_INTR;
>>
>> I have a more generic question: why do we need to pass 'kvm_run' to
>> kvm_arch_vcpu_ioctl_run() if it can be extracted from 'struct kvm_vcpu'?
>> The only call site looks like
>>
>> virt/kvm/kvm_main.c: r = kvm_arch_vcpu_ioctl_run(vcpu, vcpu->run);
>>
>
> In the earlier version, kvm_run is used to pass parameters with user
> mode and is not included in the vcpu structure, so it has been retained
> until now.
>
In case this is no longer needed I'd suggest we drop 'kvm_run' parameter
and extract it from 'struct kvm_vcpu' when needed. This looks like a
natural add-on to your cleanup patch.
--
Vitaly
Powered by blists - more mailing lists