Received: by 2002:ac8:6714:0:b0:405:464a:c27a with SMTP id e20csp406946qtp; Fri, 28 Jul 2023 05:44:06 -0700 (PDT) X-Google-Smtp-Source: APBJJlFQ9iCQzzaK5hlTZ8HxZpVOgXtYkOYBUCwgTLbkm4q0RjvUvV8bBuzDIW5nCsNgEGOkesSo X-Received: by 2002:a05:6a20:9154:b0:135:9b84:cf43 with SMTP id x20-20020a056a20915400b001359b84cf43mr1846575pzc.28.1690548246565; Fri, 28 Jul 2023 05:44:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690548246; cv=none; d=google.com; s=arc-20160816; b=c3tFS7V2lx1OimBaKGz/n1bIp2+s7GDNO882WChSFclh8AiFvq6uYen+r1JHwV8yFu ZTDbLGULC2wCeYTOzg1V1ZqK1Hvd3am6vzvWfi105OkjlS394FmQnffrMSOrKQJsoAGl O5LgLNpbceSFxSS9drlekO91rJNaZLoSRLWRP4iyup9ITUyawirH3816jy2ZLUwTZsLL GT0BAWC5n/CxdL/Kl0l1Zl34y1+DjTv9K2U8kvlUJPiOuzcwMW8M5SSQzyr51MeOHrjl BcoF4rN94QsuM2VTEjftX595SrLhxn9vpsmJ0mEHPsZjJ7xdZvlbiw2Cj8pSMnTM4ER4 yj8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:mime-version:references:subject:cc:to:from :dkim-signature:dkim-signature:message-id; bh=0qZzNXCX/ZoHr7seeBhbra6OnJEhbVbzB3A+CK/YtPY=; fh=y/slnYrqOPbByUK75sFPvq3cYp2SbZKM1q7UWSqjNrY=; b=0SPAbSQ13WW5E/xjPVOW/imzEqAfwvxYfQeHg7JjngTIUjLs7S0AW460noa5lp7oZE qALuLg7FbQLToGncUd+KU/0SM19z7xEzrhufcKno1J9AzjS6PicT0uNRVgz4UUfO6jlQ 2MDK0sHDndtzLmdaKEwgpD0aXjscbeQe85DKBJwuUPa1HdYRFTguROXYA83avbjporu5 PO97wzIq2XQnAv7nCtK8kl/SIDNIrTOtxe95c50i39gN/ob2LoEpfKSTZn51mC6ZaOfR Yx2dIHpaX+3dxhsSv32YRwxSuTc3lf5OYhO9Y7UGRlXjPmkwlgKVFTlDfoCIXENd19XF UuAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=aQhl26Q+; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 85-20020a630258000000b0054fd9f2dfebsi3010058pgc.704.2023.07.28.05.43.53; Fri, 28 Jul 2023 05:44:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=aQhl26Q+; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235105AbjG1MNo (ORCPT + 99 others); Fri, 28 Jul 2023 08:13:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235834AbjG1MM7 (ORCPT ); Fri, 28 Jul 2023 08:12:59 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C29DD30F9; Fri, 28 Jul 2023 05:12:57 -0700 (PDT) Message-ID: <20230728120930.281607646@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1690546376; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=0qZzNXCX/ZoHr7seeBhbra6OnJEhbVbzB3A+CK/YtPY=; b=aQhl26Q+265Qq/fhYiRlN5fOjPIfdWfE4i/pA7Eu1rA4J3Wj/qwoAa3ee07MJ+9vwfl2Nk KycP3jgfVk5U60YwfcF03eQ7ADhePjr3FnYR1WEUYlelUPaTkAc1XpD6Z6/Q85hW/ElsZH Pr6xvewphzdNBOUaYVo+TbSw4tyDeDX/yJ43zcUsORDxN8y+zpRs1vmOH1IarLjai6sA1Y 6hRD5x8yoHPXh8TjwZPAZHaoQmYFR3CsYB2SM1buBYU4ULsm6nhzycxI57q7jIG+i9ln7z LA8OE/3xN5DwJamyTxVX86Y9Ozt7k5ROgyghBsFuwm4lDirsy0uSx1kAvyGDWQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1690546376; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=0qZzNXCX/ZoHr7seeBhbra6OnJEhbVbzB3A+CK/YtPY=; b=D23S9P1Jgmvogv+U7+ey+IT9etYh6L1tpz90dqcqB5tNkgrHrxgR+LueL/5dsolZ4N8T1U WlujtX9edVEg1KAg== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Tom Lendacky , Andrew Cooper , Arjan van de Ven , "James E.J. Bottomley" , Dick Kennedy , James Smart , "Martin K. Petersen" , linux-scsi@vger.kernel.org, Guenter Roeck , linux-hwmon@vger.kernel.org, Jean Delvare , Huang Rui , Juergen Gross , Steve Wahl , Mike Travis , Dimitri Sivanich , Russ Anderson Subject: [patch v2 11/38] x86/apic: Use BAD_APICID consistently; References: <20230728105650.565799744@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Date: Fri, 28 Jul 2023 14:12:56 +0200 (CEST) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 consistenly all over the place. Signed-off-by: Thomas Gleixner --- arch/x86/kernel/acpi/boot.c | 2 +- arch/x86/kernel/apic/apic.c | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -852,7 +852,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--; --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -70,7 +70,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; @@ -2316,9 +2316,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) {