From patchwork Mon Aug 14 08:54:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 135362 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp2690653vqi; Mon, 14 Aug 2023 04:58:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEASkqRklLO0ZeUeZnL9XPKRfZuz0NZKtfoIWvm5IdOe4i3gBuNyr3UhaOXpHcLVthx9J4/ X-Received: by 2002:a05:6402:219:b0:522:7eaf:c0c0 with SMTP id t25-20020a056402021900b005227eafc0c0mr7358622edv.16.1692014297683; Mon, 14 Aug 2023 04:58:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692014297; cv=none; d=google.com; s=arc-20160816; b=O4/ml3VbaGUzRY9ZzOvalVTMYDm/yFwMt888+lqoKbNsFbVeBh0tbPehirrS2JjllW PZr5oiFDPbb/+bp3oW6sHCbAyInW+HAo1XZQ9Aa/NTymxPm9B6qoklp6Y1JAPmzyYD2R uDNjMNkaDtospC3xMTnQqgJF3Np0r6czYaFiRJZT7xHZCN4TzCt+if5npO86/+2D+dQx mOmZ5r1XKKlJn3IypMkmRoUgnUi7IVve2vwCasLlXktUkQjXU60Ga5oiuKxzBuh9ngNa S1zcFHUPXJ3cWu2hVC8qNrE9fB5TSxH0nM2oDj5Y1okDnszs0YEa6GfcurvJntdo556L QYsw== 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=4iXkw5b5yzZbS9P0CLmmPoIGWnWH9U/f1eKITrK8kpw=; fh=vmKIJtcbtoHWhyuxI4oEq8r1SWZ2V9Rrbp1Orw2DxqA=; b=cVpCjGQcUpfbvkkVSzhPgGoFGAIVV5MGeuHlfbf1w9T1aszu+3F9USnJobtpgd+hAi 7+wyxPESb/sWPw8bl1nw/Wo+9jdSBaxx6RSOziV0WC76HSCB+PnM9JYvBUSiIVlEqvcz Nil0wcC9yqr2FL29Rw2I8m+aNB/JjYfG8jN/ESJ89CeFBO9/tEoTWjRawCE75dbilmMo 4c22xhGM8iy7Py5ikgMQlWd1T7pJDbYe/Dk6TIkRFIeISBtMRj7dUkDKw6WAhNwCwZ3p ZXFbA3EIRyX5AXgA67O6eObWmxUhcuuWHRAOjSXtISs2DurgNZRCBoU0AC/eQASIS0u8 XXDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=sklJX4oA; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=AcsWVBpC; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g10-20020a50ee0a000000b005254e359d2esi3206906eds.293.2023.08.14.04.57.53; Mon, 14 Aug 2023 04:58:17 -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=sklJX4oA; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=AcsWVBpC; 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 S234577AbjHNI4P (ORCPT + 99 others); Mon, 14 Aug 2023 04:56:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230138AbjHNIyb (ORCPT ); Mon, 14 Aug 2023 04:54:31 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48B00E63 for ; Mon, 14 Aug 2023 01:54:26 -0700 (PDT) Message-ID: <20230814085113.943741781@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1692003264; 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=4iXkw5b5yzZbS9P0CLmmPoIGWnWH9U/f1eKITrK8kpw=; b=sklJX4oAPlfvpMTY5+d2q0Au85TgEjcHLA9xdA43L5u3Iyq1cmB0cc/eUvfGMD5J3bhUEX P48mwKli15guQW3EjGUz3yntth+fpRA+bPKMrP+ptYWpECbXH+irPHxkZh44jPMD58+Npy 3F850MWIkdUfpR15izpt9Syk/Chve3K9JS5u6VbaN19hDETY4RClvZURfQC1J+MOMLJb2O U2vl9e3zaqCInXyE8anzLHa3YxZz3GMa32YM58ee+jr9aOL6MM9MJjqL4EiCiWJlFZdpz1 qWQJJv1Hid2nWVshIaFj5oudK+A0efUw3kHsCyulKvBZzldg/AklIssOvznk5Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1692003264; 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=4iXkw5b5yzZbS9P0CLmmPoIGWnWH9U/f1eKITrK8kpw=; b=AcsWVBpCTuRd2eOsOedhyz0xNvRtlRz+J3WJc9E4BhY7ceFU1AJamHR2WOVtK3xHi+jFJr RKMI0EbgBqm+CRAw== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Tom Lendacky , Andrew Cooper , Arjan van de Ven , Huang Rui , Juergen Gross , Dimitri Sivanich , Michael Kelley , Wei Liu , Pu Wen , Qiuxu Zhuo , Sohil Mehta Subject: [patch V4 32/41] x86/smpboot: Teach it about topo.amd_node_id References: <20230814085006.593997112@linutronix.de> MIME-Version: 1.0 Date: Mon, 14 Aug 2023 10:54:24 +0200 (CEST) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1774205584437649504 X-GMAIL-MSGID: 1774205584437649504 When switching AMD over to the new topology parser then the match functions need to look for AMD systems with the extended topology feature at the new topo.amd_node_id member which is then holding the node id information. Signed-off-by: Thomas Gleixner Tested-by: Juergen Gross Tested-by: Sohil Mehta Tested-by: Michael Kelley --- arch/x86/kernel/smpboot.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -499,6 +499,7 @@ static bool match_smt(struct cpuinfo_x86 if (c->topo.pkg_id == o->topo.pkg_id && c->topo.die_id == o->topo.die_id && + c->topo.amd_node_id == o->topo.amd_node_id && per_cpu_llc_id(cpu1) == per_cpu_llc_id(cpu2)) { if (c->topo.core_id == o->topo.core_id) return topology_sane(c, o, "smt"); @@ -520,10 +521,13 @@ static bool match_smt(struct cpuinfo_x86 static bool match_die(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o) { - if (c->topo.pkg_id == o->topo.pkg_id && - c->topo.die_id == o->topo.die_id) - return true; - return false; + if (c->topo.pkg_id != o->topo.pkg_id || c->topo.die_id != o->topo.die_id) + return false; + + if (boot_cpu_has(X86_FEATURE_TOPOEXT) && topology_amd_nodes_per_pkg() > 1) + return c->topo.amd_node_id == o->topo.amd_node_id; + + return true; } static bool match_l2c(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o)