[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c7f87766-bf91-d0c1-ce9d-893506350020@arm.com>
Date: Wed, 11 Aug 2021 11:24:57 +0530
From: Anshuman Khandual <anshuman.khandual@....com>
To: Will Deacon <will@...nel.org>
Cc: linux-arm-kernel@...ts.infradead.org,
Marc Zyngier <maz@...nel.org>,
James Morse <james.morse@....com>,
Alexandru Elisei <alexandru.elisei@....com>,
Suzuki K Poulose <suzuki.poulose@....com>,
Catalin Marinas <catalin.marinas@....com>,
kvmarm@...ts.cs.columbia.edu, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/5] KVM: arm64: Drop check_kvm_target_cpu() based percpu
probe
On 8/10/21 6:58 PM, Will Deacon wrote:
> On Tue, Aug 10, 2021 at 12:32:39PM +0530, Anshuman Khandual wrote:
>> kvm_target_cpu() never returns a negative error code, so check_kvm_target()
>> would never have 'ret' filled with a negative error code. Hence the percpu
>> probe via check_kvm_target_cpu() does not make sense as its never going to
>> find an unsupported CPU, forcing kvm_arch_init() to exit early. Hence lets
>> just drop this percpu probe (and also check_kvm_target_cpu()) altogether.
>>
>> Cc: Marc Zyngier <maz@...nel.org>
>> Cc: James Morse <james.morse@....com>
>> Cc: Alexandru Elisei <alexandru.elisei@....com>
>> Cc: Suzuki K Poulose <suzuki.poulose@....com>
>> Cc: Catalin Marinas <catalin.marinas@....com>
>> Cc: Will Deacon <will@...nel.org>
>> Cc: linux-arm-kernel@...ts.infradead.org
>> Cc: kvmarm@...ts.cs.columbia.edu
>> Cc: linux-kernel@...r.kernel.org
>> Signed-off-by: Anshuman Khandual <anshuman.khandual@....com>
>> ---
>> arch/arm64/kvm/arm.c | 14 --------------
>> 1 file changed, 14 deletions(-)
>>
>> diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
>> index 19560e457c11..16f93678c17e 100644
>> --- a/arch/arm64/kvm/arm.c
>> +++ b/arch/arm64/kvm/arm.c
>> @@ -2010,11 +2010,6 @@ static int finalize_hyp_mode(void)
>> return 0;
>> }
>>
>> -static void check_kvm_target_cpu(void *ret)
>> -{
>> - *(int *)ret = kvm_target_cpu();
>> -}
>> -
>> struct kvm_vcpu *kvm_mpidr_to_vcpu(struct kvm *kvm, unsigned long mpidr)
>> {
>> struct kvm_vcpu *vcpu;
>> @@ -2074,7 +2069,6 @@ void kvm_arch_irq_bypass_start(struct irq_bypass_consumer *cons)
>> int kvm_arch_init(void *opaque)
>> {
>> int err;
>> - int ret, cpu;
>> bool in_hyp_mode;
>>
>> if (!is_hyp_mode_available()) {
>> @@ -2089,14 +2083,6 @@ int kvm_arch_init(void *opaque)
>> kvm_info("Guests without required CPU erratum workarounds can deadlock system!\n" \
>> "Only trusted guests should be used on this system.\n");
>>
>> - for_each_online_cpu(cpu) {
>> - smp_call_function_single(cpu, check_kvm_target_cpu, &ret, 1);
>> - if (ret < 0) {
>> - kvm_err("Error, CPU %d not supported!\n", cpu);
>> - return -ENODEV;
>> - }
>> - }
>
> Looks like kvm_target_cpu() *could* return an error at one time of day (at
> least on 32-bit), but agreed that this checking is no longer needed:
>
> Acked-by: Will Deacon <will@...nel.org>
>
> Perhaps it's worth making the return type of kvm_target_cpu() a u32 to
> make it a bit more explicit that you shouldn't be returning an error code
> there?
Sure, will change the return type to u32.
Powered by blists - more mailing lists