From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.freebsd.org (mx2.freebsd.org [96.47.72.81]) by sourceware.org (Postfix) with ESMTPS id B8D60395C04B for ; Thu, 19 May 2022 16:05:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B8D60395C04B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [96.47.72.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits)) (Client CN "mx1.freebsd.org", Issuer "R3" (verified OK)) by mx2.freebsd.org (Postfix) with ESMTPS id 37F479B257; Thu, 19 May 2022 16:05:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4L3vpn0HXNz4sTx; Thu, 19 May 2022 16:05:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652976353; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=N/jctc18KOhXcDHattss8LJoR2sYiGCeh0hhBexyt3A=; b=AHRJP7sE1BOjxWkQ1fzsU/U5vFValoZuhN9BPm7tgtB8ynO1vvT9/WT2sMbtsn1ketqczg OfX0fYDivwSLQGrryfV0riULyNzt/2TMkPt7bLVxhgkVI+0B04/BOH92mxNSkQHwEFgpWn /QnAus+h5iV0NpEw19ADMpC1l3MmOe6i0BDhqT4Rr3kW9lfGZ/tkDfx7EaBUF69Sm/rMQi foDyyYCxqpq7xQXJCK5V1+fE5DJSD7pMy6bl/r0mOmTQygB1/SZiB3fQ1eT23o/6DprBYL I1jU3H8djyd4Kz/BdhbJmfRNBakngS4FeFLydbBoA0y549xW9tKdfwZliPZZLA== Received: from [IPV6:2601:648:8680:ed60:2d7e:31d5:f7c3:c2bd] (unknown [IPv6:2601:648:8680:ed60:2d7e:31d5:f7c3:c2bd]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 49790579; Thu, 19 May 2022 16:05:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: <38ff35cd-f50a-5e2d-1d8c-f2490c8826e8@FreeBSD.org> Date: Thu, 19 May 2022 09:05:50 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH v3 00/13] Handle variable XSAVE layouts Content-Language: en-US To: "Willgerodt, Felix" , "gdb-patches@sourceware.org" References: <20220503210515.30739-1-jhb@FreeBSD.org> From: John Baldwin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652976353; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=N/jctc18KOhXcDHattss8LJoR2sYiGCeh0hhBexyt3A=; b=BS/ogdAltfk9C5uKtVUCnWnHX81RG+CUsU2Xde/PdcGtlCCVIrItUnRD9oq1l4G6hU79Vb kmsYlZM5HFICVZuvqWAh95XT71pVNDtZcmSzMnphWLrZjoZqDanXuLd96mWuBZkfnZhUg9 10zv2MjJGUPrW6iQLtHwF9vr+3dt9x17uTe7ZkTwV+S4weseOI38Ovw3PPJ4kCZhOp49a4 I459p5PDIFAoaxNEbUMuEjJWMkJlSWPf/A/rFQZV7eq7/XIS0NLeIr/CwKxTx73mcRp3ch UQjhdNdvxAlXHnPpAS1aXw1M/z28xEeHffCk4hCEjTR/iB5fjvrnaM3lN1veVQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1652976353; a=rsa-sha256; cv=none; b=q1wzTYexayo6aybyaBiwEpkXzsAKiLjfLOm2KAzWx7+8ZugCTdVkOPoMTgIN15A7u5W5vf bFEEWAbhBMMK1jXP6xQa/xmLnc7Zdm1AyJ4M1UnSwXfDLPEHWdAJ/ra+dCfITD/ZrNxq8D QHiYpfXFU1Jrk8lq12XAbjU3F64fWpf8TmE+ZjuUxWh/dHHA9Yy1BxZDPob3LCeH7AV8yl d+SJEr2X/Cbp65D15VW2zhYyuLTld0drtCsS2dAMaEfRW8cR0ajEhexF3/gi7ANvNaB2xi ge7USXNB4wQ3ojs3n8fP4FQLpevpEY480t2UYdKluxr1BT3PX0SoPuvoL80x+A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 May 2022 16:05:57 -0000 On 5/19/22 8:42 AM, Willgerodt, Felix wrote: > Hi John, > > I saw them but I only skimmed over them a bit so far, sorry. > I didn't have any direct comments apart from what I already > stated for earlier versions, so I didn't answer. > > I couldn't apply the patches unfortunately. For some reason git > tells me formatting is off. Not sure if the fault is on my end or on > yours. But I tried a bit on my side to no avail. > So I couldn't test them on some of our internal targets. Ok, if it helps you can pull the branch directly from https://github.com/bsdjhb/gdb/tree/xsave_layout > Yes you can remove the Intel changelogs. Ok, I will trim those. Should I keep or drop the SOB trailers given that at least the log messages are now a bit different? > Regards, > Felix > >> -----Original Message----- >> From: John Baldwin >> Sent: Mittwoch, 18. Mai 2022 23:53 >> To: gdb-patches@sourceware.org >> Cc: Willgerodt, Felix >> Subject: Re: [PATCH v3 00/13] Handle variable XSAVE layouts >> >> Felix, >> >> Did you have any thoughts on this series? I had tried to cc you on it, >> but that didn't succeed it seems. This does have some conflicts with >> your AMX series, but those should be minor to resolve. >> >> On 5/3/22 2:05 PM, John Baldwin wrote: >>> Changes since V2: >>> >>> - Pulled in some of the changes from Intel's branch Felix pointed me >>> at, in particular gdbserver support. However, relative to that >>> branch these patches make the following changes: >>> >>> - The i387_* structs and class remain in gdbserver/i387-fp.cc >>> rather than moving to gdbsupport/. >>> >>> - Rather than invoking cpuid each time an XSAVE area is parsed, >>> the x86_xsave_layout structure is used to hold offsets and >>> CPUID is only invoked the first time NT_X86_XSTATE is probed >>> with the offsets cached for later use. >>> >>> - I did not update the ChangeLog bits of these log messages, but >>> probably they can be dropped for the Intel commits as GDB >>> commits generally do not include these now? >>> >>> - Added Linux support both for gdbarches and the x86 native targets. >>> I wasn't sure if PT_GETREGSET on Linux provides a way to query the >>> size of the XSAVE register set (on FreeBSD PT_GETREGSET returns >>> the register set's size in iov_len of the passed-in iovec if the >>> original iovec has a NULL pointer and zero length), so I used >>> cpuid leaf 0xd subleaf 0x0 to query the size of the register set >>> for the native targets as well as for the Linux gdbserver support. >>> >>> Note that this still depends on the size and xcr0 mask heuristic for >>> Linux and FreeBSD core dumps to determine the layout (and I have not >>> added any additional layouts as I wasn't sure if Jini was intending to >>> add additional AMD-specific layouts). I'd kind of like to land this >>> series before doing a followup to flesh out a new core dump note. >>> >>> I think for the new core dump note what I would propose is a simple >>> array of CPUID results for sub-leaves of the 0xd leaf (as a >>> NT_X86_XSTATE_CPUID or the like) where each entry in the array >>> contained the subleaf as well as eax, ebx, ecx, and edx results. This >>> note might even eventually permit handling "compact" XSTATE in future >>> core dumps rather than only "standard". >>> >>> I have tested this on both an AMD Ryzen 9 5900X and Intel Core >>> i7-8650U on FreeBSD/amd64 as well as on a Linux/x86-64 VM on the Intel >>> system. I also tested FreeBSD/i386 in a VM on the AMD system. >>> >>> Aleksandar Paunovic (2): >>> gdbserver: Refactor the legacy region within the xsave struct >>> gdbserver: Read offsets of the XSAVE extended region via CPUID >>> >>> John Baldwin (11): >>> x86: Add an x86_xsave_layout structure to handle variable XSAVE >>> layouts. >>> core: Support fetching TARGET_OBJECT_X86_XSAVE_LAYOUT from >>> architectures. >>> nat/x86-cpuid.h: Add x86_cpuid_count wrapper around __get_cpuid_count. >>> x86 nat: Add helper functions to save the XSAVE layout for the host. >>> gdb: Update x86 FreeBSD architectures to support XSAVE layouts. >>> gdb: Support XSAVE layouts for the current host in the FreeBSD x86 >>> targets. >>> gdb: Update x86 Linux architectures to support XSAVE layouts. >>> gdb: Support XSAVE layouts for the current host in the Linux x86 >>> targets. >>> gdb: Use x86_xstate_layout to parse the XSAVE extended state area. >>> gdbserver: Add a function to set the XSAVE mask and size. >>> x86: Remove X86_XSTATE_SIZE and related constants. >>> >>> gdb/amd64-fbsd-nat.c | 40 +-- >>> gdb/amd64-fbsd-tdep.c | 8 +- >>> gdb/amd64-linux-nat.c | 6 +- >>> gdb/amd64-linux-tdep.c | 8 +- >>> gdb/configure.nat | 8 +- >>> gdb/corelow.c | 22 ++ >>> gdb/gdbarch-components.py | 13 + >>> gdb/gdbarch-gen.h | 10 + >>> gdb/gdbarch.c | 32 +++ >>> gdb/i386-fbsd-nat.c | 39 +-- >>> gdb/i386-fbsd-tdep.c | 37 ++- >>> gdb/i386-fbsd-tdep.h | 6 + >>> gdb/i386-linux-nat.c | 8 +- >>> gdb/i386-linux-tdep.c | 34 ++- >>> gdb/i386-linux-tdep.h | 6 + >>> gdb/i386-tdep.c | 36 ++- >>> gdb/i386-tdep.h | 3 + >>> gdb/i387-tdep.c | 493 ++++++++++++++++++++++++------------- >>> gdb/i387-tdep.h | 8 + >>> gdb/nat/x86-cpuid.h | 27 ++ >>> gdb/nat/x86-xstate.c | 65 +++++ >>> gdb/nat/x86-xstate.h | 35 +++ >>> gdb/target.h | 2 + >>> gdb/x86-fbsd-nat.c | 51 ++++ >>> gdb/x86-fbsd-nat.h | 29 ++- >>> gdb/x86-linux-nat.c | 33 +++ >>> gdb/x86-linux-nat.h | 11 + >>> gdbserver/configure.srv | 12 +- >>> gdbserver/i387-fp.cc | 312 ++++++++++++++--------- >>> gdbserver/i387-fp.h | 2 +- >>> gdbserver/linux-x86-low.cc | 10 +- >>> gdbsupport/x86-xstate.h | 69 ++++-- >>> 32 files changed, 1067 insertions(+), 408 deletions(-) >>> create mode 100644 gdb/nat/x86-xstate.c >>> create mode 100644 gdb/nat/x86-xstate.h >>> >> >> >> -- >> John Baldwin > Intel Deutschland GmbH > Registered Address: Am Campeon 10, 85579 Neubiberg, Germany > Tel: +49 89 99 8853-0, www.intel.de > Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva > Chairperson of the Supervisory Board: Nicole Lau > Registered Office: Munich > Commercial Register: Amtsgericht Muenchen HRB 186928 -- John Baldwin