[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a9623c91-a28a-d91d-5311-fcfc4bd13247@redhat.com>
Date: Wed, 22 Feb 2023 13:17:25 +0100
From: Paolo Bonzini <pbonzini@...hat.com>
To: Tianrui Zhao <zhaotianrui@...ngson.cn>
Cc: Huacai Chen <chenhuacai@...nel.org>,
WANG Xuerui <kernel@...0n.name>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
loongarch@...ts.linux.dev, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org, Jens Axboe <axboe@...nel.dk>,
Mark Brown <broonie@...nel.org>,
Alex Deucher <alexander.deucher@....com>,
Oliver Upton <oliver.upton@...ux.dev>, maobibo@...ngson.cn
Subject: Re: [PATCH v2 06/29] LoongArch: KVM: Implement vcpu create and
destroy interface
On 2/22/23 02:52, Tianrui Zhao wrote:
>>
>>> + vcpu->arch.guest_eentry = (unsigned long)kvm_context->kvm_eentry;
>>> + vcpu->arch.vcpu_run = kvm_context->kvm_enter_guest;
>>> + vcpu->arch.handle_exit = _kvm_handle_exit;
>>
>> Here as well, whatever is constant must not be stored in struct
>> kvm_arch_vcpu.
>>
>> Paolo
>
> Thanks, we use this in vcpu_arch because the vcpu_arch is used as
> argument in switch.S' methods, we can quickly access the guest_eentry
> and handle_exit by using the KVM_ARCH_GEENTRY, KVM_ARCH_HANDLE_EXIT
> offsets. If we change to global variable , we should relocate it in
> switch.S and may lead to lower accessing speed.
For guest_eentry and handle_exit this is correct so you can add a
comment in kvm_host.h, like
/* Pointers stored here for easy access from assembly code. */
However, vcpu->arch.vcpu_run is not used in switch.S so there is no need
to store it in struct kvm_arch_vcpu. Since you're already going to move
kvm_enter_guest out of kvm_context and into a global variable, please
give it the right pointer-to-function type instead of using unsigned long.
Paolo
Powered by blists - more mailing lists