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=-14.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 6C324C433E0 for ; Mon, 18 Jan 2021 11:19:44 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0F3DD221FF for ; Mon, 18 Jan 2021 11:19:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0F3DD221FF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-ID:References:In-Reply-To:Subject:To:From: Date:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=DKc02Tsx1+4ryp5sfyntZpg0dyfX1PYKWvwNJSjngG4=; b=tzr8jyPdQAZpQYE/yDv4gHt+C Y6Y6NfmkrYE+QqGhmj52Cs//ZxCZ6hQks8Ra2i6vYjEWOBpy9pBgj7q0uSC69DHLd8KSykclUrLMV Zx5KFPkEVGxAnGEyvqY9f3XHRBFoN/w7eADYXUa13IESfV106IhkkP+eS+cDUIz6itn9OfpeW5u9p F0ahGiBBext5UMOEkAyxZBXE7GQaf/KlbJxIvlytwx/3LFHTOT65N/jA1XmZXOBAo60pQ462a+GNg tg4g6ACKTHZ1PCXUSyIalFBldXFiKwVipKRlSNseCtLQd8mamE9SQ3yratwR2zJuVVrlwzjU7JHqD ST3Ng2Khg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l1SYF-0004xI-OF; Mon, 18 Jan 2021 11:18:27 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l1SYC-0004w9-Av for linux-arm-kernel@lists.infradead.org; Mon, 18 Jan 2021 11:18:25 +0000 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2481520E65; Mon, 18 Jan 2021 11:18:23 +0000 (UTC) Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94) (envelope-from ) id 1l1SY8-008Sno-QZ; Mon, 18 Jan 2021 11:18:21 +0000 MIME-Version: 1.0 Date: Mon, 18 Jan 2021 11:18:20 +0000 From: Marc Zyngier To: Yejune Deng Subject: Re: [PATCH] KVM: arm64: Fix the return value of smp_call_function_single() In-Reply-To: <20210118093137.3383-1-yejune.deng@gmail.com> References: <20210118093137.3383-1-yejune.deng@gmail.com> User-Agent: Roundcube Webmail/1.4.10 Message-ID: X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: yejune.deng@gmail.com, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210118_061824_458132_000710D4 X-CRM114-Status: GOOD ( 20.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: suzuki.poulose@arm.com, catalin.marinas@arm.com, linux-kernel@vger.kernel.org, james.morse@arm.com, julien.thierry.kdev@gmail.com, will@kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2021-01-18 09:31, Yejune Deng wrote: > In smp_call_function_single(), the 3rd parameter isn't the return value > and it's always positive. But it may return a negative value. So the > 'ret' is should be the return value of the smp_call_function_single(). > > In check_kvm_target_cpu(), 'phys_target' is more readable than 'ret'. > > Signed-off-by: Yejune Deng > --- > arch/arm64/kvm/arm.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c > index 04c44853b103..5fa5c04106de 100644 > --- a/arch/arm64/kvm/arm.c > +++ b/arch/arm64/kvm/arm.c > @@ -1815,9 +1815,9 @@ static int init_hyp_mode(void) > return err; > } > > -static void check_kvm_target_cpu(void *ret) > +static void check_kvm_target_cpu(void *phys_target) > { > - *(int *)ret = kvm_target_cpu(); > + *(int *)phys_target = kvm_target_cpu(); > } > > struct kvm_vcpu *kvm_mpidr_to_vcpu(struct kvm *kvm, unsigned long > mpidr) > @@ -1879,7 +1879,7 @@ void kvm_arch_irq_bypass_start(struct > irq_bypass_consumer *cons) > int kvm_arch_init(void *opaque) > { > int err; > - int ret, cpu; > + int ret, cpu, phys_target; > bool in_hyp_mode; > > if (!is_hyp_mode_available()) { > @@ -1900,7 +1900,7 @@ int kvm_arch_init(void *opaque) > "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); > + ret = smp_call_function_single(cpu, check_kvm_target_cpu, > &phys_target, 1); > if (ret < 0) { > kvm_err("Error, CPU %d not supported!\n", cpu); > return -ENODEV; That's not the purpose of this code. We check the target CPU for so that we can decide to *fail* the KVM init if there is a CPU we do not support (we definitely used to do that with 32bit), and the error message clearly states this. So if you want to handle a cross-call failure, please do that. But don't change the existing semantics of this code. M. -- Jazz is not dead. It just smells funny... _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel