Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp282296ybd; Fri, 28 Jun 2019 19:46:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqxnK7uv4en+5F8XV4H4iuh+Tp9dZR8pJkn0fOpoERGNK1PgRFbb3+tYql8U2g2+eGNJWGLG X-Received: by 2002:a63:c5:: with SMTP id 188mr12372258pga.108.1561776398637; Fri, 28 Jun 2019 19:46:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561776398; cv=none; d=google.com; s=arc-20160816; b=UYhFGp/mwHRsGBhZd4VuMcXRS3L2WeQRvGHtrUaOtF4fdHD8I8pfwYDiqxK3N54jWc yLLw3lfUerluemLHrP2i+q9ZMT8KNhiEc+eRz6Y5FAol4Tb1JgqhZZnjlI4zI4TDp45K sz7w4hTMfEj8/X6nLCwgk3YSU0UzNGWU5qwX++UqzhMH0ZcKFtiqH6MAUI9u5CBbpw8N YkrtUnlA6yTEAFp/NJ7daNUQdgSsw0hIPDbNWIRWaqRmYfre5tN0GEmlE1zO6KLqSVNS WOvotaC3/nSRoKdLZ7SkRug1A5otLn+fiX0VkT85DoNgsjIZiP8OvTSh6lHzHUsRk7ZB BQ5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=l7yFY/d43YGiyBOiY6Cjx61nivpMdCm0RytpWhivEkM=; b=MbTvhSrlUU1amqtnBnwblq1BgHKmsE4yHHTTFNGbFutJRCD4VjjRuuTawn4vCS0kYI lLJYTpIiOuIm3WA18s1DxtxWvkEihMwErJDIxFOus01miHdHj9wGtmnjuLqltRYf9Jsc Ci+fNqUuRd0R9p8wK75PiESnnLsaKW7JQprFuE1YC76JymXdRZy6YmkjKwAwhogQ+Bgw dPGEriwMYKJTXY2Ytzldv3T+MH9T8yrLi1zzKAgCd1FzlIcogpmuLv3OdYmvVrGhH9ZI CoM5I+F5f+bCiJ+FyJLxcIoNQVt/C+FJ+CFX8IqBnTOLHQ9s+HpUUF3ncrAsvprk01LE tl8w== 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 33si3605039pli.144.2019.06.28.19.46.22; Fri, 28 Jun 2019 19:46:38 -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 S1726844AbfF2Coy (ORCPT + 99 others); Fri, 28 Jun 2019 22:44:54 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:8240 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726702AbfF2Cox (ORCPT ); Fri, 28 Jun 2019 22:44:53 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 298FF9071D527054F3DD; Sat, 29 Jun 2019 10:44:51 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.439.0; Sat, 29 Jun 2019 10:44:43 +0800 From: Xiongfeng Wang To: , , CC: , , , , , , , , Subject: [RFC PATCH v2 2/3] arm64: mark all the GICC nodes in MADT as possible cpu Date: Sat, 29 Jun 2019 10:42:34 +0800 Message-ID: <1561776155-38975-3-git-send-email-wangxiongfeng2@huawei.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1561776155-38975-1-git-send-email-wangxiongfeng2@huawei.com> References: <1561776155-38975-1-git-send-email-wangxiongfeng2@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We set 'cpu_possible_mask' based on the enabled GICC node in MADT. If the GICC node is disabled, we will skip initializing the kernel data structure for that CPU. To support CPU hotplug, we need to initialize some CPU related data structure in advance. This patch mark all the GICC nodes as possible CPU and only these enabled GICC nodes as present CPU. Signed-off-by: Xiongfeng Wang --- arch/arm64/kernel/setup.c | 2 +- arch/arm64/kernel/smp.c | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c index 7e541f9..7f4d12a 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -359,7 +359,7 @@ static int __init topology_init(void) for_each_online_node(i) register_one_node(i); - for_each_possible_cpu(i) { + for_each_online_cpu(i) { struct cpu *cpu = &per_cpu(cpu_data.cpu, i); cpu->hotpluggable = 1; register_cpu(cpu, i); diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index 6dcf960..6d9983c 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -525,16 +525,14 @@ struct acpi_madt_generic_interrupt *acpi_cpu_get_madt_gicc(int cpu) { u64 hwid = processor->arm_mpidr; - if (!(processor->flags & ACPI_MADT_ENABLED)) { - pr_debug("skipping disabled CPU entry with 0x%llx MPIDR\n", hwid); - return; - } - if (hwid & ~MPIDR_HWID_BITMASK || hwid == INVALID_HWID) { pr_err("skipping CPU entry with invalid MPIDR 0x%llx\n", hwid); return; } + if (!(processor->flags & ACPI_MADT_ENABLED)) + pr_debug("disabled CPU entry with 0x%llx MPIDR\n", hwid); + if (is_mpidr_duplicate(cpu_count, hwid)) { pr_err("duplicate CPU MPIDR 0x%llx in MADT\n", hwid); return; @@ -755,7 +753,8 @@ void __init smp_prepare_cpus(unsigned int max_cpus) if (err) continue; - set_cpu_present(cpu, true); + if ((cpu_madt_gicc[cpu].flags & ACPI_MADT_ENABLED)) + set_cpu_present(cpu, true); numa_store_cpu_info(cpu); } } -- 1.7.12.4