Received: by 10.213.65.68 with SMTP id h4csp125248imn; Thu, 15 Mar 2018 19:55:10 -0700 (PDT) X-Google-Smtp-Source: AG47ELvUB0Sk5+dKVOgUcTln7yE8ZjmxFoH1KPddrs4zfHK1up75SCC1R/9Y7xkFXKsI6v5GlJwR X-Received: by 10.101.83.136 with SMTP id x8mr157981pgq.288.1521168910339; Thu, 15 Mar 2018 19:55:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521168910; cv=none; d=google.com; s=arc-20160816; b=csIhAxuH8Q13wjW/JGxXi1EIRW+CkxZU11k1N8dTFePntkj/4CXrW42TlKA3w/Hoi8 +7l0Cn/NpvWrsP+HOvIdO1Arn6MCxVrghN2Tf8ldn/67uvGTpvdN2568I8dn8Q64HBBd uHm+2C3R0m31q1fSODj84ps0UM+rOqYbD5tKUCXMbPHBrOyxjXDozxs1MJtmYOblpabk ruXJx6U3FLasXwJCorQNFYf88vpPtW+ZTMsMbaGdv0elN1LzZsGo2E/u8+xprPJDdryZ L7RMJJyoUvmnJOupXoqJ0NZjoXhqUci/gJ5XG3D2OANgJ6b4rpPQclZwPMBbFpJ1v5iV Fpkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=S6O2DJ3r2NEtLDk045xuoc6Q6blWOsH1YZd6t027lsc=; b=xOtew3EEXNHRXUQLBZJJWYUfJdSRIXXOMXvgi7qmgVj3yv6OVYzpMzI3i5EneQbv9e DZ1Z2PuvefZq2gOyAPFUL35Ms5CbxxtuywLzKkgvU0mEKMViTZl4pF1EZhxoheZAc34z FtqFcEexeLqQ0h6/tjNPD37fLOLM0VOfVXzzBprT2epmxYQ1SDOvWwQbN2odN/GRoi85 g9tViMkTR9NKdKx8TMDgLTKJl/nLOSd65sm4nWBcd7lqvl8xwTZBM7HUZPNdzr3au7VU +w5SczI6wKgG1qfS79XJnYfRzOkojeaOyI8qAy8IIjJ4MIoSR2fflxfHrtyV1+j4FnjN dZ6w== 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 u6-v6si5202244pls.424.2018.03.15.19.54.55; Thu, 15 Mar 2018 19:55:10 -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 S932883AbeCPCvy (ORCPT + 99 others); Thu, 15 Mar 2018 22:51:54 -0400 Received: from mail.cn.fujitsu.com ([183.91.158.132]:55487 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932651AbeCPCvw (ORCPT ); Thu, 15 Mar 2018 22:51:52 -0400 X-IronPort-AV: E=Sophos;i="5.43,368,1503331200"; d="scan'208";a="37866834" Received: from bogon (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 16 Mar 2018 10:51:50 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (unknown [10.167.33.83]) by cn.fujitsu.com (Postfix) with ESMTP id 78D7248AE761; Fri, 16 Mar 2018 10:51:45 +0800 (CST) Received: from localhost.localdomain (10.167.226.106) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 16 Mar 2018 10:51:45 +0800 Subject: Re: [RFC PATCH v2] ACPI / processor: Fix possible CPUs map To: Thomas Gleixner CC: , , , , , , Ming Lei , Andy Shevchenko References: <20180315030756.5548-1-douly.fnst@cn.fujitsu.com> From: Dou Liyang Message-ID: Date: Fri, 16 Mar 2018 10:51:43 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.167.226.106] X-yoursite-MailScanner-ID: 78D7248AE761.AA798 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: douly.fnst@cn.fujitsu.com X-Spam-Status: No Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Thomas, At 03/15/2018 09:45 PM, Thomas Gleixner wrote: [...] > I tested this on a machine which claims to have gazillion of hotplugable > CPUs: I really appreciate your test. > > 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. > That is so interesting, it proofs that this strategy is risky. I've been wondering how to determine the number of possible CPUs. Due to the diversity of ACPI in different systems, that seems impossible. Why don't I change my mind? Here is a new strategy and I think it is more reasonable and minimally invasive. As we all know, we reset possible CPUs in the prefill_possible_map(), If CONFIG_HOTPLUG_CPU = y : nr_possible_CPUs = num_processors + disabled_cpus.   Before the prefill_possible_map(), *Fix the inaccurate disabled_cpus*:     1) For each disabled CPUs, get it's processor id from ACPI MADT     2) Check whether this processor id is existed in ACPI namespace or not. If false, disabled_cpus--; I will show you the code and test it later. And IMO, the code logic in prefill_possible_map() is a little mess, will try to sort it out first. > 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. > Yes, Got it. Thanks, dou > Thanks, > > tglx > > > > > >