From patchwork Fri Oct 13 09:38:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 152450 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1768584vqb; Fri, 13 Oct 2023 02:38:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGNGScAteqcyAs9cT1dZbIKOHEEMJTi9bQDW1bXLe9yBOV3pevnYLZdLzalarNH3cPShI8Z X-Received: by 2002:a05:6808:2026:b0:3ad:f5d8:2da9 with SMTP id q38-20020a056808202600b003adf5d82da9mr32608528oiw.4.1697189929403; Fri, 13 Oct 2023 02:38:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697189929; cv=none; d=google.com; s=arc-20160816; b=OuYgWOZ9Mocy5hkjvQWPbkK1vhCwNN3Zhr+J1In74XtQTHmQlonGE2T/W2o1877xS8 AeQBntar/5qX7od4WLrhsDL+kFnL+gGrN3RqqwWcfJDsc8o3PyDNMe5WRrf87QhTrsL4 DHGK/bUC0U6rJDVHhfjusEcwfikT2Qv5aDcr2pUK38xufdgzQXC1RnQjNAQdQK4s0kZm i1SBV3cWAoUmg3kNqi48yMk3IlJbZUI9u9CKPQmEZoIEAtyMCdUPIZoRMibmy4xujG3p 0F6sWef60yB5YnIF1X1EjBDEmsiPPnNzNWoZGFF6tKMo5pcVKz7Q2ltOkXVTzEMJFvxV sYdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=8OpENGFnxAaYj7M8fE6cKf/8eE2Iu8UMtWVNtT2iVz0=; fh=9Et1xDJOjLzpfljkBv6WL6N9yJ3F7a92x/mCc58zBBw=; b=JPHFJ0z+qmhaX9nvFjc14kqKjC3pKWjYYeQslRZGqPDVl9Nx07Y08aBXx8XbmJJfeD x6eWokZli1gTnN8YiHkS4rOpd176T+WEN7dSur0AGRtGkVTsZVpj7txJRYHkMp5jJgav J8CLNV9xQVvyoqSO80sPJXIQdgCOInor+alj6NcSHsFJQii/TTeMbpEEuRkYnNevfyhc JeI2Ba6UxU8BFRzJjTukVMha239mBlIMHWD8rYcbW3P5axCoWNth/mtDMtyG3Gadf159 axo3lKzYOyVUBKoEzPWqSRgn2PTuCa07Vf7orM3Mk370pg7SihglB2wjYuc83vGccH5R kGYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=yoeWq9p2; dkim=neutral (no key) header.i=@linutronix.de header.b=Cxq2aRwK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id by22-20020a056a02059600b00577549e67b9si4891782pgb.589.2023.10.13.02.38.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 02:38:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=yoeWq9p2; dkim=neutral (no key) header.i=@linutronix.de header.b=Cxq2aRwK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id AC16F8038B3A; Fri, 13 Oct 2023 02:38:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231370AbjJMJiZ (ORCPT + 19 others); Fri, 13 Oct 2023 05:38:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231210AbjJMJiK (ORCPT ); Fri, 13 Oct 2023 05:38:10 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CEF3CE; Fri, 13 Oct 2023 02:38:09 -0700 (PDT) Date: Fri, 13 Oct 2023 09:38:07 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1697189887; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8OpENGFnxAaYj7M8fE6cKf/8eE2Iu8UMtWVNtT2iVz0=; b=yoeWq9p2InyIMquxtDF7i8qBK/m0CcHMoZsxmQ6+QMb4fFffshiQWxNyOS6bvxauJZ+uw4 Ec8uQsLzXoBPqbUYvqSmO0CXrji5wCuVHV6NVIBpHX+k9hkgLYJ4g1e/zwHsz/kzS7FWzg AhEEyKIUx9iowJ1msmhVnPEspEUP/xsMNs4E2Skb64Rq5aApJqGbFpo8FeGFzfw4VBNTRN iZWu+DX10s40/d77C25wSSJK+fXmEABkTRetBYofjV7TGGtzGLXR3tcP5AdCT6X4C+hwyO pVBm74QqK8dCNxOsBV3IVsbFNVaemg18Zb3RIzr3Gi9+HZxdBdJb1irgiH0fyg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1697189887; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8OpENGFnxAaYj7M8fE6cKf/8eE2Iu8UMtWVNtT2iVz0=; b=Cxq2aRwKhCEI/Ury96a1CxlDfRvewV0ySg6E0XN4vEZk1OwSNQ4yLXzGui1wW5+NIdHoWt 2lr1KcTd1gBgulDA== From: "tip-bot2 for Thomas Gleixner" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/core] x86/apic: Use BAD_APICID consistently Cc: Thomas Gleixner , Juergen Gross , Sohil Mehta , Michael Kelley , "Peter Zijlstra (Intel)" , Zhang Rui , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230814085112.862835121@linutronix.de> References: <20230814085112.862835121@linutronix.de> MIME-Version: 1.0 Message-ID: <169718988727.3135.6720592549471092966.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 13 Oct 2023 02:38:43 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1774197437969323050 X-GMAIL-MSGID: 1779632627280527208 The following commit has been merged into the x86/core branch of tip: Commit-ID: 9ff4275bc8fd7bd5ac4677e2724397f8db3209bf Gitweb: https://git.kernel.org/tip/9ff4275bc8fd7bd5ac4677e2724397f8db3209bf Author: Thomas Gleixner AuthorDate: Mon, 14 Aug 2023 10:18:39 +02:00 Committer: Thomas Gleixner CommitterDate: Tue, 10 Oct 2023 14:38:18 +02:00 x86/apic: Use BAD_APICID consistently APIC ID checks compare with BAD_APICID all over the place, but some initializers and some code which fiddles with global data structure use -1[U] instead. That simply cannot work at all. Fix it up and use BAD_APICID consistently all over the place. Signed-off-by: Thomas Gleixner Tested-by: Juergen Gross Tested-by: Sohil Mehta Tested-by: Michael Kelley Tested-by: Peter Zijlstra (Intel) Tested-by: Zhang Rui Acked-by: Peter Zijlstra (Intel) Link: https://lore.kernel.org/r/20230814085112.862835121@linutronix.de --- arch/x86/kernel/acpi/boot.c | 2 +- arch/x86/kernel/apic/apic.c | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 2a0ea38..f3e4d35 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -856,7 +856,7 @@ int acpi_unmap_cpu(int cpu) set_apicid_to_node(per_cpu(x86_cpu_to_apicid, cpu), NUMA_NO_NODE); #endif - per_cpu(x86_cpu_to_apicid, cpu) = -1; + per_cpu(x86_cpu_to_apicid, cpu) = BAD_APICID; set_cpu_present(cpu, false); num_processors--; diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 3cdf484..d2b1d60 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -72,7 +72,7 @@ unsigned int num_processors; unsigned disabled_cpus; /* Processor that is doing the boot up */ -unsigned int boot_cpu_physical_apicid __ro_after_init = -1U; +unsigned int boot_cpu_physical_apicid __ro_after_init = BAD_APICID; EXPORT_SYMBOL_GPL(boot_cpu_physical_apicid); u8 boot_cpu_apic_version __ro_after_init; @@ -2318,9 +2318,7 @@ static int nr_logical_cpuids = 1; /* * Used to store mapping between logical CPU IDs and APIC IDs. */ -int cpuid_to_apicid[] = { - [0 ... NR_CPUS - 1] = -1, -}; +int cpuid_to_apicid[] = { [0 ... NR_CPUS - 1] = BAD_APICID, }; bool arch_match_cpu_phys_id(int cpu, u64 phys_id) {