Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752155AbaGaK6l (ORCPT ); Thu, 31 Jul 2014 06:58:41 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:39393 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750978AbaGaK6j (ORCPT ); Thu, 31 Jul 2014 06:58:39 -0400 Message-ID: <53DA2110.8060000@linaro.org> Date: Thu, 31 Jul 2014 18:57:20 +0800 From: Hanjun Guo User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Olof Johansson CC: Catalin Marinas , "Rafael J. Wysocki" , Mark Rutland , Graeme Gregory , Arnd Bergmann , Grant Likely , Sudeep Holla , Will Deacon , Jason Cooper , Marc Zyngier , Bjorn Helgaas , Daniel Lezcano , Mark Brown , Robert Richter , Lv Zheng , Robert Moore , Lorenzo Pieralisi , Liviu Dudau , Randy Dunlap , Charles.Garcia-Tobin@arm.com, linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linaro-acpi-private@linaro.org, Tomasz Nowicki Subject: Re: [PATCH 10/19] ARM64 / ACPI: Get the enable method for SMP initialization in ACPI way References: <1406206825-15590-1-git-send-email-hanjun.guo@linaro.org> <1406206825-15590-11-git-send-email-hanjun.guo@linaro.org> <20140731065426.GA876@quad.lixom.net> In-Reply-To: <20140731065426.GA876@quad.lixom.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2014-7-31 14:54, Olof Johansson wrote: > Hi, > > On Thu, Jul 24, 2014 at 09:00:16PM +0800, Hanjun Guo wrote: >> +/* >> + * In ACPI mode, the cpu possible map was enumerated before SMP >> + * initialization when MADT table was parsed, so we can get the >> + * possible map here to initialize CPUs. >> + */ > > The DT smp init will warn if the kernel has been build with too low NR_CPUS. > Does the ACPI core already warn, or did that go missing with this separate code > path? ACPI code will warn, it is in PATCH 07/19, + if (enabled_cpus >= NR_CPUS) { + pr_warn("NR_CPUS limit of %d reached, Processor %d/0x%llx ignored.\n", + NR_CPUS, total_cpus, mpidr); + return -EINVAL; + } > >> +static void __init acpi_smp_init_cpus(void) >> +{ >> + int cpu; >> + >> + for_each_possible_cpu(cpu) { >> + if (cpu_acpi_read_ops(cpu) != 0) >> + continue; >> + >> + cpu_ops[cpu]->cpu_init(NULL, cpu); >> + } >> +} >> + >> +void __init smp_init_cpus(void) >> +{ >> + if (acpi_disabled) >> + of_smp_init_cpus(); >> + else >> + acpi_smp_init_cpus(); > > I'm liking these deeply split code paths less and less every time I see > them. :( > > I would prefer to set up shared state in separate functions, but keep the > control flow the same. Right now you're splitting it completely. > > I.e. split data setup between the two, but do the loop calling cpu_init() > the same way. (Yes, that will require you to refactor the DT code path > a bit too...) OK, I will dive into the code and figure out if I can fix that as you suggested, thanks for your comments :) Best Regards Hanjun -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/