From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F768C4338F for ; Wed, 11 Aug 2021 05:54:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8249C60EE2 for ; Wed, 11 Aug 2021 05:54:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234473AbhHKFyt (ORCPT ); Wed, 11 Aug 2021 01:54:49 -0400 Received: from foss.arm.com ([217.140.110.172]:43190 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233651AbhHKFye (ORCPT ); Wed, 11 Aug 2021 01:54:34 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2D6431FB; Tue, 10 Aug 2021 22:54:08 -0700 (PDT) Received: from [10.163.67.241] (unknown [10.163.67.241]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1EA133F718; Tue, 10 Aug 2021 22:54:04 -0700 (PDT) Subject: Re: [PATCH 3/5] KVM: arm64: Drop check_kvm_target_cpu() based percpu probe To: Will Deacon Cc: linux-arm-kernel@lists.infradead.org, Marc Zyngier , James Morse , Alexandru Elisei , Suzuki K Poulose , Catalin Marinas , kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org References: <1628578961-29097-1-git-send-email-anshuman.khandual@arm.com> <1628578961-29097-4-git-send-email-anshuman.khandual@arm.com> <20210810132822.GC2946@willie-the-truck> From: Anshuman Khandual Message-ID: Date: Wed, 11 Aug 2021 11:24:57 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210810132822.GC2946@willie-the-truck> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >> Cc: James Morse >> Cc: Alexandru Elisei >> Cc: Suzuki K Poulose >> Cc: Catalin Marinas >> Cc: Will Deacon >> Cc: linux-arm-kernel@lists.infradead.org >> Cc: kvmarm@lists.cs.columbia.edu >> Cc: linux-kernel@vger.kernel.org >> Signed-off-by: Anshuman Khandual >> --- >> 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 > > 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.