From: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
To: y2038-cunTk1MwBs8s++Sfvej+rw@public.gmane.org
Cc: Pingbo Wen <pingbo.wen-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Dmitry Torokhov
<dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
aksgarg1989-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [Y2038] [PATCH 0/3] introduce new evdev interface type
Date: Thu, 03 Dec 2015 13:54:47 +0100 [thread overview]
Message-ID: <3471947.HA9TBa0js5@wuerfel> (raw)
In-Reply-To: <1BB6B3AD-F547-49F8-886A-56EF80CE62FE-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
On Thursday 03 December 2015 20:49:06 Pingbo Wen wrote:
> > 在 2015年12月1日,18:47,Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org> 写道:
> > On Tuesday 01 December 2015 16:34:00 Pingbo Wen wrote:
> >> We can force kernel using monotonic time in EV_IF_LEGACY interface, and
> >> making input_event independent from time_t(after evdev has converted to
> >> input_value, it’s easy to do that), but that also imply userspace
> >> must change their code to fit this change. If changing userspace code is
> >> a mandatory option, why not to force them do a complete conversion?
> >
> > Most user space programs won't care, as they don't even look at the tv_sec
> > portion, and the goal is to avoid having to change them.
> >
> > There is still an open question to how exactly we want to get user space
> > to change.
> >
> > We could do some compile-time trick by having a union in struct input_event
> > and mark the existing timeval part as deprecated, so we flag any use of the
> > 32-bit tv_sec member, such as:
> >
> > struct input_event {
> > #if !defined(__KERNEL__) && __TIME_T_BITS == __BITS_PER_LONG
> > struct timeval time;
>
> > #else
> > struct {
> > union {
> > __u32 tv_sec __attribute__((deprecated));
> > __u32 tv_sec_monotonic;
> > };
> > __s32 tv_usec;
> > } time;
> > #endif
> > __u16 type;
> > __u16 code;
> > __s32 value;
> > };
>
> I have one question here, if userspace use this structure, all helper functions
> of timeval will not work. And userspace need to write extra helper function for
> this fake timeval. This just create an another urgly time structure.
Correct, this is a useful side-effect of the change: any user space access to
the event->time member that assumes it's a timeval will cause a compile-time
warning or error (depending on the access), which helps us identify the
broken code and fix it to use monotonic times as well as access the right
struct members.
> And this method also forces most of old binaries to compile with new libc, adjust
> their codes with new fake time structure.
>
> Besides, I get an idea to combine your structure with input_composite_event:
>
> union {
> struct {
> __s32 tv_usec;
> __s32 tv_sec;
> };
> __s64 time;
> } time;
>
> I prefer to use a single s64 timestamp, if our goal is to remove timeval from kernel.
We can't really remove this instance of timeval anyway, so adding an __s64 member
here is not all that helpful. We should use __s64 nanoseconds for new interfaces
like this, but I see no reason to change the one we have here.
Arnd
next prev parent reply other threads:[~2015-12-03 12:54 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-27 10:00 [PATCH 0/3] introduce new evdev interface type WEN Pingbo
2015-11-27 10:00 ` [PATCH 1/3] input: evdev: introduce new evdev interface WEN Pingbo
[not found] ` <1448618432-32357-2-git-send-email-pingbo.wen-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-11-27 10:37 ` kbuild test robot
2015-11-27 10:00 ` [PATCH 2/3] input: evdev: add new ioctl EVIOCSIFTYPE / EVIOCGIFTYPE WEN Pingbo
2015-11-27 16:59 ` Arnd Bergmann
2015-11-29 9:19 ` Pingbo Wen
2015-11-27 10:00 ` [PATCH 3/3] uinput: convert input_event to input_value WEN Pingbo
[not found] ` <1448618432-32357-1-git-send-email-pingbo.wen-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-11-27 16:58 ` [PATCH 0/3] introduce new evdev interface type Arnd Bergmann
2015-11-29 9:13 ` Pingbo Wen
2015-11-30 15:13 ` Arnd Bergmann
2015-12-01 8:34 ` Pingbo Wen
2015-12-01 8:34 ` Pingbo Wen
[not found] ` <CB4E5A6F-D514-4D3B-9C95-13A52C509EC9-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-12-01 10:47 ` Arnd Bergmann
2015-12-03 12:49 ` Pingbo Wen
[not found] ` <1BB6B3AD-F547-49F8-886A-56EF80CE62FE-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-12-03 12:54 ` Arnd Bergmann [this message]
2015-12-03 12:56 ` [Y2038] " Arnd Bergmann
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=3471947.HA9TBa0js5@wuerfel \
--to=arnd-r2ngtmty4d4@public.gmane.org \
--cc=aksgarg1989-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=pingbo.wen-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=y2038-cunTk1MwBs8s++Sfvej+rw@public.gmane.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 NNTP newsgroup(s).