unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella Netto via Libc-alpha <libc-alpha@sourceware.org>
To: Arnd Bergmann <arnd@arndb.de>, Florian Weimer <fweimer@redhat.com>
Cc: YunQiang Su <yunqiang.su@cipunited.com>,
	Xi Ruoyao <libc-alpha@sourceware.org>,
	aurelien@aurel32.net, Jiaxun Yang <jiaxun.yang@flygoat.com>,
	"Maciej W. Rozycki" <macro@orcam.me.uk>,
	YunQiang Su <syq@debian.org>
Subject: Re: [PATCH v3] Define in_int32_t_range to check if the 64 bit time_t syscall should be used
Date: Tue, 8 Nov 2022 10:49:40 -0300	[thread overview]
Message-ID: <1c812047-6cf0-107d-faa3-70532d5ca0de@linaro.org> (raw)
In-Reply-To: <eadadfd4-397b-4aef-8061-7fa22303766f@app.fastmail.com>



On 08/11/22 10:27, Arnd Bergmann wrote:
> On Tue, Nov 8, 2022, at 13:51, Adhemerval Zanella Netto wrote:
>> On 08/11/22 09:28, Arnd Bergmann wrote:
>>
>> Sigh, I have added the use of 64 bit syscall if required for some
>> sysmbols because I assumed that 32 bit time_t syscall would be always
>> available.  This is small optimization to avoid issuing a lot of
>> 64 bit syscall, specially for syscall like futex.
>>
>> But if kernel does indeed assume that COMPAT_32BIT_TIME is a supported
>> configuration I think we will need to roll out the optimization and
>> always issue the 64 bit time_t syscalls anyway.  From a glibc point of
>> view it should not matter much besides some small overhead for newer
>> glibc running on older kernels (we might add a global to disable the
>> 64-bit call if kernel does not support, as we do for some specific
>> syscalls).
> 
> It's possible that I have misread what glibc does at the moment,
> as I see there are checks for __ASSUME_TIME64_SYSCALLS in the
> same code path.
> 
> To clarify: I think an important configuration is one where
> an embedded system assumes both kernel and userspace are
> always modern and only support time64. This means
> CONFIG_COMPAT_32BIT_TIME is disabled in the kernel, and glibc
> is built to only support a modern enough kernel to assume
> time64 support is always available. I have not tested whether
> this works at the moment, but it probably does not require
> a large rework if there is something still missing. Sorry
> for having hijacked this thread if this is already supported.
> 
> If glibc is configured to support older linux-3.2 and includes
> the time32 fallbacks for that, it's not unreasonable to require
> CONFIG_COMPAT_32BIT_TIME=y for those. It would be
> good to document this dependency, or even have an early
> runtime check similar to the "kernel too old" error that
> glibc produces when there is a version mismatch.

Yes, the 32 bit fallback assumes that you either use the default minimum
kernel or configure with --enable-kernel with a value lower than 5.1.
And the optimization such as ecf2661281c was added on the basis that for
such configuration the 32 time_t is always present.  

For __ASSUME_TIME64_SYSCALLS (default fro 64 bit time_t ABI and for 32
bit time_t with --enable-kernel=5.1) the 32 bit syscall should not be
issued.

There are still the issue for a default configured glibc when running
on kernels with CONFIG_COMPAT_32BIT_TIME=y, this would require to remove
the fallback optimizations for !__ASSUME_TIME64_SYSCALLS.

  reply	other threads:[~2022-11-08 13:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-04  1:39 [PATCH] Use in_int32_t_range to check need 64bit syscall YunQiang Su
2022-11-08  4:49 ` [PATCH v3] Define in_int32_t_range to check if the 64 bit time_t syscall should be used YunQiang Su
2022-11-08 10:39   ` Arnd Bergmann
2022-11-08 11:17     ` Florian Weimer via Libc-alpha
2022-11-08 11:33       ` Arnd Bergmann
2022-11-08 11:39         ` Florian Weimer via Libc-alpha
2022-11-08 11:55           ` Adhemerval Zanella Netto via Libc-alpha
2022-11-08 12:28           ` Arnd Bergmann
2022-11-08 12:51             ` Adhemerval Zanella Netto via Libc-alpha
2022-11-08 13:27               ` Arnd Bergmann
2022-11-08 13:49                 ` Adhemerval Zanella Netto via Libc-alpha [this message]
2022-11-08 14:07                   ` Arnd Bergmann
2022-11-08 14:27                     ` Adhemerval Zanella Netto via Libc-alpha
2022-11-08 19:47                       ` Adhemerval Zanella Netto via Libc-alpha
2022-11-08 23:29                         ` Rich Felker
2022-11-17 17:35   ` Adhemerval Zanella Netto 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=1c812047-6cf0-107d-faa3-70532d5ca0de@linaro.org \
    --to=libc-alpha@sourceware.org \
    --cc=adhemerval.zanella@linaro.org \
    --cc=arnd@arndb.de \
    --cc=aurelien@aurel32.net \
    --cc=fweimer@redhat.com \
    --cc=jiaxun.yang@flygoat.com \
    --cc=macro@orcam.me.uk \
    --cc=syq@debian.org \
    --cc=yunqiang.su@cipunited.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).