Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2161368ybb; Thu, 26 Mar 2020 23:38:50 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvHfmXvE7QV6CxhD0v/uEDvuLOWQJCHReAPcpzzlyZ02Kk0Xhkug9aPgOUO6X1/+e48CxOX X-Received: by 2002:a4a:9451:: with SMTP id j17mr8000682ooi.30.1585291130823; Thu, 26 Mar 2020 23:38:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585291130; cv=none; d=google.com; s=arc-20160816; b=CwuU66K7C/YpM518YIV4kwyKq+Fsz8FqL9Tf7cF00/SyR0TvVCl4ikWHOlq/XqRg5E y6Vjw3jQ6CDDbukXCpVORRbFvtQz8p8QN4nKN843v9lyBxUfZ3SZ+zOm+rN28jxJyLOa 7xpS1ZaXGYRqFWll6oaSLNFuNx30uORm9ktaaG9R7rU3sZS3yupGsUw7V+vOUiU9DPbT dGdNxCcowvD8MdJuZNRjipOi3DdvR3qNhCIARqrDRnJjDSbsj/b/wsUraboDnT+Cc6gj +00EPtA6EdgAy6jEaERYOt/mUC8Z0GtJZmKCTciYbWJbzdwCiS47kzq7mEc/Y8axWG5v P7rw== 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:mime-version:user-agent:date:message-id:cc:to :subject:from; bh=K6tjVjoyYX6fMWvMl8dndr303VFzp4oRm8P1WiRRTBo=; b=rLroZgMnQgcOzyI34JltIXnO0dqFNDhTzMCB1jGDa7FmQz4SMR4mYbrTo5pCMeH7YJ eo3gW6ySTLjJphp/fzTWo7gDXhUbyixbxKgnQQjrb+b3V5EkvCKorkqHHARwx3FtYV3v 5cWDc0x0Bvi3WebgK//MHHtKPw3EA0ThNXBFAmJbQuuj3txqgTwu1chnVfRlOV4wrZcG WBCYWzYVrmRQt2cqbFPuwaMkAhLGVQ1R6sPW7m0HaOQP6jDTaL7acUHpd5Ls0v2HzV1R Fn0vQe+iQNtqKoBhO4X4ka2mM0zqlf0bQS322sy9hEguj8eOGJddakriyyRZUfqkxJk1 tC8Q== 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 h6si1933110oom.43.2020.03.26.23.38.38; Thu, 26 Mar 2020 23:38:50 -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 S1726427AbgC0GiX (ORCPT + 99 others); Fri, 27 Mar 2020 02:38:23 -0400 Received: from mail.cn.fujitsu.com ([183.91.158.132]:58498 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725857AbgC0GiX (ORCPT ); Fri, 27 Mar 2020 02:38:23 -0400 X-IronPort-AV: E=Sophos;i="5.72,311,1580745600"; d="scan'208";a="87537261" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 27 Mar 2020 14:38:16 +0800 Received: from G08CNEXMBPEKD06.g08.fujitsu.local (unknown [10.167.33.206]) by cn.fujitsu.com (Postfix) with ESMTP id 161CA50A9996; Fri, 27 Mar 2020 14:28:03 +0800 (CST) Received: from [10.167.226.60] (10.167.226.60) by G08CNEXMBPEKD06.g08.fujitsu.local (10.167.33.206) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 27 Mar 2020 14:38:14 +0800 From: Cao jin Subject: Question about prefill_possible_map To: X86 ML , LKML CC: Thomas Gleixner , Borislav Petkov , Ingo Molnar , "H. Peter Anvin" Message-ID: <687566a8-cacd-e0db-6914-d547853c7555@cn.fujitsu.com> Date: Fri, 27 Mar 2020 14:38:23 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.167.226.60] X-ClientProxiedBy: G08CNEXCHPEKD04.g08.fujitsu.local (10.167.33.200) To G08CNEXMBPEKD06.g08.fujitsu.local (10.167.33.206) X-yoursite-MailScanner-ID: 161CA50A9996.AB2A8 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: caoj.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, At the beginning of this function, there is: /* No boot processor was found in mptable or ACPI MADT */ if (!num_processors) { if (boot_cpu_has(X86_FEATURE_APIC)) { int apicid = boot_cpu_physical_apicid; int cpu = hard_smp_processor_id(); pr_warn("Boot CPU (id %d) not listed by BIOS\n", cpu); /* Make sure boot cpu is enumerated */ if (apic->cpu_present_to_apicid(0) == BAD_APICID && apic->apic_id_valid(apicid)) generic_processor_info(apicid, boot_cpu_apic_version); } if (!num_processors) num_processors = 1; } I see 3 cases will go through this code chunk, 1. UP, has no APCI MADT & MP table, but has APIC 2. 2a51fe083eba7f: kdump kernel running on the hot-plugged CPU 3. normal UP(No table, no APIC) And "if (boot_cpu_has(X86_FEATURE_APIC))" covers case 1 & 2 to my understanding. But both cases 1 & 2 already have boot_cpu_physical_apicid initialized from APIC ID register: 1. init_apic_mappings --> register_lapic_address 2. early_acpi_boot_init --> early_acpi_process_madt -->...--> register_lapic_address So my question is: is variable "cpu" redundant? Could it be: diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 69881b2d446c..99fc03511568 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -1456,9 +1456,9 @@ __init void prefill_possible_map(void) if (!num_processors) { if (boot_cpu_has(X86_FEATURE_APIC)) { int apicid = boot_cpu_physical_apicid; - int cpu = hard_smp_processor_id(); - pr_warn("Boot CPU (id %d) not listed by BIOS\n", cpu); + pr_warn("Boot CPU (id %d) not listed by BIOS\n", \ + boot_cpu_physical_apicid); /* Make sure boot cpu is enumerated */ if (apic->cpu_present_to_apicid(0) == BAD_APICID && -- Sincerely, Cao jin