This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: RISC-V glibc port v2
- From: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- To: libc-alpha at sourceware dot org
- Date: Mon, 25 Dec 2017 10:57:07 -0200
- Subject: Re: RISC-V glibc port v2
- Authentication-results: sourceware.org; auth=none
- References: <mhng-6a19beb5-ec9a-420c-ae28-bd8cfae5e3da@palmer-si-x1c4>
On 20/12/2017 19:45, Palmer Dabbelt wrote:
> On Wed, 20 Dec 2017 13:11:02 PST (-0800), joseph@codesourcery.com wrote:
>> On Tue, 19 Dec 2017, Palmer Dabbelt wrote:
>>
>>> * Should we have padding in __pthread_rwlock_arch_t? I assume the padding on
>>> other architectures is there for ABI reasons and shouldn't be necessary for
>>> new ports, but the ports I usually rely on all have excatly the same padding
>>> so I'm worried there's another reason for this.
>>
>> The size was probably originally chosen to be the same as used by
>> Linuxthreads. Since then, there's been at least one rwlock rewrite that
>> increased the amount of space that's padding.
>>
>> On the whole I'd say it's safest to have that padding on RISC-V as well,
>> in case there are any more rewrites in future, since it's possible a
>> rewrite could increase the amount of space used as well as decreasing it,
>> and so if one architecture makes the type smaller than others that could
>> complicate any such future change needing more space.
>
> Sounds good. I'll add a comment
>
> diff --git a/sysdeps/riscv/nptl/bits/pthreadtypes-arch.h b/sysdeps/riscv/nptl/bits/pthreadtypes-arch.h
> index f15e024826ac..4fabc4a2cde2 100644
> --- a/sysdeps/riscv/nptl/bits/pthreadtypes-arch.h
> +++ b/sysdeps/riscv/nptl/bits/pthreadtypes-arch.h
> @@ -52,6 +52,10 @@
> #define __LOCK_ALIGNMENT
> #define __ONCE_ALIGNMENT
>
> +/* There is a lot of padding in this structure. While it's not strictly
> + necessary on RISC-V, we're going to leave it in to be on the safe side in
> + case it's needed in the future. Most other architectures have the padding,
> + so this gives us the same extensibility as everyone else has. */
> struct __pthread_rwlock_arch_t
> {
> unsigned int __readers;
I have a patchset that should reorganize better the pthread type internal structures
and add default version that will make new ports easier (no need to redefine them
unless the port requires something special). I am planning to send it for reviews
today or tomorrow.