linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: linux-fsdevel@vger.kernel.org
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Andrew Morton <akpm@linux-foundation.org>,
	Soheil Hassas Yeganeh <soheil.kdev@gmail.com>,
	Arnd Bergmann <arnd@arndb.de>, Shuo Chen <shuochen@google.com>,
	linux-man@vger.kernel.org
Subject: Re: [PATCH v3 1/2] epoll: add nsec timeout support with epoll_pwait2
Date: Wed, 18 Nov 2020 11:21:19 -0500	[thread overview]
Message-ID: <CA+FuTSdFTDFwOVyws19CaAP_6+c5gTrvA0ybvDo3LJ-VhPz1eQ@mail.gmail.com> (raw)
In-Reply-To: <20201118144617.986860-2-willemdebruijn.kernel@gmail.com>

On Wed, Nov 18, 2020 at 9:46 AM Willem de Bruijn
<willemdebruijn.kernel@gmail.com> wrote:
>
> From: Willem de Bruijn <willemb@google.com>
>
> Add syscall epoll_pwait2, an epoll_wait variant with nsec resolution
> that replaces int timeout with struct timespec. It is equivalent
> otherwise.
>
>     int epoll_pwait2(int fd, struct epoll_event *events,
>                      int maxevents,
>                      const struct timespec *timeout,
>                      const sigset_t *sigset);
>
> The underlying hrtimer is already programmed with nsec resolution.
> pselect and ppoll also set nsec resolution timeout with timespec.
>
> The sigset_t in epoll_pwait has a compat variant. epoll_pwait2 needs
> the same.
>
> For timespec, only support this new interface on 2038 aware platforms
> that define __kernel_timespec_t. So no CONFIG_COMPAT_32BIT_TIME.
>
> Changes
>   v3:
>   - rewrite: add epoll_pwait2 syscall instead of epoll_create1 flag
>   v2:
>   - cast to s64: avoid overflow on 32-bit platforms (Shuo Chen)
>   - minor commit message rewording
>
> Signed-off-by: Willem de Bruijn <willemb@google.com>
>
> ---

> diff --git a/arch/x86/entry/syscalls/syscall_32.tbl b/arch/x86/entry/syscalls/syscall_32.tbl
> index 109e6681b8fa..9a4e8ec207fc 100644
> --- a/arch/x86/entry/syscalls/syscall_32.tbl
> +++ b/arch/x86/entry/syscalls/syscall_32.tbl
> @@ -447,3 +447,4 @@
>  440    i386    process_madvise         sys_process_madvise
>  441    i386    watch_mount             sys_watch_mount
>  442    i386    memfd_secret            sys_memfd_secret
> +443    i386    epoll_pwait2            sys_epoll_pwait2                compat_sys_epoll_pwait2

I should have caught this sooner, but this does not work as intended.

x86 will still call epoll_pwait2 with old_timespec32.

One approach is a separate epoll_pwait2_time64 syscall, similar to
ppoll_time64. But that was added to work around legacy 32-bit ppoll.
Not needed for a new API.

In libc, ppoll_time64 is declared with type struct __timespec64. That
type is not defined in Linux uapi. Will need to look at this some
more.

  parent reply	other threads:[~2020-11-18 16:22 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-18 14:46 [PATCH v3 0/2] add epoll_pwait2 syscall Willem de Bruijn
2020-11-18 14:46 ` [PATCH v3 1/2] epoll: add nsec timeout support with epoll_pwait2 Willem de Bruijn
2020-11-18 15:00   ` Matthew Wilcox
2020-11-18 15:10     ` Willem de Bruijn
2020-11-18 15:37       ` Arnd Bergmann
2020-11-18 15:59         ` David Laight
2020-11-19 14:19           ` Willem de Bruijn
2020-11-19 14:31             ` Matthew Wilcox
2020-11-19 15:37               ` Willem de Bruijn
2020-11-19 15:45               ` Arnd Bergmann
2020-11-19 20:13                 ` Willem de Bruijn
2020-11-20  8:13                   ` Arnd Bergmann
2020-11-20 16:01                     ` Willem de Bruijn
2020-11-20 19:23                       ` Arnd Bergmann
2020-11-20 22:28                         ` Willem de Bruijn
2020-11-21  9:27                           ` Arnd Bergmann
2020-12-10 17:33                             ` Willem de Bruijn
2020-12-10 20:34                               ` Arnd Bergmann
2020-12-10 22:59                                 ` Willem de Bruijn
2021-01-11 20:06                                   ` Willem de Bruijn
2020-11-18 16:21   ` Willem de Bruijn [this message]
2020-11-18 16:50     ` Arnd Bergmann
2020-11-19  3:22       ` Willem de Bruijn
2020-11-18 14:46 ` [PATCH manpages RFC] epoll_wait.2: add epoll_pwait2 Willem de Bruijn
2020-11-18 14:46 ` [PATCH v3 2/2] selftests/filesystems: expand epoll with epoll_pwait2 Willem de Bruijn

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=CA+FuTSdFTDFwOVyws19CaAP_6+c5gTrvA0ybvDo3LJ-VhPz1eQ@mail.gmail.com \
    --to=willemdebruijn.kernel@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-man@vger.kernel.org \
    --cc=shuochen@google.com \
    --cc=soheil.kdev@gmail.com \
    --cc=viro@zeniv.linux.org.uk \
    /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 NNTP newsgroup(s).