From: Florian Bezdeka <florian.bezdeka@siemens.com>
To: Jan Kiszka <jan.kiszka@siemens.com>, xenomai@lists.linux.dev
Subject: Re: [PATCH 02/13] y2038: cobalt/posix/timer: Adding timer_settime64
Date: Mon, 15 May 2023 11:33:42 +0200 [thread overview]
Message-ID: <40a686c6f9e03427093c14fa4850572cd91dc138.camel@siemens.com> (raw)
In-Reply-To: <a38c9123-f06e-f17c-ea83-0ca96cde7555@siemens.com>
On Fri, 2023-05-12 at 18:02 +0200, Jan Kiszka wrote:
> On 08.05.23 10:13, Florian Bezdeka wrote:
> > Add a syscall specific for timer_settime with 64bit time_t.
> >
> > Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
> > ---
> > include/cobalt/uapi/syscall.h | 1 +
> > kernel/cobalt/posix/timer.c | 32 +++++++++++++++++++++++++++++---
> > kernel/cobalt/posix/timer.h | 5 +++++
> > kernel/cobalt/trace/cobalt-posix.h | 3 ++-
> > 4 files changed, 37 insertions(+), 4 deletions(-)
> >
> > diff --git a/include/cobalt/uapi/syscall.h b/include/cobalt/uapi/syscall.h
> > index 9646a0d97..77184bd22 100644
> > --- a/include/cobalt/uapi/syscall.h
> > +++ b/include/cobalt/uapi/syscall.h
> > @@ -136,6 +136,7 @@
> > #define sc_cobalt_event_wait64 113
> > #define sc_cobalt_recvmmsg64 114
> > #define sc_cobalt_cond_wait_prologue64 115
> > +#define sc_cobalt_timer_settime64 116
> >
> > #define __NR_COBALT_SYSCALLS 128 /* Power of 2 */
> >
> > diff --git a/kernel/cobalt/posix/timer.c b/kernel/cobalt/posix/timer.c
> > index a115ded53..3c7579def 100644
> > --- a/kernel/cobalt/posix/timer.c
> > +++ b/kernel/cobalt/posix/timer.c
> > @@ -16,6 +16,7 @@
> > * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
> > */
> >
> > +#include <cobalt/kernel/time.h>
> > #include <linux/module.h>
> > #include <linux/cred.h>
> > #include <linux/err.h>
> > @@ -295,9 +296,8 @@ int __cobalt_timer_setval(struct xntimer *__restrict__ timer, int clock_flag,
> > return 0;
> > }
> >
> > - if ((unsigned long)value->it_value.tv_nsec >= ONE_BILLION ||
> > - ((unsigned long)value->it_interval.tv_nsec >= ONE_BILLION &&
> > - (value->it_value.tv_sec != 0 || value->it_value.tv_nsec != 0)))
> > + if (!timespec64_valid(&value->it_interval) ||
> > + !timespec64_valid(&value->it_value))
>
> Is that directly related to this patch? Or rather some cleanup?
I should move that into a separate patch... Expect v2 soon. It's a
valid cleanup but not directly related.
>
> > return -EINVAL;
> >
> > start = ts2ns(&value->it_value) + 1;
> > @@ -495,6 +495,32 @@ COBALT_SYSCALL(timer_settime, primary,
> > return 0;
> > }
> >
> > +COBALT_SYSCALL(timer_settime64, primary,
> > + (timer_t tm, int flags,
> > + const struct __kernel_itimerspec __user *u_newval,
> > + struct __kernel_itimerspec __user *u_oldval))
> > +{
> > + struct itimerspec64 newv, oldv, *oldvp = &oldv;
> > + int ret;
> > +
> > + if (u_oldval == NULL)
> > + oldvp = NULL;
> > +
> > + if (cobalt_get_itimerspec64(&newv, u_newval))
> > + return -EFAULT;
> > +
> > + ret = __cobalt_timer_settime(tm, flags, &newv, oldvp);
> > + if (ret)
> > + return ret;
> > +
> > + if (oldvp && cobalt_put_itimerspec64(u_oldval, oldvp)) {
> > + __cobalt_timer_settime(tm, flags, oldvp, NULL);
> > + return -EFAULT;
> > + }
> > +
> > + return 0;
> > +}
> > +
> > COBALT_SYSCALL(timer_gettime, current,
> > (timer_t tm, struct __user_old_itimerspec __user *u_val))
> > {
> > diff --git a/kernel/cobalt/posix/timer.h b/kernel/cobalt/posix/timer.h
> > index 3b580d470..16d3a572a 100644
> > --- a/kernel/cobalt/posix/timer.h
> > +++ b/kernel/cobalt/posix/timer.h
> > @@ -78,6 +78,11 @@ COBALT_SYSCALL_DECL(timer_settime,
> > const struct __user_old_itimerspec __user *u_newval,
> > struct __user_old_itimerspec __user *u_oldval));
> >
> > +COBALT_SYSCALL_DECL(timer_settime64,
> > + (timer_t tm, int flags,
> > + const struct __kernel_itimerspec __user *u_newval,
> > + struct __kernel_itimerspec __user *u_oldval));
> > +
> > COBALT_SYSCALL_DECL(timer_gettime,
> > (timer_t tm, struct __user_old_itimerspec __user *u_val));
> >
> > diff --git a/kernel/cobalt/trace/cobalt-posix.h b/kernel/cobalt/trace/cobalt-posix.h
> > index c7eef7fba..5f99b1162 100644
> > --- a/kernel/cobalt/trace/cobalt-posix.h
> > +++ b/kernel/cobalt/trace/cobalt-posix.h
> > @@ -168,7 +168,8 @@
> > __cobalt_symbolic_syscall(monitor_wait64), \
> > __cobalt_symbolic_syscall(event_wait64), \
> > __cobalt_symbolic_syscall(recvmmsg64), \
> > - __cobalt_symbolic_syscall(cond_wait_prologue64))
> > + __cobalt_symbolic_syscall(cond_wait_prologue64), \
> > + __cobalt_symbolic_syscall(timer_settime64))
> >
> > DECLARE_EVENT_CLASS(cobalt_syscall_entry,
> > TP_PROTO(unsigned int nr),
> >
>
> Jan
>
next prev parent reply other threads:[~2023-05-15 9:33 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-08 8:13 [PATCH 00/13] y2038: Part two - timer and timerfd support Florian Bezdeka
2023-05-08 8:13 ` [PATCH 01/13] y2038: cobalt: Introduce some itimerspec64 related helpers Florian Bezdeka
2023-05-12 15:59 ` Jan Kiszka
2023-05-15 9:31 ` Florian Bezdeka
2023-05-15 9:36 ` Jan Kiszka
2023-05-08 8:13 ` [PATCH 02/13] y2038: cobalt/posix/timer: Adding timer_settime64 Florian Bezdeka
2023-05-12 16:02 ` Jan Kiszka
2023-05-15 9:33 ` Florian Bezdeka [this message]
2023-05-08 8:13 ` [PATCH 03/13] y2038: lib/cobalt: Dispatch timer_settime Florian Bezdeka
2023-05-08 8:13 ` [PATCH 04/13] y2038: testsuite/smokey/y2038: Adding tests for timer_settime Florian Bezdeka
2023-05-08 8:13 ` [PATCH 05/13] y2038: cobalt/posix/timer: Adding timer_gettime64 Florian Bezdeka
2023-05-08 8:13 ` [PATCH 06/13] y2038: lib/cobalt: Dispatch timer_gettime Florian Bezdeka
2023-05-08 8:13 ` [PATCH 07/13] y2038: testsuite/smokey/y2038: Adding tests for timer_gettime Florian Bezdeka
2023-05-08 8:13 ` [PATCH 08/13] y2038: cobalt/posix/timerfd: Adding timerfd_settime64 Florian Bezdeka
2023-05-08 8:13 ` [PATCH 09/13] y2038: lib/cobalt: Dispatch timerfd_settime Florian Bezdeka
2023-05-08 8:13 ` [PATCH 10/13] y2038: testsuite/smokey/y2038: Adding tests for timerfd_settime Florian Bezdeka
2023-05-08 8:13 ` [PATCH 11/13] y2038: cobalt/posix/timerfd: Adding timerfd_gettime64 Florian Bezdeka
2023-05-08 8:13 ` [PATCH 12/13] y2038: lib/cobalt: Dispatch timerfd_gettime Florian Bezdeka
2023-05-08 8:13 ` [PATCH 13/13] y2038: testsuite/smokey/y2038: Adding tests for timerfd_gettime Florian Bezdeka
2023-05-08 10:50 ` Lukasz Majewski
2023-05-08 11:45 ` Florian Bezdeka
2023-05-12 16:09 ` [PATCH 00/13] y2038: Part two - timer and timerfd support Jan Kiszka
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=40a686c6f9e03427093c14fa4850572cd91dc138.camel@siemens.com \
--to=florian.bezdeka@siemens.com \
--cc=jan.kiszka@siemens.com \
--cc=xenomai@lists.linux.dev \
/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).