From patchwork Tue Feb 13 21:04:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 200603 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp808719dyb; Tue, 13 Feb 2024 13:07:42 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV56NYPmLgo3zytZrkr+wN45LsmBu5cYgvqOmiTmufkqlJsxp9EI+s6LLh2WODC1eKDYKWXxUoDEkhmHo6NW2l3ikU6Dw== X-Google-Smtp-Source: AGHT+IFRDq59z7GSXgwQMgl1ImmO3N+8CcJYFqyC6HXZgZMUe/vj9K6JXVSHsPHH46N7ZQ8O4dQ6 X-Received: by 2002:a05:6358:5396:b0:176:9bfd:d08d with SMTP id z22-20020a056358539600b001769bfdd08dmr584755rwe.11.1707858462293; Tue, 13 Feb 2024 13:07:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707858462; cv=pass; d=google.com; s=arc-20160816; b=WnoGxb7qK7JpdS9/RxcsTfihDSMslezUEpYEoXGKQb9aXt+NXJdxjL1QBLYZYcm9x4 xb2lLW+fVVppBXjNIFzRYOjKOwE6xLqiTXFSad5TWcpzY1cS1RbvrLPQOqqiVwE9RmKR x6fSeuCULYcxjEQJjFBCejjnNTlXcIUj5a2fEvpkN6+UJx25AP6LoZKkt2PzXPUWRzPC okVj27liXK2YVFl6MD/gSUl3GqvsZSZ5HDxE2765uUEDmNHTHEgOqp2Twak79EcrS9id yuQSjAcW1z56PZojz7JccB3iIzG/pcZx0Lb6cD4bda/ws+hDIh0n2Z39td6+WTep7ftC r40w== 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=UlFAs8Nix/tvFH+xhoOziGUDeHvRbRHk+x4whJ8zqu8=; fh=n2a0D/1OqCwzWVRQ+yiRCteamvnQIo+Ki6kHFsXGY3s=; b=aSXsspBjEJmYUmlYG8ssi5SUtW8uXa0olJ29Bbhq5XwqvjJBiD3fsEvC1bebh2+Jc2 z/l6OtOBVcDDdqc7HeUrsmVPbSFbb5Gx62ywJ56lMHv/IL8ojrCTGU0lkMLt018hLVCP FX96+wcGCgJds+bdNNpWqrwEBTR/zsO179T1KQhtCCNAZRBUqA9eXyVmLhFhpixFPt8S GkjHWuaaR9Y7ondo5aVkMSkqw7tDwrqeo4BQBMK7JiKkW3NisyI2ki9LyfIe0kgjIAfF sySODQvTwJOLK2P9zu3J9GMBByT6hwFtQhaZUlOUgzoP6zLpgyxJAe4lFTsTY7UAcfDE 32Ag==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=LsSHLMz0; 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-64249-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64249-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de X-Forwarded-Encrypted: i=2; AJvYcCUYeyNQu74IbfJdfVbJ41jc5dHkra5ZKRnEMCGiKyKwCHW7ig83fl7PFba9x8wy3KZFDAGBOTtlDq+ttc8ZaqcsmxZMig== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id i63-20020a638742000000b005dc8572e328si1654881pge.59.2024.02.13.13.07.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 13:07:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-64249-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=LsSHLMz0; 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-64249-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64249-ouuuleilei=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 6C103B25E07 for ; Tue, 13 Feb 2024 21:06:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0BCA16311C; Tue, 13 Feb 2024 21:04:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="LsSHLMz0"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="KS3DzFF+" 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 EABF8629E9 for ; Tue, 13 Feb 2024 21:04:14 +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=1707858256; cv=none; b=OkIBNpro45P3tWmaskWx5+1Vczls9NbGYD+Gz8FdC6ScQkFW83FumOLHAscjabfAcbQ4kmGX11JdMaIaR/Rk4q/26nHui/jwN/ntyZUbIIbpXl7EaXD9ed+/3XZoHX50Sr3TCBlBpG2EZmFHDta+aDIghI1F1hAcwaAG264MSc4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707858256; c=relaxed/simple; bh=RWb1lEoykiTkGHk6zCqksPw05e7o9Z5OQCILoRMlhiY=; h=Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type:Date; b=A8EXO5CkPFbRTD6Hr0P33j9PaPMVLqYh0v0aZ2yghOQ1bG4woKmAGPoA7M8p41W7qLQfBHSNFJmqcO/uHtVT7iUqZ641PzNWkb0Gr4YnakzbDpbJ9t8h5fNcYfvRNadWgReRiGq12a8fZckFZgPEMtoDoEXBjumMiiH/2TS5Mvs= 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=LsSHLMz0; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=KS3DzFF+; 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: <20240212153625.082979150@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1707858253; 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=UlFAs8Nix/tvFH+xhoOziGUDeHvRbRHk+x4whJ8zqu8=; b=LsSHLMz0i/FehNnINr5tNxK+W691nm1t1Cr9k7daWWCxj7LllT8nmqHkKLK7ZILRefkwya 45ixeUt15Cslb8hI/WTranwCiP93h+V/h72Q+YPspmdgS2hmRi1cZVfKn/eS4bt2po+0gP FR5mRO3/qMJ9uxgb8x4fPp5N0R7FJcoz+NEz0QVMO9/F0sep3N4qtQrVi7BfwgKL0YAzQ1 llTcvJGJuDHtI4F802BR+rmzYQHLoM8dWmrRdJLhteT9q2eZW6AkC+NNQFjcoA1nOutz0z Dv//7Ah+L4b61T1mVJ9OwLGCKloJs2u0i4uBHnt+TnTAFnJS/l4OeSFr8xbSdg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1707858253; 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=UlFAs8Nix/tvFH+xhoOziGUDeHvRbRHk+x4whJ8zqu8=; b=KS3DzFF+sy7z7gAicI2h3SWyyaPXRexOL7HhUSA6b+agz4+u9vqNZCSdlse3UKWmJusLNS uB5d4PBv2yXWclBQ== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Tom Lendacky , Andrew Cooper , Arjan van de Ven , Huang Rui , Juergen Gross , Dimitri Sivanich , Sohil Mehta , K Prateek Nayak , Kan Liang , Zhang Rui , "Paul E. McKenney" , Feng Tang , Andy Shevchenko , Michael Kelley , "Peter Zijlstra (Intel)" , Wang Wendy Subject: [patch V6 10/19] x86/smpboot: Teach it about topo.amd_node_id References: <20240212153109.330805450@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Tue, 13 Feb 2024 22:04:13 +0100 (CET) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790819394879289702 X-GMAIL-MSGID: 1790819394879289702 From: Thomas Gleixner 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 Tested-by: Zhang Rui Tested-by: Wang Wendy --- V6: Use cpu_feature_enabled() - Borislav --- 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 @@ -488,6 +488,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"); @@ -509,10 +510,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 (cpu_feature_enabled(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)