From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Florian Weimer <fweimer@redhat.com>,
Adhemerval Zanella via Libc-alpha <libc-alpha@sourceware.org>
Subject: Re: [PATCH v2 1/4] libio: Assume _IO_MTSAFE_IO
Date: Wed, 27 Apr 2022 15:40:01 -0300 [thread overview]
Message-ID: <56a48e5d-60e3-fa95-1fef-e2a74bb76752@linaro.org> (raw)
In-Reply-To: <87wnfahfhb.fsf@oldenburg.str.redhat.com>
On 27/04/2022 09:34, Florian Weimer wrote:
> * Adhemerval Zanella via Libc-alpha:
>
>> It is already set by default on all supported architectures and it is
>> an expectation that stdio works on multi-threaded environments.
>
> So … this cleanup has got stuck in the past because it's actually more
> than just a cleanup. We actually build most of glibc without libio
> locking. Looks like misc/ nss/ posix/ have not been covered before.
>
> Maybe we should just file a bug for the missing locking and fix this
> with this commit?
It seems a better approach, I will check which files as missing support
and open a bug report.
>
>> index 5af476c48b..c186375c31 100644
>> --- a/sysdeps/nptl/libc-lock.h
>> +++ b/sysdeps/nptl/libc-lock.h
>> @@ -25,7 +25,7 @@
>>
>>
>> /* Mutex type. */
>> -#if defined _LIBC || defined _IO_MTSAFE_IO
>> +#if defined _LIBC
>> # if (!IS_IN (libc) && !IS_IN (libpthread)) || !defined _LIBC
>> typedef struct { pthread_mutex_t mutex; } __libc_lock_recursive_t;
>> # else
>
> This doesn't look quite right. Would we want to compile this
> unconditionally now?
Afaiu using __libc_lock_recursive without _IO_MTSAFE_IO will resulting
in using __libc_lock_recursive_opaque__, which will result in a undefined
type.
Also, I really think we should not tie stdio code with general lock
primitives (as _IO_MTSAFE_IO is doing here).
>
> There's also some weirdness I can't explain. I get strange before/after
> symbol differences:
>
> DIFF eu-readelf -s after strip: nptl/pthread_rwlock_unlock.os
> --- /tmp/Left-ltjeu50v.o 2022-04-27 14:29:39.070599437 +0200
> +++ /tmp/Right-jee20kfm.o 2022-04-27 14:29:39.074599395 +0200
> @@ -1,5 +1,5 @@
>
> -Symbol table [11] '.symtab' contains 14 entries:
> +Symbol table [11] '.symtab' contains 13 entries:
> 4 local symbols String table: [12] '.strtab'
> Num: Value Size Type Bind Vis Ndx Name
> 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UNDEF
> @@ -12,7 +12,6 @@
> 7: 0000000000000000 463 FUNC GLOBAL DEFAULT 1 ___pthread_rwlock_unlo>
> 8: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UNDEF __GI___libc_fatal
> 9: 0000000000000000 463 FUNC GLOBAL DEFAULT 1 __GI___pthread_rwlock_>
> - 10: 0000000000000000 463 FUNC GLOBAL DEFAULT 1 __pthread_rwlock_unlock
> - 11: 0000000000000000 463 FUNC GLOBAL DEFAULT 1 __pthread_rwlock_unloc>
> - 12: 0000000000000000 463 FUNC GLOBAL DEFAULT 1 pthread_rwlock_unlock@>
> - 13: 0000000000000000 463 FUNC GLOBAL DEFAULT 1 pthread_rwlock_unlock@>
> + 10: 0000000000000000 463 FUNC GLOBAL DEFAULT 1 __pthread_rwlock_unloc>
> + 11: 0000000000000000 463 FUNC GLOBAL DEFAULT 1 pthread_rwlock_unlock@>
> + 12: 0000000000000000 463 FUNC GLOBAL DEFAULT 1 pthread_rwlock_unlock@>
>
> Can you reproduce this?
I didn't check the symbol generation, I will take a look.
next prev parent reply other threads:[~2022-04-27 18:40 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-26 19:15 [PATCH v2 0/4] Move libio lock single-thread optimization to generic libc-lock Adhemerval Zanella
2022-04-26 19:15 ` [PATCH v2 1/4] libio: Assume _IO_MTSAFE_IO Adhemerval Zanella
2022-04-27 12:34 ` Florian Weimer
2022-04-27 18:40 ` Adhemerval Zanella [this message]
2022-04-27 19:35 ` Adhemerval Zanella
2022-04-26 19:15 ` [PATCH v2 2/4] Consolidate stdio-lock.h Adhemerval Zanella
2022-04-27 13:25 ` Florian Weimer
2022-04-27 16:15 ` Adhemerval Zanella
2022-04-27 18:00 ` Florian Weimer
2022-04-27 18:35 ` Adhemerval Zanella
2022-04-27 18:44 ` Florian Weimer
2022-04-27 18:49 ` Adhemerval Zanella
2022-04-26 19:15 ` [PATCH v2 3/4] Move libio lock single-thread optimization to generic libc-lock (BZ #27842) Adhemerval Zanella
2022-04-27 13:30 ` Florian Weimer
2022-04-27 16:32 ` Adhemerval Zanella
2022-04-28 16:39 ` Adhemerval Zanella
2022-04-28 16:56 ` Florian Weimer
2022-04-28 17:14 ` Adhemerval Zanella
2022-04-26 19:15 ` [PATCH v2 4/4] Assume _LIBC and libc module for libc-lock.h Adhemerval Zanella
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=56a48e5d-60e3-fa95-1fef-e2a74bb76752@linaro.org \
--to=adhemerval.zanella@linaro.org \
--cc=fweimer@redhat.com \
--cc=libc-alpha@sourceware.org \
/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).