Received: by 2002:ab2:1347:0:b0:1f4:ac9d:b246 with SMTP id g7csp366911lqg; Thu, 11 Apr 2024 05:45:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVAqj6sXX3LWu3emfECUCYJzuujhPA3j+wveuSbmBz9jh9BByS4h1ogt0041l/NGfIRu39xKwnJq0sYnDuGMK/albrsSEZM0I0gvIBFFg== X-Google-Smtp-Source: AGHT+IFjde2aZ54l42invZZbHz+JfDrAXs2j21igygWKAxla6zi/105VKmN9RXNyrwxzX45VTQaR X-Received: by 2002:a05:6102:26c4:b0:47a:3bd6:583b with SMTP id m4-20020a05610226c400b0047a3bd6583bmr915752vss.23.1712839525800; Thu, 11 Apr 2024 05:45:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712839525; cv=pass; d=google.com; s=arc-20160816; b=ABKtHGQtNiPHOg1FRMy2hzS/aCp4qpWDSuclv8Vez/u+xZ7aHn6SqyCctjcE8ovkou D2TcNXZsnCZJFIp6fLLqO9jQcdR0pyz8930gacO43IxbVHZj4O6H1g2KdhZlRZrvEFwI DlLPSXKReSokN2Zi4PmB0JWv/j2axBQIVQWzwJPDviRwt9x3NtDc+Dkb/7AK5pLgLcvf 4Siyfo3TqH0t/x/8ksDIx+MuiFcBvs6i/lfKbaqZ4XLf2YSb6cuZZVZmgfzER3nBh8yD sT2RPLF0dg8GdBgDn4y5kNwoV1diNFTpsM/x18OifkINuPMoGCdH+QoUtqBeH81v04k+ X1lA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=kBnBVDJnEEo8Cuf29WIXXNXUEw3lOtrkVKsNhIAtadY=; fh=fQtcGq25eOvVJvk/iT6+zcA4TXj8sNO/YeYz3miiHro=; b=ukOL6AIK1CUwgHZ7Sjpmm1v3dT5KmNlOHAKjY0OxRc5DfGvUmMHdkVImZy70ugbL7N Aq9RPy/NDHTvaNcvDj9RXEWgHg6pXG7EDn5t1C+l4xdtxzXd98ZCtrz088u0aqnTjdam 0K7sF1DWdYWd5KO9uPP/dynxFyzUKKXvkqka0h1E1x1my5I1ZUGye0S+FH0SXdx6YHSx Sk+SEuT59qJWVxMZpKuYmhXZsTigb7t+fYhPanyT1nljhKTHc+N1H5ymSWoQRwqoxftL UZUe/sWmOTzf1EHnm/xymsVBkxbml0EQuYkSNWk9HQ4PyRuKZ+rDckxbVYkypVcOc9wx KToQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=cGuxuqF0; 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-140454-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140454-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 n15-20020a05622a040f00b0043447a995b1si1398003qtx.336.2024.04.11.05.45.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 05:45:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-140454-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=cGuxuqF0; 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-140454-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140454-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 7FA1B1C209E8 for ; Thu, 11 Apr 2024 12:45:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1D01D46441; Thu, 11 Apr 2024 12:45:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="cGuxuqF0"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="r2MAAyJS" 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 B3A403A1A2; Thu, 11 Apr 2024 12:45:16 +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=1712839518; cv=none; b=qyJBYTetZDFQhp0gebtPNOl5VTdL6EK2jKI9lvdSIIx0xaVqn3aNApLojN9SudEm7kZR23auEfxVoRBvlMECrogFNYDxE5NQtV0HfQY9GHIqwO8mH8H8zN3wauXD+sUHrFtQhYa0cCRLpt6jnR+IgJQppPmAcVIb71jtwffOsAE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712839518; c=relaxed/simple; bh=KF2dwmuHgUN99Dm4LQ0GMIRgT3qiERf9RA5zZSa5q7g=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=FLZs4yyXEKzS/G2gTyJYK9hVXiCMnBSBiY3+DLXMGltIHmKTz/E6j00qHeJvdL8J58ZKSXiEFCJdt6TUaQsh6G+kk29OMDa4loul4a+kXrE6cTkgw4/Okq7omrq4Y9JEzXSi/xDi5d16a4j3rqxvlFxDd7Xq3NF+FhFgBFSH83U= 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=cGuxuqF0; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=r2MAAyJS; 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 Date: Thu, 11 Apr 2024 12:45:13 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1712839515; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kBnBVDJnEEo8Cuf29WIXXNXUEw3lOtrkVKsNhIAtadY=; b=cGuxuqF0dPCV+VVlqNqAt/68URSZ3N1UxJk6Pav3hFjccVQ35Zx6eOIyoxHibox9L0h9Rd ir598p5UH0826XWejsakLqeLoF/3NXrQTnHheHjFsN/8AbYKZ7qDxA3bRh5TcPllQHLUkE m8QeaO/kGgu1DqHrQIwUTITXPLXnfDS/lY/Dfngw29S2kxXk8o60mw1HWWSeUCYS3i4OCc HglTY5/vWH0ma3BD5gnTIqN4MJRfB+kXl9ElKr9ljcYdJN0J+01SqPbj7dFKyRc2QJksDA SMMQrHFGY9zaQ2NTI3hqEQDVkQ+2XXnbd9wo96bayxipgsTFLgWyG6UG2a2QuA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1712839515; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kBnBVDJnEEo8Cuf29WIXXNXUEw3lOtrkVKsNhIAtadY=; b=r2MAAyJSnVtb1uPOxgBEQ1ArkcKAmhL7nJSbTEyDLJ5hJKg1aQ4aQJ7b1ghfOFO/nb14Fg /KXJSrQ3i25fcqDw== From: "tip-bot2 for Thomas Gleixner" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/urgent] x86/cpu/amd: Make the NODEID_MSR union actually work Cc: "kernelci.org bot" , Laura Nao , Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240410194311.596282919@linutronix.de> References: <20240410194311.596282919@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <171283951389.10875.6119406308489152225.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit The following commit has been merged into the x86/urgent branch of tip: Commit-ID: 898e4996e76053bfa0f578629ec6b35baff4224b Gitweb: https://git.kernel.org/tip/898e4996e76053bfa0f578629ec6b35baff4224b Author: Thomas Gleixner AuthorDate: Wed, 10 Apr 2024 21:45:28 +02:00 Committer: Thomas Gleixner CommitterDate: Thu, 11 Apr 2024 14:18:29 +02:00 x86/cpu/amd: Make the NODEID_MSR union actually work A system with NODEID_MSR was reported to crash during early boot without any output. The reason is that the union which is used for accessing the bitfields in the MSR is written wrongly and the resulting executable code accesses the wrong part of the MSR data. As a consequence a later division by that value results in 0 and that result is used for another division as divisor, which obviously does not work well. The magic world of C, unions and bitfields: union { u64 bita : 3, bitb : 3; u64 all; } x; x.all = foo(); a = x.bita; b = x.bitb; results in the effective executable code of: a = b = x.bita; because bita and bitb are treated as union members and therefore both end up at bit offset 0. Wrapping the bitfield into an anonymous struct: union { struct { u64 bita : 3, bitb : 3; }; u64 all; } x; works like expected. Rework the NODEID_MSR union in exactly that way to cure the problem. Fixes: f7fb3b2dd92c ("x86/cpu: Provide an AMD/HYGON specific topology parser") Reported-by: "kernelci.org bot" Reported-by: Laura Nao Signed-off-by: Thomas Gleixner Tested-by: Laura Nao Link: https://lore.kernel.org/r/20240410194311.596282919@linutronix.de Closes: https://lore.kernel.org/all/20240322175210.124416-1-laura.nao@collabora.com/ --- arch/x86/kernel/cpu/topology_amd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/cpu/topology_amd.c b/arch/x86/kernel/cpu/topology_amd.c index 79a85a4..7f999ae 100644 --- a/arch/x86/kernel/cpu/topology_amd.c +++ b/arch/x86/kernel/cpu/topology_amd.c @@ -121,13 +121,13 @@ static bool parse_8000_001e(struct topo_scan *tscan, bool has_0xb) static bool parse_fam10h_node_id(struct topo_scan *tscan) { - struct { - union { + union { + struct { u64 node_id : 3, nodes_per_pkg : 3, unused : 58; - u64 msr; }; + u64 msr; } nid; if (!boot_cpu_has(X86_FEATURE_NODEID_MSR))