Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp1342341lqp; Fri, 22 Mar 2024 11:57:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUIK7jD3oqHECnIscsYjLS1ScmcrrpxPkndgBJnmGQHagYC4P+rN9PSZzqTc2ZZKv5v+NDwM8AF5HG707gbDtDzwXGTr2W8JlXEaua06w== X-Google-Smtp-Source: AGHT+IELJKnOGpqZoo8hBJCxebDe3HeJLDSFmgPftmeA23NFNc63pntRW5i5AMt2hvNMhY6c4bLu X-Received: by 2002:a50:cccf:0:b0:56b:ee71:9660 with SMTP id b15-20020a50cccf000000b0056bee719660mr268965edj.27.1711133826671; Fri, 22 Mar 2024 11:57:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711133826; cv=pass; d=google.com; s=arc-20160816; b=h2fuYspjxvz5RcD3SlrK+e2Gvwc9DwGGHNLqnQR50N89VyBHsNiYcmqjEphfl7lVF7 kTfYEIE+n9nnLI7F+iAS3BXpvY13F0NkYq0yXiEMn4zlGHq8KBX5TBqhhJkbTCuyEIep 5eEX5nJ8W53qGiX8dgmXdGygYcxTdMrREihlp5QypRwzT8mk4kQ13tnfwc0AkCdm2VTb U+ADlTzBBYtKeD4sf0gWPCKexo6zcwcbtY2GJsZ4zRQ55kuTUBIjoFIqBbR2L4UxykcA tfviFkj3hTSK4/goXTTcTigEx3srihhOpa5OIr1EYRmafIRaqu2vJDAf+cqotdpJFGhM ieqw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=date:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:subject:cc:to:from:dkim-signature :dkim-signature:message-id; bh=gbbpzA1dBhn4EoRLj5pAAhZD0ORea5PpNSBsBARlZMk=; fh=tUdGdByweHVV+wXw6qzBGm3LKsVsTQuKsQmaC89g1W4=; b=YFzWeRG39OMPQcYHV9onna9MuDOwLRfDz+i1govmsgzXFn4pJo2qkVsFULqFpy1R3i xFY7SfczofxFUxyoOpUqnres5Bwi6SPXvDiK1Glkhd8/7ccKN2GCybAJvjHakmgjm71y pcy+1rrO61sMRIt7DjKECsqBAfmmiuRfQVC3xO3scjU02PFhM0Sp6QzQMt2gvVQprfiM Z4q/LFJ1lZmQgG+lfW1Tk/5juxtTnb+X3pztdQDGrS4B27QvjJq4n8/KS0tntocdjMhJ mK1M3xIyceV4PYxQKXpP3SAUbh8sKss3r6B2VnhYxi1+mQ2B6ssf4feWb9MvKDhY/T9z d+xQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="UY/7Dh13"; dkim=neutral (no key) header.i=@linutronix.de; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-111970-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111970-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id es18-20020a056402381200b0056bf2fe91bcsi96075edb.106.2024.03.22.11.57.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 11:57:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-111970-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="UY/7Dh13"; dkim=neutral (no key) header.i=@linutronix.de; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-111970-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111970-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6512A1F21469 for ; Fri, 22 Mar 2024 18:57:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 22E5C768FB; Fri, 22 Mar 2024 18:56:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="UY/7Dh13"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="X5F9O5Mc" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D285D762F4 for ; Fri, 22 Mar 2024 18:56:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711133800; cv=none; b=mW2dD9vAkhdYwD2HRAVYVeSQqK8vV98uRL3BTWatseRa1RxPw072+guku1DnmhaPk8LTzZj+UQM0wdw6MTIcQ073VcR4pIZ2pGFcWX+vC4mBp7KXLW2rMVzWW0O6SVnE24jP9UYValTqFrIzO/WodRU6ze7DjqvA1CU8oceY/qk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711133800; c=relaxed/simple; bh=7LIVL+tyFkU3dJxDFfy1bMon4UM/38xCAvzQ+08Bna4=; h=Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type:Date; b=VvaGhElIFTKmyvmZ94/50ur5ZBRIQGf25VEQ4pRUx9ZPQp2HWcBA32eXZ6B3mquF+XIfVc8gBfGrCLWtS1dsBwbbpGHkv2+mv+Sw5pE9XYfOgouAldEkAEWXLTzfQGOoBCipnll85/BRsXuMBRfzDeDiHqFRVwXFEsJo8P2IFmY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=UY/7Dh13; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=X5F9O5Mc; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Message-ID: <20240322185305.186943142@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1711133797; 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=gbbpzA1dBhn4EoRLj5pAAhZD0ORea5PpNSBsBARlZMk=; b=UY/7Dh13nZMeYGgeWOajDLuUAVb4wzqEGPdCoAlnwyQebsdLavtnjohaYgqmqc3VdCx8Ol Q1a4CRrHNPOgUcGAeosgk3PiKKOe7vCTzfR2lK+xTV5QARjvoXauOkISsOU1Lqapz/81+Z BsLSV21hiES4kagLfHheiTeqqsOl8j+thBhhFK7fPReurIURznuivOSVtb1sedH/ZR8IU7 AQTyRWfwo1o7aBYVfHS19hdmiGapRJ/athuV+CywCamrg5UWR/8sWq3WVjrKtwUrwVwc0h ckQbj3AT/VXqZcWboTz7oUOwrhmKL+85pXqb5r+a9Untb3PcK8AMXXFPbd3BTw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1711133797; 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=gbbpzA1dBhn4EoRLj5pAAhZD0ORea5PpNSBsBARlZMk=; b=X5F9O5Mc+6dCr7djDNdmMS1hKu8tvILSrF2cvF+ZvBaHxAaag5ncSYbiW0BzCcd0rp1LI9 PZw1QkKLKkYsbXAg== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Guenter Roeck , Linus Torvalds Subject: [patch 2/4] x86/topology: Dont evaluate logical IDs during early boot References: <20240322184944.141421692@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Date: Fri, 22 Mar 2024 19:56:36 +0100 (CET) The local APICs have not yet been enumerated so the logical ID evaluation from the topology bitmaps does not work and would return an error code. Skip the evaluation during the early boot CPUID evaluation and only apply it on the final run. Fixes: 380414be78bf ("x86/cpu/topology: Use topology logical mapping mechanism") Signed-off-by: Thomas Gleixner --- arch/x86/kernel/cpu/topology_common.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) --- a/arch/x86/kernel/cpu/topology_common.c +++ b/arch/x86/kernel/cpu/topology_common.c @@ -140,7 +140,7 @@ static void parse_topology(struct topo_s } } -static void topo_set_ids(struct topo_scan *tscan) +static void topo_set_ids(struct topo_scan *tscan, bool early) { struct cpuinfo_x86 *c = tscan->c; u32 apicid = c->topo.apicid; @@ -148,8 +148,10 @@ static void topo_set_ids(struct topo_sca c->topo.pkg_id = topo_shift_apicid(apicid, TOPO_PKG_DOMAIN); c->topo.die_id = topo_shift_apicid(apicid, TOPO_DIE_DOMAIN); - c->topo.logical_pkg_id = topology_get_logical_id(apicid, TOPO_PKG_DOMAIN); - c->topo.logical_die_id = topology_get_logical_id(apicid, TOPO_DIE_DOMAIN); + if (!early) { + c->topo.logical_pkg_id = topology_get_logical_id(apicid, TOPO_PKG_DOMAIN); + c->topo.logical_die_id = topology_get_logical_id(apicid, TOPO_DIE_DOMAIN); + } /* Package relative core ID */ c->topo.core_id = (apicid & topo_domain_mask(TOPO_PKG_DOMAIN)) >> @@ -187,7 +189,7 @@ void cpu_parse_topology(struct cpuinfo_x tscan.dom_shifts[dom], x86_topo_system.dom_shifts[dom]); } - topo_set_ids(&tscan); + topo_set_ids(&tscan, false); } void __init cpu_init_topology(struct cpuinfo_x86 *c) @@ -208,7 +210,7 @@ void __init cpu_init_topology(struct cpu x86_topo_system.dom_size[dom] = 1U << sft; } - topo_set_ids(&tscan); + topo_set_ids(&tscan, true); /* * AMD systems have Nodes per package which cannot be mapped to