Received: by 10.213.65.68 with SMTP id h4csp1682733imn; Thu, 15 Mar 2018 06:47:13 -0700 (PDT) X-Google-Smtp-Source: AG47ELs+RcWU5MWKSAz7zJo6a+WhVNOuBP/bFOY2vYqSWXWgArWh1UL12v1LTOqwJcyjWVFg5+uA X-Received: by 10.99.124.92 with SMTP id l28mr6769234pgn.51.1521121633233; Thu, 15 Mar 2018 06:47:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521121633; cv=none; d=google.com; s=arc-20160816; b=g6JaR2nTsDeATGeNR9mM6vVhw99+yqXF0NEKivDx6b4FgX4e9l3wLj62v3Ai2jMvUP NDNWVyxQyc9Zx1pgonvJSc+cNv0i6k+dkEQiIi6+fHlcophSl+Q3A+ptXkJbsdSpU5NG 8T+KKp/ZMfWEvOvLDFTL45nyRJOawSDmU3Gw2W8LOV7TPlpe8VE6Mrg6dhHHsbUegNsO Y/6175RSVTel7KPqO/Mt6MF89oqIPOvbWXIv+xTHQvEw70WHmXiJBkXA1rQ1crRDqp6J OI6N/o0ejK2Eg2GYMsJ0FKGZjIjZB09vFGgD7YWApjWtn2p7lFefcKJzz5yrnT5lGJMA EWJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=kVoT3jcNmMq4K1M4+3/1uQ4BGAQIu+8uiAlJaWYnneo=; b=Cte/lWT/v7d3GWPhHMnA663WlTFOanT+ZWDplYSOU2fecBoS+qG/mMA27xYlz+3Msm w71kwnE302fWwTyegZENQ0wTzxNEhfXnm4pn2DaKwOLviZbAfAsgtYcNxjpdIpinZg6C EauIMoFso9iwpYqHZ6TykC7FXGMLXf+f/fs1QPOrU2PVkJpDsRzh5Ngao9NLEaFijU/A rzdvRNxvZ8eFd1ZwI3ObbsVu4nripz3+suBTQTwqiVtfsJ6AT/fqMXBKee3IC5EpBAzZ B8ivmUpp/akTddtRTVpIVsrqZQL/5tczPnf/69uJgZrUJUBDxi0srz7Hr4Q47wveslXD skxA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h3-v6si3997565plb.725.2018.03.15.06.46.50; Thu, 15 Mar 2018 06:47:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752347AbeCONp2 (ORCPT + 99 others); Thu, 15 Mar 2018 09:45:28 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:53472 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750987AbeCONp0 (ORCPT ); Thu, 15 Mar 2018 09:45:26 -0400 Received: from hsi-kbw-5-158-153-52.hsi19.kabel-badenwuerttemberg.de ([5.158.153.52] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1ewTC8-0008I1-OK; Thu, 15 Mar 2018 14:45:24 +0100 Date: Thu, 15 Mar 2018 14:45:24 +0100 (CET) From: Thomas Gleixner To: Dou Liyang cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, rjw@rjwysocki.net, lenb@kernel.org, rafael@kernel.org, dedekind1@gmail.com, ming.lei@redhat.com, andy.shevchenko@gmail.com Subject: Re: [RFC PATCH v2] ACPI / processor: Fix possible CPUs map In-Reply-To: <20180315030756.5548-1-douly.fnst@cn.fujitsu.com> Message-ID: References: <20180315030756.5548-1-douly.fnst@cn.fujitsu.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 15 Mar 2018, Dou Liyang wrote: > > +static void __init acpi_update_possible_map(void) > +{ > + unsigned int cpu; > + > + if (nr_unique_ids >= nr_cpu_ids) > + return; > + > + /* Don't yet figure out if it's superfluous */ > + if (nr_unique_ids >= cpumask_last(cpu_possible_mask)) > + return; > + > + for_each_cpu_wrap(cpu, cpu_possible_mask, nr_unique_ids) > + set_cpu_possible(cpu, false); > + > + nr_cpu_ids = nr_unique_ids; > + pr_info("Allowing %d possible CPUs\n", nr_cpu_ids); > +} > + > static void __init acpi_processor_check_duplicates(void) > { > /* check the correctness for all processors in ACPI namespace */ > @@ -680,6 +698,9 @@ static void __init acpi_processor_check_duplicates(void) > NULL, NULL, NULL); > acpi_get_devices(ACPI_PROCESSOR_DEVICE_HID, acpi_processor_ids_walk, > NULL, NULL); > + > + /* make possible CPU count more realistic */ > + acpi_update_possible_map(); > } I tested this on a machine which claims to have gazillion of hotplugable CPUs: smpboot: Allowing 152 CPUs, 120 hotplug CPUs setup_percpu: NR_CPUS:512 nr_cpumask_bits:512 nr_cpu_ids:152 nr_node_ids:2 smp: Brought up 2 nodes, 32 CPUs Now with your patch applied it's still saying: smpboot: Allowing 152 CPUs, 120 hotplug CPUs setup_percpu: NR_CPUS:512 nr_cpumask_bits:512 nr_cpu_ids:152 nr_node_ids:2 smp: Brought up 2 nodes, 32 CPUs and the above code runs later on and the result is: nr_unique_ids 1 nr_cpu_ids 152 Allowing 1 possible CPU which subsequently causes the machine to die as we have already 32 CPUs online. So nr_unique_ids is not what it should be and even if it would be the code runs way too late. It needs to run _before_ setup_percpu() is invoked to scale everything correctly. Thanks, tglx