unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki via Libc-alpha" <libc-alpha@sourceware.org>
To: Alistair Francis <alistair23@gmail.com>
Cc: GNU C Library <libc-alpha@sourceware.org>,
	Alistair Francis <alistair.francis@wdc.com>
Subject: Re: [PATCH v2 09/18] RISC-V: The ABI implementation for 32-bit
Date: Sat, 11 Jul 2020 02:24:26 +0100 (BST)	[thread overview]
Message-ID: <alpine.LFD.2.21.2007110156210.24175@redsun52.ssa.fujisawa.hgst.com> (raw)
In-Reply-To: <CAKmqyKMH9P2hM4XF954Nxox_TZ1vHLR_9fAapRFHHHFL7htM3Q@mail.gmail.com>

On Fri, 10 Jul 2020, Alistair Francis wrote:

> >  I note there is an extensive discussion on the way to move forward here:
> > <https://sourceware.org/glibc/wiki/Y2038ProofnessDesign#utmp_types_and_APIs>
> > We might as well try to implement it right away, so as to avoid being
> > limited to 32-bit time records here.
> 
> Is there an advantage of doing it now or can we put this off for the
> next release?

 The change is major enough it'll have to wait for the next development 
cycle anyway.  It shouldn't matter that much for RV32 glibc deployments 
though, given the amount of suitable hardware available.

> >  NB some existing ports do have __WORDSIZE_TIME64_COMPAT32 set and cleared
> > for their 64-bit and 32-bit ABIs respectively, as per the note in our
> > top-level bits/wordsize.h, however this reflects the state as before we
> > introduced the possibility for `__time_t' to be a 64-bit type with
> > `__WORDSIZE == 32' ABIs.  Given the turn of events I think the note ought
> > to be updated accordingly; I gather it was missed with commit 07fe93cd9850
> > ("generic/typesizes.h: Add support for 32-bit arches with 64-bit types").

 Will you be able to look into it?

 The context here is before Y2038 changes __WORDSIZE_TIME64_COMPAT32 would 
only be clear for 64-bit ABIs with those 64-bit systems that do not have 
any 32-bit ABI (compatibility mode) to support, such as the DEC Alpha.  
And it would always be clear for 32-bit ABIs, so as to use the proper 
`__time_t' type without changing the width of actual data held there in 
the structure.

 I'm not sure what the story is behind the S/390 port though; perhaps it 
does not support ABI coexistence in a single run-time environment.

> > >    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
> > >  };
> >
> >  I note with this change the RV32 structure will use the generic layout as
> > per sysdeps/nptl/bits/struct_rwlock.h, however regrettably RV64 does not.
> > Would it make sense to instead have the layout the same between RV64 and
> > RV32, perhaps by redefining `__pad1' and `__pad2' in terms of `unsigned
> > long long' (which would have alignment implications though) or otherwise?
> 
> I'm not sure which one is better. On one hand it seems better to be
> more generic and therefore RV32 should use the generic interface. On
> the other hand the more similar they are the better. I'm still leaning
> towards we should be generic where possible.

 It would be good to get a second opinion here.

> >  Is there any benefit from having `__flags' and `__shared' (and the
> > reserve) grouped within a single 32-bit word?  I gather there is, given
> > the lengths gone to to match the bit lanes across the word regardless of
> > the endianness.  But what is it?
> 
> I have no idea.

 Especially given this.

> > > +# define _FP_DIV_MEAT_S(R, X, Y)     _FP_DIV_MEAT_1_udiv_norm (S, R, X, Y)
> > > +# define _FP_DIV_MEAT_D(R, X, Y)     _FP_DIV_MEAT_2_udiv (D, R, X, Y)
> > > +# define _FP_DIV_MEAT_Q(R, X, Y)     _FP_DIV_MEAT_4_udiv (Q, R, X, Y)
> > > +
> > > +# define _FP_NANFRAC_S               _FP_QNANBIT_S
> > > +# define _FP_NANFRAC_D               _FP_QNANBIT_D, 0
> > > +# define _FP_NANFRAC_Q               _FP_QNANBIT_Q, 0, 0, 0
> >
> >  Likewise.  There seems to be an established practice for this header
> > across architectures to have no space between macro arguments or before
> > the opening parenthesis.  This might help with the alignment.
> 
> I still think it makes sense to follow the glibc style though, even if
> other archs don't.
> 
> Let me know if it should be a different way and I'll update it.

 There is the issue of the discrepancy compared to the libgcc version, and 
while `diff -l' and `patch -l' solve that for manual processing, more 
sophisticated tools may not cope and require manual intervention.

 Again, I would suggest getting a second opinion.

  Maciej

  reply	other threads:[~2020-07-11  1:24 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 via Libc-alpha
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 via Libc-alpha
2020-07-07 22:06   ` Maciej W. Rozycki via Libc-alpha
2020-07-10 15:27     ` Alistair Francis via Libc-alpha
2020-06-03 16:25 ` [PATCH v2 02/18] RISC-V: Define __NR_* as __NR_*_time64/64 for 32-bit Alistair Francis via Libc-alpha
2020-07-08  0:09   ` Maciej W. Rozycki via Libc-alpha
2020-07-08 17:08     ` Adhemerval Zanella via Libc-alpha
2020-07-09 17:14       ` Alistair Francis via Libc-alpha
2020-07-16  0:23       ` Maciej W. Rozycki via Libc-alpha
2020-07-09 17:10     ` Alistair Francis via Libc-alpha
2020-06-03 16:25 ` [PATCH v2 03/18] RISC-V: Add support for 32-bit vDSO calls Alistair Francis via Libc-alpha
2020-07-08  1:01   ` Maciej W. Rozycki via Libc-alpha
2020-07-08 18:17     ` Alistair Francis via Libc-alpha
2020-06-03 16:25 ` [PATCH v2 04/18] RISC-V: Support dynamic loader for the 32-bit Alistair Francis via Libc-alpha
2020-07-08  1:35   ` Maciej W. Rozycki via Libc-alpha
2020-06-03 16:25 ` [PATCH v2 05/18] RISC-V: Add path of library directories " Alistair Francis via Libc-alpha
2020-07-08 18:42   ` Maciej W. Rozycki via Libc-alpha
2020-07-09 17:03     ` Alistair Francis via Libc-alpha
2020-06-03 16:25 ` [PATCH v2 06/18] RISC-V: Add arch-syscall.h for RV32 Alistair Francis via Libc-alpha
2020-07-08 19:33   ` Maciej W. Rozycki via Libc-alpha
2020-06-03 16:25 ` [PATCH v2 07/18] RISC-V: nptl: update default pthread-offsets.h Alistair Francis via Libc-alpha
2020-07-09  0:14   ` Maciej W. Rozycki via Libc-alpha
2020-07-09 11:47     ` Adhemerval Zanella via Libc-alpha
2020-07-15 19:23       ` Maciej W. Rozycki via Libc-alpha
2020-08-10 17:34     ` Alistair Francis via Libc-alpha
2020-06-03 16:25 ` [PATCH v2 08/18] riscv32: Add an architecture ipctypes.h Alistair Francis via Libc-alpha
2020-07-09  2:46   ` Maciej W. Rozycki via Libc-alpha
2020-07-09 11:36     ` Adhemerval Zanella via Libc-alpha
2020-06-03 16:25 ` [PATCH v2 09/18] RISC-V: The ABI implementation for 32-bit Alistair Francis via Libc-alpha
2020-07-09 23:33   ` Maciej W. Rozycki via Libc-alpha
2020-07-10 16:45     ` Alistair Francis via Libc-alpha
2020-07-11  1:24       ` Maciej W. Rozycki via Libc-alpha [this message]
2020-08-10 21:29         ` Alistair Francis via Libc-alpha
2020-08-27 19:43           ` Adhemerval Zanella via Libc-alpha
2020-09-25 23:03             ` Alistair Francis via Libc-alpha
2020-06-03 16:25 ` [PATCH v2 10/18] RISC-V: Hard float support " Alistair Francis via Libc-alpha
2020-07-11  0:49   ` Maciej W. Rozycki via Libc-alpha
2020-07-11 15:49     ` Alistair Francis via Libc-alpha
2020-07-11 22:13       ` Maciej W. Rozycki via Libc-alpha
2020-07-12 15:34         ` Alistair Francis via Libc-alpha
2020-07-12 22:10           ` Maciej W. Rozycki via Libc-alpha
2020-08-27 18:36             ` Alistair Francis via Libc-alpha
2020-06-03 16:25 ` [PATCH v2 11/18] RISC-V: Add ABI lists Alistair Francis via Libc-alpha
2020-07-12 20:54   ` Maciej W. Rozycki via Libc-alpha
2020-07-13 16:14     ` Alistair Francis via Libc-alpha
2020-06-03 16:25 ` [PATCH v2 12/18] RISC-V: Add the RV32 libm-test-ulps Alistair Francis via Libc-alpha
2020-06-03 17:34   ` Joseph Myers
2020-06-05  4:01     ` Alistair Francis via Libc-alpha
2020-06-03 16:26 ` [PATCH v2 13/18] RISC-V: Fix llrint and llround missing exceptions on RV32 Alistair Francis via Libc-alpha
2020-06-03 16:26 ` [PATCH v2 14/18] RISC-V: Build Infastructure for 32-bit Alistair Francis via Libc-alpha
2020-06-03 16:26 ` [PATCH v2 15/18] riscv32: Specify the arch_minimum_kernel as 5.4 Alistair Francis via Libc-alpha
2020-06-03 16:26 ` [PATCH v2 16/18] RISC-V: Add rv32 path to RTLDLIST in ldd Alistair Francis via Libc-alpha
2020-06-03 16:26 ` [PATCH v2 17/18] Documentation for the RISC-V 32-bit port Alistair Francis via Libc-alpha
2020-06-03 16:26 ` [PATCH v2 18/18] Add RISC-V 32-bit target to build-many-glibcs.py Alistair Francis via Libc-alpha
2020-06-15 22:37 ` [PATCH v2 00/18] glibc port for 32-bit RISC-V (RV32) Alistair Francis via Libc-alpha

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

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.21.2007110156210.24175@redsun52.ssa.fujisawa.hgst.com \
    --to=libc-alpha@sourceware.org \
    --cc=alistair.francis@wdc.com \
    --cc=alistair23@gmail.com \
    --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).