From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 91399 invoked by alias); 11 Jun 2019 16:16:18 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 91390 invoked by uid 89); 11 Jun 2019 16:16:18 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.6 required=5.0 tests=AWL,BAYES_00,MIME_BASE64_BLANKS,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=inspection, GDB's, GDBs X-HELO: EUR01-HE1-obe.outbound.protection.outlook.com Received: from mail-eopbgr130057.outbound.protection.outlook.com (HELO EUR01-HE1-obe.outbound.protection.outlook.com) (40.107.13.57) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 11 Jun 2019 16:16:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=V62MZGRGMMbrQeyOE7PZQ2os5bCk4rvVI+M7c82PXfk=; b=9G2Biz55UztgVXis7cstbPc7AAvPPPYdjiSU98VFtt9TvenGo0RektSATL7TUI5mP3/WrWLKCFs/u/z4kLmlQbC51H3p9uGs16oXurTAZYbF1r70LqKoEL+wPtvIucLBRvH6nRyHY2DkOVsnIb1RdVlL4Ys+6SUqhryKrS3kxz8= Received: from DB6PR0802MB2133.eurprd08.prod.outlook.com (10.172.227.22) by DB6PR0802MB2294.eurprd08.prod.outlook.com (10.172.227.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1965.14; Tue, 11 Jun 2019 16:16:11 +0000 Received: from DB6PR0802MB2133.eurprd08.prod.outlook.com ([fe80::8c26:bb4b:6c93:9d40]) by DB6PR0802MB2133.eurprd08.prod.outlook.com ([fe80::8c26:bb4b:6c93:9d40%2]) with mapi id 15.20.1965.017; Tue, 11 Jun 2019 16:16:11 +0000 From: Alan Hayward To: Dave P Martin CC: Will Deacon , Peter Maydell , Catalin Marinas , Zhang Lei , Julien Grall , "gdb@sourceware.org" , =?utf-8?B?QWxleCBCZW5uw6ll?= , "linux-arm-kernel@lists.infradead.org" , nd Subject: Re: [PATCH 0/2] arm64/sve: Fix mutating register endianness on big-endian Date: Tue, 11 Jun 2019 16:16:00 -0000 Message-ID: <207E140D-AC57-4B0D-B838-94B92BE2B0A0@arm.com> References: <1559839495-22315-1-git-send-email-Dave.Martin@arm.com> <20190607093858.GA21378@fuggles.cambridge.arm.com> <20190607154832.GH28398@e103592.cambridge.arm.com> In-Reply-To: <20190607154832.GH28398@e103592.cambridge.arm.com> authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alan.Hayward@arm.com; x-ms-exchange-purlcount: 1 x-ms-oob-tlc-oobclassifiers: OLM:8882; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 Content-Type: text/plain; charset="utf-8" Content-ID: <2C650654427C904D95CBB17C66F9EF58@eurprd08.prod.outlook.com> Content-Transfer-Encoding: base64 MIME-Version: 1.0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Alan.Hayward@arm.com X-SW-Source: 2019-06/txt/msg00016.txt.bz2 DQoNCj4gT24gNyBKdW4gMjAxOSwgYXQgMTY6NDgsIERhdmUgTWFydGluIDxE YXZlLk1hcnRpbkBhcm0uY29tPiB3cm90ZToNCj4gDQo+IE9uIEZyaSwgSnVu IDA3LCAyMDE5IGF0IDEwOjM4OjU4QU0gKzAxMDAsIFdpbGwgRGVhY29uIHdy b3RlOg0KPj4gT24gVGh1LCBKdW4gMDYsIDIwMTkgYXQgMDU6NDQ6NTNQTSAr MDEwMCwgRGF2ZSB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bG9va3MgZ29vZCwgYXBhcnQg ZnJvbToNCiogR0RCIGdldHMgaXQgd3Jvbmcgd2hlbiB0aGUgcHRyYWNlIHN2 ZSBzdHJ1Y3R1cmUgY29udGFpbnMgYSBmcHNpbWQuDQoqIEkgbmVlZCB0byBk byBzb21lIHRlc3RpbmcgYXJvdW5kIHNpZ2NvbnRleHRzLCBidXQgYWdhaW4g SSB0aGluayBHREINCiAgd2lsbCBuZWVkIGEgc2xpZ2h0IGNoYW5nZS4NCkni gJlsbCBnZXQgc29tZSBwYXRjaGVzIHRvZ2V0aGVyIGZvciBHREIuDQoNCg0K PiBUaGUgcHRyYWNlIGNoYW5nZSBpcyB0aGVvcmV0aWNhbGx5IGFuIEFCSSBi cmVhaywgYnV0IHNpbmNlIHRoZSBjdXJyZW50DQo+IGJlaGF2aW91ciBpcyBv YnZpb3VzbHkgd3JvbmcsIEkgY29uc2lkZXIgdGhpcyBhIGZpeC4NCg0KSeKA mW0gaGFwcHkgd2l0aCB0aGlzIGNoYW5nZSBmcm9tIEdEQidzIHNpZGUuDQoN Cg0KVGhhbmtzLA0KQWxhbi4NCg0KDQo+IA0KPiBDaGVlcnMNCj4gLS0tRGF2 ZQ0KPiANCj4gX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX18NCj4gbGludXgtYXJtLWtlcm5lbCBtYWlsaW5nIGxpc3QN Cj4gbGludXgtYXJtLWtlcm5lbEBsaXN0cy5pbmZyYWRlYWQub3JnDQo+IGh0 dHA6Ly9saXN0cy5pbmZyYWRlYWQub3JnL21haWxtYW4vbGlzdGluZm8vbGlu dXgtYXJtLWtlcm5lbA0KPiANCg0K >From gdb-return-47051-listarch-gdb=sources.redhat.com@sourceware.org Tue Jun 11 16:25:27 2019 Return-Path: Delivered-To: listarch-gdb@sources.redhat.com Received: (qmail 22925 invoked by alias); 11 Jun 2019 16:25:27 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Delivered-To: mailing list gdb@sourceware.org Received: (qmail 22916 invoked by uid 89); 11 Jun 2019 16:25:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.2 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.1 spammy=confirming, H*i:sk:207E140, H*f:sk:207E140, HX-Languages-Length:2372 X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.110.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 11 Jun 2019 16:25:26 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9D348337; Tue, 11 Jun 2019 09:25:24 -0700 (PDT) Received: from e103592.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 46FF23F73C; Tue, 11 Jun 2019 09:25:23 -0700 (PDT) Date: Tue, 11 Jun 2019 16:25:00 -0000 From: Dave Martin To: Alan Hayward Cc: Peter Maydell , "gdb@sourceware.org" , Will Deacon , Zhang Lei , Julien Grall , Catalin Marinas , nd , Alex =?iso-8859-1?Q?Benn=E9e?= , "linux-arm-kernel@lists.infradead.org" Subject: Re: [PATCH 0/2] arm64/sve: Fix mutating register endianness on big-endian Message-ID: <20190611162520.GO28398@e103592.cambridge.arm.com> References: <1559839495-22315-1-git-send-email-Dave.Martin@arm.com> <20190607093858.GA21378@fuggles.cambridge.arm.com> <20190607154832.GH28398@e103592.cambridge.arm.com> <207E140D-AC57-4B0D-B838-94B92BE2B0A0@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <207E140D-AC57-4B0D-B838-94B92BE2B0A0@arm.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-SW-Source: 2019-06/txt/msg00017.txt.bz2 Content-length: 2318 On Tue, Jun 11, 2019 at 04:16:11PM +0000, Alan Hayward wrote: > > > > On 7 Jun 2019, at 16:48, Dave Martin wrote: > > > > On Fri, Jun 07, 2019 at 10:38:58AM +0100, Will Deacon wrote: > >> On Thu, Jun 06, 2019 at 05:44:53PM +0100, Dave Martin wrote: > >>> By inspection while debugging something else, I noticed that the byte > >>> order of FPSIMD V-register stores and SVE Z-register stores is not the > >>> same when running on big-endian. > >>> > >>> This is not properly taken into account when moving between the FPSIMD > >>> and SVE register views inside the kernel, resulting in the bytes of a > >>> V-register getting spontaneously reversed in some situations, from > >>> userspace's point of view. The signal frame and ptrace interface are > >>> also affected. The KVM ABI forbids mixing the two views and so should > >>> not be affected. > >>> > >>> See patch 2 for details. > >>> > >>> Patch 1 does some trivial preparatory refactoring. > >> > >> Sorry to be a pain, but would you be able to flip this series round so that > >> the fix doesn't depend on the refactoring, please? That way we can put it > >> into stable without the dependency. > >> > >>> gdb may or may not be affected by this, depending on how it uses the > >>> NT_PRFPREG and NT_ARM_SVE regsets. I'll leave it to the developers to > >>> assess that. > >> > >> Wouldn't this be easy enough to test? > > > > So, gdb works OK on big-endian but weird stuff happening on both with > > and without the fix. > > > > There are places in the gdb code itself where it is likely missing > > endianness conversions, but I need to follow up with the gdb folks to > > clarify whether my patch is missing something… > > (I added the SVE support for GDB). > > I’ve tried these changes out myself using GDB. > With your changes everything looks good, apart from: > * GDB gets it wrong when the ptrace sve structure contains a fpsimd. > * I need to do some testing around sigcontexts, but again I think GDB > will need a slight change. > I’ll get some patches together for GDB. > > > > The ptrace change is theoretically an ABI break, but since the current > > behaviour is obviously wrong, I consider this a fix. > > I’m happy with this change from GDB's side. OK, thanks for confirming. Cheers ---Dave