From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C71BDC5475B for ; Thu, 14 Mar 2024 11:24:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 33DA180098; Thu, 14 Mar 2024 07:24:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2C4A480073; Thu, 14 Mar 2024 07:24:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 13FEF80098; Thu, 14 Mar 2024 07:24:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id EB02780073 for ; Thu, 14 Mar 2024 07:24:26 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id AEEFE1A0948 for ; Thu, 14 Mar 2024 11:24:26 +0000 (UTC) X-FDA: 81895411332.13.41053CA Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2054.outbound.protection.outlook.com [40.107.237.54]) by imf04.hostedemail.com (Postfix) with ESMTP id 14C5D40008 for ; Thu, 14 Mar 2024 11:24:22 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=jJy7jNvG; dmarc=pass (policy=quarantine) header.from=amd.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf04.hostedemail.com: domain of Vignesh.Balasubrmanian@amd.com designates 40.107.237.54 as permitted sender) smtp.mailfrom=Vignesh.Balasubrmanian@amd.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1710415463; h=from:from:sender: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: references:dkim-signature; bh=RHXxC+7libhS9xFmXORztPpKAdK1hI+bqqQlSSjMfJ8=; b=6AD9PKptht3OQPdC+oSP9lNmnnCAklK+v3gyj+XhZOeFuSR7me1ENrABOvxI6btkcdvGN/ ZCf3o7yPMkbszpyka6nbeFl2JoOLai0ua/sl0c35t6muBFcHP0Sxu3GdqGu5tL8PrJfzQ9 +zVKWvCwYyHm8IWptuPu4tQ6CHzx+Ms= ARC-Authentication-Results: i=2; imf04.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=jJy7jNvG; dmarc=pass (policy=quarantine) header.from=amd.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf04.hostedemail.com: domain of Vignesh.Balasubrmanian@amd.com designates 40.107.237.54 as permitted sender) smtp.mailfrom=Vignesh.Balasubrmanian@amd.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1710415463; a=rsa-sha256; cv=pass; b=5rq4rHriGeaLVO4OYLDMEosNioZpHFHNDXs1lT1y1nVmUxYbQqTH6NEYfvoBCOXRC0EZyw ts+daFe7+/g2IPJt88OQSuyo/LBwm7g8O5OVkD9DA6LAe72L7e5+r5iDjnyAFQctVkT7CD 83qfF8QH8/T346HkNzKPrtGgtg5+juc= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g80selltH/zxpTiO0sFa1rT0jizCOj7632ep/KN26RURz1JMDqatd00T+mDn3pT8gFvvIoRZKdJ4klx3BjqXAKBPlB1j/DlOdXxCZCk+NrfSlRd0I/JDtKrkv2BeUqjoLUTOvJ4A52od7pSM7jQvfdHThxBofOSSsw5nPhFc/fEBNxwpUlvit2Bn+s10Ot0P1RwxcIXfc52bHIvE59NjDwbciOFgEvRcKreHayOI0kac7IFe+swakUGQe9Rx2qZhU8OPUgqvOtlUyHkzbOeORUNUcbJimB1Z5hgjIWTeY72cdU7TkuTPlcn90jHOuKYGWWfPGsujkkac0F5ZS096cQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RHXxC+7libhS9xFmXORztPpKAdK1hI+bqqQlSSjMfJ8=; b=AhuvRdVnrQekmP70hzLC6FkRi6oJFAKWNfqEmbpHjurEt0yx26BVcxauxwT1Ef4WLQ+PtgABu2TFPzzQ3B9/TTGvOIZsv74hbIczRF/JGUwNqKkDzb7rMs8uFSpR8zkUzVJsXcKJydVVT0Zzt/E6hnYnyA4Cz/VyXzJRUP4TyImd6B3oIjLZj5B/n3Icqch0ktN01xOGlqxWBlpr5ntCkWIJeQ5UCijaT+bGGmRgoEaAizS4ZEH2LYk0vcbeuZ1D6Fi4FzjhkTzcSfaW0Yf5TekJsBXCHWVmTOr73dPaq1nm5zik9MHFU5wL/9kc4XTWPpw1mhgiMkcMUWpb4amelw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RHXxC+7libhS9xFmXORztPpKAdK1hI+bqqQlSSjMfJ8=; b=jJy7jNvGxKQaCBqLkGd0yMbtE19tpJpK4WYjjpXyWTOi8XDoaK1ZqrFvpWRax8BXjGamAJ086YYL42H2BdTRlbEP9bIwr0NgFE8OTWkWkItIGuguBoF06dva8LVquIJ5xN4YW2tAYTe7KA4GFy3fCmuU+kVfH8OPpKZ48d/dJY8= Received: from CH5P220CA0019.NAMP220.PROD.OUTLOOK.COM (2603:10b6:610:1ef::17) by CH3PR12MB7691.namprd12.prod.outlook.com (2603:10b6:610:151::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.36; Thu, 14 Mar 2024 11:24:20 +0000 Received: from CH1PEPF0000AD76.namprd04.prod.outlook.com (2603:10b6:610:1ef:cafe::6a) by CH5P220CA0019.outlook.office365.com (2603:10b6:610:1ef::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.21 via Frontend Transport; Thu, 14 Mar 2024 11:24:20 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CH1PEPF0000AD76.mail.protection.outlook.com (10.167.244.53) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7386.12 via Frontend Transport; Thu, 14 Mar 2024 11:24:20 +0000 Received: from llvm-slrz6.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 14 Mar 2024 06:24:15 -0500 From: Vignesh Balasubramanian To: , CC: , , , , , , , , , , , , , , , , Vignesh Balasubramanian Subject: [PATCH 0/1] Add XSAVE layout description to Core files for debuggers to support varying XSAVE layouts Date: Thu, 14 Mar 2024 16:53:27 +0530 Message-ID: <20240314112359.50713-1-vigbalas@amd.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH1PEPF0000AD76:EE_|CH3PR12MB7691:EE_ X-MS-Office365-Filtering-Correlation-Id: 9fcac38f-4d63-40af-ce13-08dc44194b1d X-LD-Processed: 3dd8961f-e488-4e60-8e11-a82d994e183d,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NKs2ChYE4ZWf5PYK6KG2iY4y1DAdBDYef2Z4WOyCgfcbGLWpTNG5K6BCulkqoC9kQT7+YE2SyLkBoEw9ojozYl13rDlqnrzMwJAyDxDKJG/ixUSqPtewYkbac6QyMlhRuxm8dX2N37pogWfjWmdlyjWz5WabmU0a9N3pI4rnhCkK/6S7SDZYPyfHf+g/4OXq1cWtgM1hqIZPXfyEfPAZbi+OFzdD/DOrjt1dJZ66903e2uDuFUtENYO6X51uoTcQQzHly8Av3JsJzNKMx10CwHrQrFovJZcMWjCMAE/UFQqxY4Eqp43mEAxbWsCux8JTBQcyv6jIDkZCnbMXV876NEKUgaRKLNdkGBe4oHsRsK9HnNL2qWKES7G5VClEMggoPBYubU/x8YH9nRQXCMGmCljOblUxOuR/cfE2DLmIu47THkRC9OiNTlzVpYXgMT6V9hVH07cNUIDYb5Y99IDFzTCRs57V0sWHSM7aEAgoK1M9iBhqRL6L8YenXCbzJe7e080cJyTfGbbHV2V5m+23NwjuFD0GtAoEHtX2zcLH+QoQELwUdtYNuH2muxm35PYjX4BsjB749GvTn+OALdzGoGVEDGncKW94KAJQ5P0BuUd9Yzls4mpIeEui0e7utZhl5u0mkrzyKJWMolFi6pVyCRUrJ6LE3w4/3YVDQM+Rq3xh+KHLdZ+VsTLj2R3AwxZwRFy/VQYT588Zhq6E4zsEPA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(82310400014)(36860700004)(376005)(1800799015)(7416005);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Mar 2024 11:24:20.4258 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9fcac38f-4d63-40af-ce13-08dc44194b1d X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CH1PEPF0000AD76.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB7691 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 14C5D40008 X-Stat-Signature: zch7topqu4qpfr4ca1chgqt1fxitzyjx X-Rspam-User: X-HE-Tag: 1710415462-479089 X-HE-Meta: U2FsdGVkX18y9ch3+mDmL4Lupg3x1tP1FdLB/XegSph4UlG37rgaGZ1jndgFggWptlVvZbXWKDoM7CQzQonlpROHuHpJ+Sym1TE/o1NtiHfGFvH2amX7vND9Y1LlWuFJM1DQpjjMdWkVH8kZhlRf2S6RBeRDJEptsZaGyZi3AIoygEf0a++lplV6AicY0wqAOIE9fAMnHMzJqkI2Qik3gL22vwSi6i+AfuFEGwbh1Drx16yCtBtxP1og5zBLjhGZS1fI8O174LR29LnygRmsGg7Rm7muSDScRXTUf0lTRgZ5Qq5n2ef3qLOHFxqj/ZWmCI0qWRquBHM7PStgMShV/tw1OKkQfXcC6gaM1GezLb00VxuM0ANjiqp9V77uEcRoVQMogTvL1KCJAcgVncMVlMnYkg7eNy7PUxEoRv9lP940sj5u5EZHoIzyTyqbq/Qcy2Rr0vHJ4Ku6uXKwg/TZMjOftMlt7HMgJ3aJt+VqSeJDbBhVGRDbnukbLAzuAdx5gPqBNGaBQQidbn5lUiDsfwm5mMy5+FqUB7M4D9JXLiiYMasd4jqyvWivBzGZVEn5veomZw4TNEGKJ8UzUtcQF7/s0dA6XF0fMu0V474OAvCtmRbh4NLJKeQlqPFPX54w/Wv7IxqYfzfxe+ynIXI0v7i/vzjfHSd8Df/ZL6PXPqjfR3w5/+DOOyf8K+Tp/Vbw0qLZoXPTlJ7O2wcDdQXUBeOvWQ47qt1GHWEel0wpa9wlUQLihvT+ClidcFro6ilRbA9vJTLSTzn0LhEGwG78THT7wi02MfjjlQaCFhWB14A0a0gYy6PTJVuvPswjV317z9yNxZLiZRDJsWwsZTXpT2x9OnM3jfQGnwz9n995A3ZIBsFoLfk7vx6IiBWVYpt+DYn5VzshfbCukcJnSUTXS3BH26zROywFeEWlSX8qJYR326S/rMWP4etJbHq3tDZohkLV23JTVfLrBT8PqrS nOj+i/LS NRIs7d0weFite4/h5TyBmnNPbO+0bvsa6LeqVi9ETR+mfx9/EJ7XZVkQ0SYRmmfBqyEvjQwHVFWDCNHWSVzIQDQbmeObcmKBGQG/mSYV3bLNQ2F9l+cS+YUpUdUcwdJJCcI4ySI/RA4ZivC0LIreNgmMsHA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: This patch proposes to add an extra .note section in the corefile to dump the CPUID information of a machine. This is being done to solve the issue of tools like the debuggers having to deal with coredumps from machines with varying XSAVE layouts in spite of having the same XCR0 bits. The new proposed .note section, at this point, consists of an array of records containing the information of each extended feature that is present. This provides details about the offsets and the sizes of the various extended save state components of the machine where the application crash occurred. Requesting a review for this patch. Some background: The XSAVE layouts of modern AMD and Intel CPUs differ, especially since Memory Protection Keys and the AVX-512 features have been inculcated into the AMD CPUs. This is since AMD never adopted (and hence never left room in the XSAVE layout for) the Intel MPX feature. Tools like GDB had assumed a fixed XSAVE layout matching that of Intel (based on the XCR0 mask). Hence, the core dumps from AMD CPUs didn't match the known size for the XCR0 mask. This resulted in GDB and other tools not being able to access the values of the AVX-512 and PKRU registers on AMD CPUs. To solve this, an interim solution has been accepted into GDB, and is already a part of GDB 14, thanks to these series of patches : [ https://sourceware.org/pipermail/gdb-patches/2023-March/198081.html ]. But this patch series depends on heuristics based on the total XSAVE register set size and the XCR0 mask to infer the layouts of the various register blocks for core dumps, and hence, is not a foolproof mechanism to determine the layout of the XSAVE area. Hence this new core dump note has been proposed as a more sturdy mechanism to allow GDB/LLDB and other relevant tools to determine the layout of the XSAVE area of the machine where the corefile was dumped. The new core dump note (which is being proposed as a per-process .note section), NT_X86_XSAVE_LAYOUT (0x205) contains an array of structures. Each structure describes an individual extended feature containing offset, size and flags (that is obtained through CPUID instruction) in a format roughly matching the follow C structure: struct xfeat_component { u32 xfeat_type; u32 xfeat_sz; u32 xfeat_off; u32 xfeat_flags; }; Vignesh Balasubramanian (1): x86/elf: Add a new .note section containing Xfeatures information to x86 core files arch/Kconfig | 9 +++ arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/elf.h | 2 - arch/x86/Kconfig | 1 + arch/x86/include/asm/elf.h | 7 +++ arch/x86/kernel/fpu/xstate.c | 101 +++++++++++++++++++++++++++++++++ include/linux/elf.h | 2 +- include/uapi/linux/elf.h | 1 + 8 files changed, 121 insertions(+), 3 deletions(-) -- 2.43.0