Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751424AbdIOOm3 (ORCPT ); Fri, 15 Sep 2017 10:42:29 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:49046 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751111AbdIOOm2 (ORCPT ); Fri, 15 Sep 2017 10:42:28 -0400 From: Marc Zyngier To: zijun_hu Cc: , , , , , Subject: Re: [PATCH 1/1] irqchip/gicv3: iterate over possible CPUs by for_each_possible_cpu() In-Reply-To: <59BB4375.1030007@zoho.com> (zijun hu's message of "Fri, 15 Sep 2017 11:05:25 +0800") Organization: ARM Ltd References: <59BA1062.1010406@zoho.com> <86o9qdqe7m.fsf@arm.com> <59BB4375.1030007@zoho.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Date: Fri, 15 Sep 2017 15:42:27 +0100 Message-ID: <86bmmcqazw.fsf@arm.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1775 Lines: 49 On Fri, Sep 15 2017 at 11:05:25 am BST, zijun_hu wrote: > On 09/15/2017 03:20 AM, Marc Zyngier wrote: >> On Thu, Sep 14 2017 at 1:15:14 pm BST, zijun_hu wrote: >>> From: zijun_hu >>> >>> get_cpu_number() doesn't use existing helper to iterate over possible >>> CPUs, so error happens in case of discontinuous @cpu_possible_mask >>> such as 0b11110001. >> >> Do you have an example of such a situation? Your patch is definitely an >> improvement, but I'd like to understand how you get there... >> >> Thanks, >> >> M. >> > a few conditions which maybe result in discontiguous @cpu_possible_mask > are noticed and considered of by ARM64 init code as indicated by bellow code > segments: > in arch/arm64/kernel/smp.c : > void __init smp_init_cpus(void) { > ...... > /* > * We need to set the cpu_logical_map entries before enabling > * the cpus so that cpu processor description entries (DT cpu nodes > * and ACPI MADT entries) can be retrieved by matching the cpu hwid > * with entries in cpu_logical_map while initializing the cpus. > * If the cpu set-up fails, invalidate the cpu_logical_map entry. > */ > for (i = 1; i < nr_cpu_ids; i++) { > if (cpu_logical_map(i) != INVALID_HWID) { > if (smp_cpu_setup(i)) > cpu_logical_map(i) = INVALID_HWID; > } > } Right. It is not so much that the CPU doesn't exist as I initially thought (and couldn't really believe that it could happen), but rather that the CPU may have failed to come up (which is slightly more likely). Well spotted. Would you mind respinning it with a commit message that outlines the condition under which this can happen? I'll the take it as a fix post -rc1. Thanks, M. -- Jazz is not dead. It just smells funny.