linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Will Deacon <will@kernel.org>
To: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: linux-arm-kernel@lists.infradead.org,
	Marc Zyngier <maz@kernel.org>, James Morse <james.morse@arm.com>,
	Alexandru Elisei <alexandru.elisei@arm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/5] KVM: arm64: Drop check_kvm_target_cpu() based percpu probe
Date: Tue, 10 Aug 2021 14:28:22 +0100	[thread overview]
Message-ID: <20210810132822.GC2946@willie-the-truck> (raw)
In-Reply-To: <1628578961-29097-4-git-send-email-anshuman.khandual@arm.com>

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@kernel.org>
> Cc: James Morse <james.morse@arm.com>
> Cc: Alexandru Elisei <alexandru.elisei@arm.com>
> Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: kvmarm@lists.cs.columbia.edu
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.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@kernel.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?

Will

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-08-10 13:31 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-10  7:02 [PATCH 0/5] KVM: arm64: General cleanups Anshuman Khandual
2021-08-10  7:02 ` [PATCH 1/5] KVM: arm64: Drop direct PAGE_[SHIFT|SIZE] usage as page size Anshuman Khandual
2021-08-10 13:20   ` Will Deacon
2021-08-11  5:32     ` Anshuman Khandual
2021-08-10 13:33   ` Marc Zyngier
2021-08-11  5:34     ` Anshuman Khandual
2021-08-11  8:11       ` Marc Zyngier
2021-08-11  9:37         ` Anshuman Khandual
2021-08-11 10:13           ` Marc Zyngier
2021-08-10  7:02 ` [PATCH 2/5] KVM: arm64: Drop init_common_resources() Anshuman Khandual
2021-08-10 13:21   ` Will Deacon
2021-08-10 15:11     ` Anshuman Khandual
2021-08-10  7:02 ` [PATCH 3/5] KVM: arm64: Drop check_kvm_target_cpu() based percpu probe Anshuman Khandual
2021-08-10 13:28   ` Will Deacon [this message]
2021-08-11  5:54     ` Anshuman Khandual
2021-08-10  7:02 ` [PATCH 4/5] KVM: arm64: Drop unused REQUIRES_VIRT Anshuman Khandual
2021-08-10  7:02 ` [PATCH 5/5] KVM: arm64: Define KVM_PHYS_SHIFT_MIN Anshuman Khandual
2021-08-10 13:29   ` Marc Zyngier
2021-08-10 15:19     ` Anshuman Khandual
2021-08-10 15:32       ` Marc Zyngier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210810132822.GC2946@willie-the-truck \
    --to=will@kernel.org \
    --cc=alexandru.elisei@arm.com \
    --cc=anshuman.khandual@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=james.morse@arm.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=suzuki.poulose@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).