From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id 46AFC3858D37 for ; Mon, 27 Mar 2023 00:36:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 46AFC3858D37 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org References: User-agent: mu4e 1.8.14; emacs 29.0.60 From: Sam James To: John David Anglin Cc: deller@gmx.de, libc-alpha@sourceware.org, soap@gentoo.org Subject: Re: [committed] hppa: Drop 16-byte pthread lock alignment Date: Mon, 27 Mar 2023 01:35:19 +0100 In-reply-to: Message-ID: <877cv3do8i.fsf@gentoo.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00,GIT_PATCH_0,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable John David Anglin writes: > [[PGP Signed Part:Undecided]] > hppa: Drop 16-byte pthread lock alignment > > Linux threads were removed about 12 years ago and the current > nptl implementation only requires 4-byte alignment for pthread > locks. > > The 16-byte alignment causes various issues. For example in > building ignition-msgs, we have: > > /usr/include/google/protobuf/map.h:124:37: error: static assertion failed > 124 | static_assert(alignof(value_type) <=3D 8, ""); > | ~~~~~~~~~~~~~~~~~~~~^~~~ > > This is caused by the 16-byte pthread lock alignment. Dave will be aware of the context but posting this just for completeness: see also: https://github.com/protocolbuffers/protobuf/issues/= 9433 where David Seifert (soap@, CC'd) provided some analysis. > > Signed-off-by: John David Anglin > --- > > diff --git a/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h b/sysdeps/hppa/np= tl/bits/pthreadtypes-arch.h > index 999195c5b0..c1a46d66d0 100644 > --- a/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h > +++ b/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h > @@ -40,7 +40,7 @@ > #define __SIZEOF_PTHREAD_RWLOCK_T 64 > #define __SIZEOF_PTHREAD_RWLOCKATTR_T 8 >=20=20 > -#define __LOCK_ALIGNMENT __attribute__ ((__aligned__(16))) > +#define __LOCK_ALIGNMENT > #define __ONCE_ALIGNMENT >=20=20 > #endif /* bits/pthreadtypes.h */ > diff --git a/sysdeps/hppa/nptl/bits/struct_rwlock.h b/sysdeps/hppa/nptl/b= its/struct_rwlock.h > index e83b4aab52..59bc9fe76f 100644 > --- a/sysdeps/hppa/nptl/bits/struct_rwlock.h > +++ b/sysdeps/hppa/nptl/bits/struct_rwlock.h > @@ -25,8 +25,14 @@ struct __pthread_rwlock_arch_t > /* In the old Linuxthreads pthread_rwlock_t, this is the > start of the 4-word 16-byte aligned lock structure. The > next four words are all set to 1 by the Linuxthreads > - PTHREAD_RWLOCK_INITIALIZER. We ignore them in NPTL. */ > - int __compat_padding[4] __attribute__ ((__aligned__(16))); > + PTHREAD_RWLOCK_INITIALIZER. We ignore them in NPTL. > + > + The 16-byte aligned lock stucture causes various pthread > + structures to be over aligned. This causes some builds > + to fail which assume a maximum alignment of 8 bytes. > + Linuxthreads has been removed for 12 years, so drop > + alignment of lock structure. */ > + int __compat_padding[4]; > unsigned int __readers; > unsigned int __writers; > unsigned int __wrphase_futex; > > [[End of PGP Signed Part]] --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iOUEARYKAI0WIQQlpruI3Zt2TGtVQcJzhAn1IN+RkAUCZCDlDV8UgAAAAAAuAChp c3N1ZXItZnByQG5vdGF0aW9ucy5vcGVucGdwLmZpZnRoaG9yc2VtYW4ubmV0MjVB NkJCODhERDlCNzY0QzZCNTU0MUMyNzM4NDA5RjUyMERGOTE5MA8cc2FtQGdlbnRv by5vcmcACgkQc4QJ9SDfkZDMEAD9GyolYszmQY/1Us1IzxsafhUjRrHumU8VYM2b 6LHeuHMA/1ZLEt0Umqsm1P21yyh2Cabg4DO5dz4qYSgQekZq1SwJ =wnV4 -----END PGP SIGNATURE----- --=-=-=--