Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp425559rdb; Thu, 18 Jan 2024 07:36:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IEWE38AfIEouGrPHpYhHjxi7UWfJvTgVIxqCf1oO++W3vyWoFjLVDLAf/1px6pA4mQQ08ry X-Received: by 2002:a05:651c:1ca:b0:2cd:fa20:d32c with SMTP id d10-20020a05651c01ca00b002cdfa20d32cmr216107ljn.62.1705592176861; Thu, 18 Jan 2024 07:36:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705592176; cv=pass; d=google.com; s=arc-20160816; b=Zq5DOCMw4aOb3W2tharSAXlkis+joOGGXb45VHfmXrONz0+gbegBz32fJOtQGWnuky vv36zMxPjkHiVl2DKCbm+LjyZngj1SoO5nATKtYtQYHp5H7hpHNhAgE4yHj6VECMy3Eb kNcod2jlHijFjZ/ghlt6GPEhFtET5tv2r0F2gZbuKTP9qED5B0LfIM65530OcFxOgqPr 38ZSAUpepvw6n8NHL6W2VXZzUKHUuMWvlejyD7P6YWIDxqyLOEZFt9gGmf7NQdD+KvuX IEJy+cQ71jEuSQqWKJlLpwHx/K08re8y5qRfIs8QY4y6M1REfZumuUtKwKfxODg4BPel 7lug== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=reply-to:cc:to:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:message-id:date :subject:from:dkim-signature; bh=YPL3i+bDbsEiIHXOrjcw3NVQ7W0f6WV/ADgqegoQ3E4=; fh=0/OomzuShYuziTYlAWyPlUWU14rCcSJ++G4OgLHJGnk=; b=PLikp/b9vkhqa4IMYvs7ifkqeWoX3CxmJoK5/FJ+KiIvFI/2ET7LySP5v79R/SJtuC b3eQvppDNbTJKcPx5dsx7nbvqSJOTM/ABAEZnhohoyUtjGYJIGBU03rwU3u4alBfe5Iz x1L2AAVFNytH2YU/EA/YcfB8tH/Wbvvz2sUQ8jDt+r+jddJCBKSeC9N841/CbRRzVmiu j2CuKtOBTRAcIZWBfjzwPfoR616vPXYN0FNInkbEg/eq8d314foN9TUssGsuqnKT3FJH dDOFipY7ay+0K2VZOPrVE5dAMIuWIk2OWX7psM1iNEs7kALhBSYBwNWg9DUbF+yy458v 5QoA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EikAJD1G; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-30277-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30277-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id t9-20020a056402240900b005527ae447f1si7377143eda.112.2024.01.18.07.36.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 07:36:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-30277-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EikAJD1G; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-30277-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30277-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 D63FC1F2B473 for ; Thu, 18 Jan 2024 15:28:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 634CB2CCB3; Thu, 18 Jan 2024 15:25:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EikAJD1G" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 74EB625571 for ; Thu, 18 Jan 2024 15:25:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705591542; cv=none; b=ESJ7ItInCa/qhLcR6ztH0XfDzg43eiAwvR6eRKoLNzaw41tYQDmzPAQ+l21pv4/OvfOjCgDzL/cfR6LR8znCjA45AwKHBj26fWyAhItB0300Y2uMwR0cxzJqM5jU5PWcr94k499IAjuAODi1cmIIaMgV5OICoXPPt60/HuBimCs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705591542; c=relaxed/simple; bh=ZrNZI/+KtaqDAeKBFPjQTAb311LBOoljbtl1LqlVqgU=; h=Received:DKIM-Signature:Received:From:Subject:Date:Message-Id: MIME-Version:Content-Type:Content-Transfer-Encoding:X-B4-Tracking: To:Cc:X-Mailer:X-Developer-Signature:X-Developer-Key: X-Endpoint-Received:X-Original-From:Reply-To; b=h10oaIy8BmcxWnHPGSyVcKiE3RRiiLYR6Al/X8yLGehtUT/l2l8tHxW29GsSAi6Doe1yIH7oRy86+EVKDFb7L3L8ac6pNuUHHjd3SarPzR+svbji5kUUNDoj0OjFrmoxXD85xtVEv835aN3tO+LRYN8HN+p40TPkAGyDsjHljqk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EikAJD1G; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPS id 0DB1EC433C7; Thu, 18 Jan 2024 15:25:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705591542; bh=ZrNZI/+KtaqDAeKBFPjQTAb311LBOoljbtl1LqlVqgU=; h=From:Subject:Date:To:Cc:Reply-To:From; b=EikAJD1G0pb3jVcwCRG+fB0VgJ6aECiR0DbO54vwJS46/PkKZ7ypAmiMAywBa+7JN C1OngJTsht/5e51HRbViv6HUrlVtjUPRv0J3Qk7C2KjRCLiFQz0JvjuGslWHyND9md f0XkLLJ4PU0msMmmK7luaFGXqzi9hMuWLJp3wG8GINIkNCqsC+XfxzRa/E9Q94Cyff gfZdmoS1nRFjp1cnjYAQndurEZBfwEKhUM9cdi+42IQxFdV6CMds4/EpKOcop3BAPf 3UaFtN62BBsJQ2ySVDbcgHKrVeyIn30mRyuKzVlplAmvtbTAq8M2jafdjw0NKeMuEo eXCfOwb6+Tr4A== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0019C4707B; Thu, 18 Jan 2024 15:25:41 +0000 (UTC) From: Nathan Lynch via B4 Relay Subject: [PATCH RFC 0/5] dump_stack: Allow runtime updates of the hardware description Date: Thu, 18 Jan 2024 09:25:11 -0600 Message-Id: <20240118-update-dump-stack-arch-str-v1-0-5c0f98d017b5@linux.ibm.com> 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" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIANdCqWUC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE vPSU3UzU4B8JSMDIxMDQ0ND3dKClMSSVN2U0twC3eKSxORs3cSi5Awgs0jXPM3AwsIgxcg4zdh ACWhAQVFqWmYF2PBopSA3Z6XY2loA6bwz0HEAAAA= To: "Aneesh Kumar K.V" , "Naveen N. Rao" , Brian King , Christophe Leroy , John Ogness , Michael Ellerman , Nicholas Piggin , Petr Mladek , Sergey Senozhatsky , Steven Rostedt Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Nathan Lynch X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1705591541; l=2778; i=nathanl@linux.ibm.com; s=20230817; h=from:subject:message-id; bh=ZrNZI/+KtaqDAeKBFPjQTAb311LBOoljbtl1LqlVqgU=; b=vrcF1cNPIm2O4+bieSkcw1uoqBBdSqf4JkN+kVqZt0fSLkeqYShpMyznUhC+rjw1sJEeTCg3r HvE7JadRlXGBBcZSgBWO/h+xHLaE9TtJfvuE3gqdy++muQ22sED6j1/ X-Developer-Key: i=nathanl@linux.ibm.com; a=ed25519; pk=jPDF44RvT+9DGFOH3NGoIu1xN9dF+82pjdpnKjXfoJ0= X-Endpoint-Received: by B4 Relay for nathanl@linux.ibm.com/20230817 with auth_id=78 X-Original-From: Nathan Lynch Reply-To: When the kernel emits a stack trace, typically it includes a hardware description string, e.g. Kernel panic - not syncing: sysrq triggered crash CPU: 6 PID: 46433 Comm: bash Tainted: G W 6.7.0-rc2+ #83 > Hardware name: IBM,9040-MR9 POWER9 (architected) 0x4e2102 0xf000005 of:IBM,FW950.01 (VM950_047) hv:phyp pSeries Call Trace: dump_stack_lvl+0xc4/0x170 (unreliable) panic+0x39c/0x584 sysrq_handle_crash+0x80/0xe0 __handle_sysrq+0x208/0x4bc [...] This string is a statically allocated buffer populated during boot by arch code calling dump_stack_set_arch_desc(). For most platforms this is sufficient. But the string may become inaccurate on the IBM PowerVM platform due to live migration between machine models and firmware versions. Stack dumps emitted after a migration reflect the machine on which the kernel booted, not necessarily the machine on which it is currently running. This is potentially confusing for anyone investigating kernel issues on the platform. To address this, this series introduces a new function that safely updates the hardware description string and updates the powerpc pseries platform code to call it after a migration. The series also includes changes addressing minor latent issues identified during the implementation. Platforms which do not need the new functionality remain unchanged. For this initial version at least, the powerpc/pseries part includes some "self-test" code that 1. verifies that reconstructing the hardware description string late in boot matches the one that was built earlier, and 2. fully exercises the update path before any migrations occur. This could be dropped or made configurable in the future. Signed-off-by: Nathan Lynch --- Nathan Lynch (5): dump_stack: Make arch description buffer __ro_after_init dump_stack: Allow update of arch description string at runtime powerpc/prom: Add CPU info to hardware description string later powerpc/pseries: Prepare pseries_add_hw_description() for runtime use powerpc/pseries: Update hardware description string after migration arch/powerpc/kernel/prom.c | 12 +++-- arch/powerpc/platforms/pseries/mobility.c | 5 ++ arch/powerpc/platforms/pseries/pseries.h | 1 + arch/powerpc/platforms/pseries/setup.c | 80 +++++++++++++++++++++++++++++-- include/linux/printk.h | 5 ++ lib/dump_stack.c | 57 ++++++++++++++++++++-- 6 files changed, 146 insertions(+), 14 deletions(-) --- base-commit: 44a1aad2fe6c10bfe0589d8047057b10a4c18a19 change-id: 20240111-update-dump-stack-arch-str-7f0880d23f30 Best regards, -- Nathan Lynch