Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp2146464lqa; Tue, 30 Apr 2024 09:14:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWnzL3oVcbS6/oARhJUwRtYwK7lzI5jt3KdlxwWzfhfOC6zEvQeBHSKEPx/5msUY9q1bF0NFNqp50vFb4znVMQtht9kapYkDisGRQ06jw== X-Google-Smtp-Source: AGHT+IGpQObpSUv9O/5ffJyw2/A2bGbA6DI9dbm9sgJk+oil4zA2m6Nnqvwc2E1SuJiK8rE0bT05 X-Received: by 2002:a05:622a:1b86:b0:43b:dd6:82c0 with SMTP id bp6-20020a05622a1b8600b0043b0dd682c0mr4926754qtb.33.1714493650868; Tue, 30 Apr 2024 09:14:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714493650; cv=pass; d=google.com; s=arc-20160816; b=DepjzNBE9hD7Ln2OtgVd6lDnYNVkEvvQHPhjiaqllQ+p4iA9E2jhGkg5R4iOejzb9N 03zPBlJE1+AkPLKnh+dR+bDRKkQBs1nyHioVKqWjhER6FChuzD9+mG8A5sQT5IQA7r7t We9EdKcrbt8PI+m6E+eNS8Cii49KzFvqdPpQ3JJsCLj5rDLMk989c4bBIvk6h2IixldU R0lBzvW+x2SoAmTBeNsnLu66fq7gpy2G0qJ4gvege+LFL2JS6cjLY6CgSq7KrEPYIIIM 0ZAcTDnX30TXYuQhgJQ07vFKzDizH9NpTLdRCzVGEH7BqxPWPIX9mQvphZkXrDQtzCI1 FYow== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:references:in-reply-to:subject:cc:to:dkim-signature :dkim-signature:from; bh=bIuSOLfe5ENoYZ0SjFIuAk7cE658IewkHw8ZxtoyQ3k=; fh=3iAuL7Zz2A233ZjDfW4lp8P9ukZBPEes+utY3bLSkcE=; b=KFHB3st/K9nmpUBtLrse2+5iVn1Wq+kZVvQQfN/hsv+CR2JbhVHuju9KRTH0CoZtMc Xgurx2RBrq2OCqPSp8DN/HZmyG1T7d2Yek4RSMpy1qNRL0eQzZ1sMgMufso0Gk5Ag9ki SUKHbaIVIvqNuBNn7OLHOXacpxnkzpa/1lZ3a3ewk2na6mHZ/cx/nVwboheR8xMSObqf 7OdraU3Pik+4FFrgqgiRh8qPppOogOshMu9njC2gXF6kK9ejnZeAmFDugtj8D4mNCFLk dazEpfbIPLZJ9YmbNLCWaUdHnq2R8T1FSo6+2Hzy01Y0ij1g2QGzi+7VhZ62AqcjBE72 +MkA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="fwIL/r1A"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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-164341-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164341-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 8-20020ac85948000000b0043ab52d6fd6si7313818qtz.474.2024.04.30.09.14.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 09:14:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-164341-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="fwIL/r1A"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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-164341-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164341-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 9444D1C21E97 for ; Tue, 30 Apr 2024 16:14:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9BDAC176FA3; Tue, 30 Apr 2024 16:14:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="fwIL/r1A"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ZY9IU17A" 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 5F541175560 for ; Tue, 30 Apr 2024 16:14:03 +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=1714493644; cv=none; b=hJwezKqdKbrO1lCLO3H1BGCtNGTUV8oUlaIWOfLPGgbUfOdp4y0Uq9BlZY/ml+KbcUjkUfIVH2fccOmfmvblkUDS/GD2303fh/EoMVb6t7Dy0joclefGD7gNAIYestaIiCcFmVzwyApGgb+6MfdCXP30NbFs0HQDz8bGJL8gFR0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714493644; c=relaxed/simple; bh=dPB5zK9sUqob7ONr7G14dO/AgkbaD3ijO6EnAMAwfdQ=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=cZXb/nblKbQtqFxRDpC+sgIqNd99sOUYtJcTgIMFrx0WfzLyUkp6GGwrbOHk6GqB0GX1fterO3T91Wh83UK0JKzbBpQHE/fYR7qEGtum88b2te3FI4TcUsou1l2r+L/97RbQZQGuEIowkrqnnSaRI1nYhqMLDLoPDTw6hkQx/Mo= 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=fwIL/r1A; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=ZY9IU17A; 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 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1714493641; 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: in-reply-to:in-reply-to:references:references; bh=bIuSOLfe5ENoYZ0SjFIuAk7cE658IewkHw8ZxtoyQ3k=; b=fwIL/r1AP/mv/1jDCMWQS3c0pUCdABWFVFCqjv0Pg+NL7g5fLbitsC5dpYKbs4Y4irF0GR JbYOnoCZhSHR5cjmMFWeuSisCKmxSTTxG2pRV/dve0XS/0543ZgIgMt8naauTaNfXWe5H+ wLRAQ9CQTvAyejmyd/JDmeQMhp69RsldMLpm1q5wZIrmgpBUon9myNwo5qHgKhKCZFzEeU z29FNHFk27fKkW1EzrH4zl/8njilaqp8XOffEWUqZwXjS1R0cDiMp6/OJXyxW89zJMy0JY /QKtDGfNgTwZbppXeh/vDW8NKpAe0p1z8XHDOWClCJkP0Z+K5Y3OmGw7/HZUIw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1714493641; 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: in-reply-to:in-reply-to:references:references; bh=bIuSOLfe5ENoYZ0SjFIuAk7cE658IewkHw8ZxtoyQ3k=; b=ZY9IU17AG2BjVOALYrsbKD470mM4bBYO0IezuukNaJ7YYePLyD68y7aaRY5MXkixJyngs9 iuHUgjA+YruhqBBw== To: Juergen Gross , linux-kernel@vger.kernel.org, x86@kernel.org Cc: Juergen Gross , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" Subject: Re: [PATCH 1/2] x86/cpu: fix BSP detection when running as Xen PV guest In-Reply-To: <20240405123434.24822-2-jgross@suse.com> References: <20240405123434.24822-1-jgross@suse.com> <20240405123434.24822-2-jgross@suse.com> Date: Tue, 30 Apr 2024 18:13:58 +0200 Message-ID: <87ttjisu9l.ffs@tglx> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Fri, Apr 05 2024 at 14:34, Juergen Gross wrote: > When booting as a Xen PV guest the boot processor isn't detected > correctly and the following message is shown: > > CPU topo: Boot CPU APIC ID not the first enumerated APIC ID: 0 > 1 > > Additionally this results in one CPU being ignored. > > Fix that by calling the BSP detection logic when registering the boot > CPU's APIC, too. > > Fixes: 5c5682b9f87a ("x86/cpu: Detect real BSP on crash kernels") > Signed-off-by: Juergen Gross > --- > arch/x86/kernel/cpu/topology.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/kernel/cpu/topology.c b/arch/x86/kernel/cpu/topology.c > index aaca8d235dc2..23c3db5e6396 100644 > --- a/arch/x86/kernel/cpu/topology.c > +++ b/arch/x86/kernel/cpu/topology.c > @@ -255,7 +255,7 @@ void __init topology_register_boot_apic(u32 apic_id) > WARN_ON_ONCE(topo_info.boot_cpu_apic_id != BAD_APICID); > > topo_info.boot_cpu_apic_id = apic_id; > - topo_register_apic(apic_id, CPU_ACPIID_INVALID, true); > + topology_register_apic(apic_id, CPU_ACPIID_INVALID, true); No. This does not fix anything at all. It just papers over the underlying problem. Thanks, tglx --- diff --git a/arch/x86/xen/smp_pv.c b/arch/x86/xen/smp_pv.c index 27d1a5b7f571..ac41d83b38d3 100644 --- a/arch/x86/xen/smp_pv.c +++ b/arch/x86/xen/smp_pv.c @@ -154,9 +154,9 @@ static void __init xen_pv_smp_config(void) u32 apicid = 0; int i; - topology_register_boot_apic(apicid++); + topology_register_boot_apic(apicid); - for (i = 1; i < nr_cpu_ids; i++) + for (i = 0; i < nr_cpu_ids; i++) topology_register_apic(apicid++, CPU_ACPIID_INVALID, true); /* Pretend to be a proper enumerated system */