From: Alistair Francis <alistair23@gmail.com>
To: "Maciej W. Rozycki" <macro@wdc.com>
Cc: Alistair Francis <alistair.francis@wdc.com>,
GNU C Library <libc-alpha@sourceware.org>
Subject: Re: [PATCH v2 07/18] RISC-V: nptl: update default pthread-offsets.h
Date: Mon, 10 Aug 2020 10:34:35 -0700 [thread overview]
Message-ID: <CAKmqyKNwvwMLxjo_jPCakuu5fU7DBMmU_SbryCp=A4XXsx=bTA@mail.gmail.com> (raw)
In-Reply-To: <alpine.LFD.2.21.2007082358500.24175@redsun52.ssa.fujisawa.hgst.com>
On Wed, Jul 8, 2020 at 5:14 PM Maciej W. Rozycki via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
> On Wed, 3 Jun 2020, Alistair Francis via Libc-alpha wrote:
>
> > diff --git a/sysdeps/riscv/nptl/pthread-offsets.h b/sysdeps/riscv/nptl/pthread-offsets.h
> > index 31f0587bec..a85c752a1f 100644
> > --- a/sysdeps/riscv/nptl/pthread-offsets.h
> > +++ b/sysdeps/riscv/nptl/pthread-offsets.h
> > @@ -1,3 +1,12 @@
> > -#define __PTHREAD_MUTEX_KIND_OFFSET 16
> > +#if __WORDSIZE == 64
> > +# define __PTHREAD_MUTEX_KIND_OFFSET 16
> > +#else
> > +# define __PTHREAD_MUTEX_KIND_OFFSET 12
> > +#endif
>
> OK, we have:
>
> typedef union
> {
> struct __pthread_mutex_s __data;
> char __size[__SIZEOF_PTHREAD_MUTEX_T];
> long int __align;
> } pthread_mutex_t;
>
> and then:
>
> struct __pthread_mutex_s
> {
> int __lock __LOCK_ALIGNMENT;
> unsigned int __count;
> int __owner;
> #if __WORDSIZE == 64
> unsigned int __nusers;
> #endif
> int __kind;
> #if __WORDSIZE != 64
> unsigned int __nusers;
> #endif
>
> which means the `__nusers' and `__kind' members are swapped between 64-bit
> and 32-bit hosts. Which I find kind of weird (what for?), but the offset
> of `__kind' changes accordingly and the values are correct.
Great
>
> > -#define __PTHREAD_RWLOCK_FLAGS_OFFSET 48
> > +
> > +#if __WORDSIZE == 64
> > +# define __PTHREAD_RWLOCK_FLAGS_OFFSET 48
> > +#else
> > +# define __PTHREAD_RWLOCK_FLAGS_OFFSET 24
> > +#endif
>
> Likewise (as from 09/18):
>
> typedef union
> {
> struct __pthread_rwlock_arch_t __data;
> char __size[__SIZEOF_PTHREAD_RWLOCK_T];
> long int __align;
> } pthread_rwlock_t;
>
> and:
>
> struct __pthread_rwlock_arch_t
> {
> unsigned int __readers;
> unsigned int __writers;
> unsigned int __wrphase_futex;
> unsigned int __writers_futex;
> unsigned int __pad3;
> unsigned int __pad4;
> #if __riscv_xlen == 64
> int __cur_writer;
> int __shared;
> unsigned long int __pad1;
> unsigned long int __pad2;
> unsigned int __flags;
> #else
> # if __BYTE_ORDER == __BIG_ENDIAN
> unsigned char __pad1;
> unsigned char __pad2;
> unsigned char __shared;
> unsigned char __flags;
> # else
> unsigned char __flags;
> unsigned char __shared;
> unsigned char __pad1;
> unsigned char __pad2;
> # endif
> int __cur_writer;
> #endif
> };
>
> so here we have 48 for RV64, 24 for RV32/LE, and 27 for RV/BE, meaning
> that your change is wrong. Please fix that.
I have fixed the BE offset, although I don't think we actually support BE.
>
> Also I think this change makes no sense at this point or indeed on its
> own as there's been no RV32 support added to <bits/struct_rwlock.h> as at
> this commit yet, meaning that the offsets would become inconsistent.
> Please fold it into 09/18.
Done.
Alistair
>
> Maciej
next prev parent reply other threads:[~2020-08-10 17:44 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-03 16:25 [PATCH v2 00/18] glibc port for 32-bit RISC-V (RV32) Alistair Francis
2020-06-03 16:25 ` [PATCH v2 01/18] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64 Alistair Francis
2020-07-07 22:06 ` Maciej W. Rozycki
2020-07-10 15:27 ` Alistair Francis
2020-06-03 16:25 ` [PATCH v2 02/18] RISC-V: Define __NR_* as __NR_*_time64/64 for 32-bit Alistair Francis
2020-07-08 0:09 ` Maciej W. Rozycki
2020-07-08 17:08 ` Adhemerval Zanella
2020-07-09 17:14 ` Alistair Francis
2020-07-16 0:23 ` Maciej W. Rozycki
2020-07-09 17:10 ` Alistair Francis
2020-06-03 16:25 ` [PATCH v2 03/18] RISC-V: Add support for 32-bit vDSO calls Alistair Francis
2020-07-08 1:01 ` Maciej W. Rozycki
2020-07-08 18:17 ` Alistair Francis
2020-06-03 16:25 ` [PATCH v2 04/18] RISC-V: Support dynamic loader for the 32-bit Alistair Francis
2020-07-08 1:35 ` Maciej W. Rozycki
2020-06-03 16:25 ` [PATCH v2 05/18] RISC-V: Add path of library directories " Alistair Francis
2020-07-08 18:42 ` Maciej W. Rozycki
2020-07-09 17:03 ` Alistair Francis
2020-06-03 16:25 ` [PATCH v2 06/18] RISC-V: Add arch-syscall.h for RV32 Alistair Francis
2020-07-08 19:33 ` Maciej W. Rozycki
2020-06-03 16:25 ` [PATCH v2 07/18] RISC-V: nptl: update default pthread-offsets.h Alistair Francis
2020-07-09 0:14 ` Maciej W. Rozycki
2020-07-09 11:47 ` Adhemerval Zanella
2020-07-15 19:23 ` Maciej W. Rozycki
2020-08-10 17:34 ` Alistair Francis [this message]
2020-06-03 16:25 ` [PATCH v2 08/18] riscv32: Add an architecture ipctypes.h Alistair Francis
2020-07-09 2:46 ` Maciej W. Rozycki
2020-07-09 11:36 ` Adhemerval Zanella
2020-06-03 16:25 ` [PATCH v2 09/18] RISC-V: The ABI implementation for 32-bit Alistair Francis
2020-07-09 23:33 ` Maciej W. Rozycki
2020-07-10 16:45 ` Alistair Francis
2020-07-11 1:24 ` Maciej W. Rozycki
2020-08-10 21:29 ` Alistair Francis
2020-08-27 19:43 ` Adhemerval Zanella
2020-09-25 23:03 ` Alistair Francis
2020-06-03 16:25 ` [PATCH v2 10/18] RISC-V: Hard float support " Alistair Francis
2020-07-11 0:49 ` Maciej W. Rozycki
2020-07-11 15:49 ` Alistair Francis
2020-07-11 22:13 ` Maciej W. Rozycki
2020-07-12 15:34 ` Alistair Francis
2020-07-12 22:10 ` Maciej W. Rozycki
2020-08-27 18:36 ` Alistair Francis
2020-06-03 16:25 ` [PATCH v2 11/18] RISC-V: Add ABI lists Alistair Francis
2020-07-12 20:54 ` Maciej W. Rozycki
2020-07-13 16:14 ` Alistair Francis
2020-06-03 16:25 ` [PATCH v2 12/18] RISC-V: Add the RV32 libm-test-ulps Alistair Francis
2020-06-03 17:34 ` Joseph Myers
2020-06-05 4:01 ` Alistair Francis
2020-06-03 16:26 ` [PATCH v2 13/18] RISC-V: Fix llrint and llround missing exceptions on RV32 Alistair Francis
2020-06-03 16:26 ` [PATCH v2 14/18] RISC-V: Build Infastructure for 32-bit Alistair Francis
2020-06-03 16:26 ` [PATCH v2 15/18] riscv32: Specify the arch_minimum_kernel as 5.4 Alistair Francis
2020-06-03 16:26 ` [PATCH v2 16/18] RISC-V: Add rv32 path to RTLDLIST in ldd Alistair Francis
2020-06-03 16:26 ` [PATCH v2 17/18] Documentation for the RISC-V 32-bit port Alistair Francis
2020-06-03 16:26 ` [PATCH v2 18/18] Add RISC-V 32-bit target to build-many-glibcs.py Alistair Francis
2020-06-15 22:37 ` [PATCH v2 00/18] glibc port for 32-bit RISC-V (RV32) Alistair Francis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAKmqyKNwvwMLxjo_jPCakuu5fU7DBMmU_SbryCp=A4XXsx=bTA@mail.gmail.com' \
--to=alistair23@gmail.com \
--cc=alistair.francis@wdc.com \
--cc=libc-alpha@sourceware.org \
--cc=macro@wdc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).