aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2017-06-30posix_clocks: Use get_itimerspec64() and put_itimerspec64()Deepa Dinamani1-28/+16
Usage of these apis and their compat versions makes the syscalls: timer_settime and timer_gettime and their compat implementations simpler. This patch also serves as a preparatory patch for changing syscalls to use new time_t data types to support the y2038 effort by isolating the processing of user pointers through these apis. Signed-off-by: Deepa Dinamani <[email protected]> Signed-off-by: Al Viro <[email protected]>
2017-06-30timerfd: Use get_itimerspec64() and put_itimerspec64()Deepa Dinamani1-22/+21
Usage of these apis and their compat versions makes the syscalls: timerfd_settime and timerfd_gettime and their compat implementations simpler. This patch also serves as a preparatory patch for changing syscalls to use new time_t data types to support the y2038 effort by isolating the processing of user pointers through these apis. Signed-off-by: Deepa Dinamani <[email protected]> Signed-off-by: Al Viro <[email protected]>
2017-06-30nanosleep: Use get_timespec64() and put_timespec64()Deepa Dinamani5-38/+26
Usage of these apis and their compat versions makes the syscalls: clock_nanosleep and nanosleep and their compat implementations simpler. This is a preparatory patch to isolate data conversions to struct timespec64 at userspace boundaries. This helps contain the changes needed to transition to new y2038 safe types. Signed-off-by: Deepa Dinamani <[email protected]> Signed-off-by: Al Viro <[email protected]>
2017-06-30posix-timers: Use get_timespec64() and put_timespec64()Deepa Dinamani2-76/+70
Usage of these apis and their compat versions makes the syscalls: clock_gettime, clock_settime, clock_getres and their compat implementations simpler. This is a preparatory patch to isolate data conversions to struct timespec64 at userspace boundaries. This helps contain the changes needed to transition to new y2038 safe types. Signed-off-by: Deepa Dinamani <[email protected]> Signed-off-by: Al Viro <[email protected]>
2017-06-25posix-stubs: Conditionally include COMPAT_SYS_NI definesDeepa Dinamani1-6/+7
These apis only need to be defined if CONFIG_COMPAT is enabled. Signed-off-by: Deepa Dinamani <[email protected]> Signed-off-by: Al Viro <[email protected]>
2017-06-25time: introduce {get,put}_itimerspec64Deepa Dinamani5-1/+68
As we change the user space type for the timerfd and posix timer functions to newer data types, we need some form of conversion helpers to avoid duplicating that logic. Suggested-by: Arnd Bergmann <[email protected]> Signed-off-by: Deepa Dinamani <[email protected]> Signed-off-by: Al Viro <[email protected]>
2017-06-25time: add get_timespec64 and put_timespec64Deepa Dinamani4-0/+79
Add helper functions to convert between struct timespec64 and struct timespec at userspace boundaries. This is a preparatory patch to use timespec64 as the basic type internally in the kernel as timespec is not y2038 safe on 32 bit systems. The patch helps the cause by containing all data conversions at the userspace boundaries within these functions. Suggested-by: Arnd Bergmann <[email protected]> Signed-off-by: Deepa Dinamani <[email protected]> Signed-off-by: Al Viro <[email protected]>
2017-06-14posix-timers: Make nanosleep timespec argument constThomas Gleixner6-8/+8
No nanosleep implementation modifies the rqtp argument. Mark is const. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Al Viro <[email protected]> Cc: John Stultz <[email protected]> Cc: Peter Zijlstra <[email protected]>
2017-06-14posix-cpu-timers: Avoid timespec conversion in do_cpu_nanosleep()Thomas Gleixner1-4/+5
No point in converting the expiry time back and forth. No point either to update the value in the caller supplied variable. mark the rqtp argument const. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Al Viro <[email protected]> Cc: John Stultz <[email protected]> Cc: Peter Zijlstra <[email protected]>
2017-06-14time: Move compat_gettimeofday()/settimeofday() to nativeAl Viro2-38/+41
Signed-off-by: Al Viro <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: John Stultz <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-14time: Move compat_time()/stime() to nativeAl Viro2-40/+41
Signed-off-by: Al Viro <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: John Stultz <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-14posix-timers: Move compat_timer_create() to native, get rid of set_fs()Al Viro3-36/+42
Signed-off-by: Al Viro <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: John Stultz <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-14posix-timers: Move compat versions of clock_gettime/settime/getresAl Viro3-55/+115
Move them to the native implementations and get rid of the set_fs() hackery. Signed-off-by: Al Viro <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: John Stultz <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-14itimers: Move compat itimer syscalls to native onesAl Viro4-53/+60
get rid of set_fs(), sanitize compat copyin/copyout. Signed-off-by: Al Viro <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: John Stultz <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-14posix-timers: Take compat timer_gettime(2) to native oneAl Viro3-26/+35
... and get rid of set_fs() in there Signed-off-by: Al Viro <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: John Stultz <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-14posix-timers: Take compat timer_settime(2) to native oneAl Viro3-47/+64
... and get rid of set_fs() in there Signed-off-by: Al Viro <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: John Stultz <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-14ntp: Move adjtimex related compat syscalls to native counterpartsAl Viro5-90/+108
Get rid of set_fs() mess and sanitize compat_{get,put}_timex(), while we are at it. Signed-off-by: Al Viro <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: John Stultz <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-14posix-timers: Kill ->nsleep_restart()Al Viro5-13/+1
No more users. Signed-off-by: Al Viro <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: John Stultz <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-14hrtimers/posix-timers: Merge nanosleep timespec copyout logics into a new helperAl Viro4-29/+25
Signed-off-by: Al Viro <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: John Stultz <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-14time/posix-timers: Move the compat copyouts to the nanosleep implementationsAl Viro8-171/+142
Turn restart_block.nanosleep.{rmtp,compat_rmtp} into a tagged union (kind = 1 -> native, kind = 2 -> compat, kind = 0 -> nothing) and make the places doing actual copyout handle compat as well as native (that will become a helper in the next commit). Result: compat wrappers, messing with reassignments, etc. are gone. [ tglx: Folded in a variant of Peter Zijlstras enum patch ] Signed-off-by: Al Viro <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: John Stultz <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-14posix-timers: Store rmtp into restart_block in sys_clock_nanosleep()Al Viro4-22/+10
... instead of doing that in every ->nsleep() instance Signed-off-by: Al Viro <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: John Stultz <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-14hrtimer: Move copyout of remaining time to do_nanosleep()Al Viro1-42/+20
The hrtimer nanosleep() implementation can be simplified by moving the copy out of the remaining time to do_nanosleep() which is shared between the real nanosleep function and the restart function. The pointer to the timespec64 which is updated is already stored in the restart block at the call site, so the seperate handling of nanosleep and restart function can be avoided. [ tglx: Added changelog ] Signed-off-by: Al Viro <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: John Stultz <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-14hrtimer_nanosleep(): Pass rmtp in restart_blockAl Viro5-11/+17
Store the pointer to the timespec which gets updated with the remaining time in the restart block and remove the function argument. [ tglx: Added changelog ] Signed-off-by: Al Viro <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: John Stultz <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-14alarmtimer: Move copyout and freeze handling into alarmtimer_do_nsleep()Al Viro1-70/+32
The alarmtimer nanosleep() implementation can be simplified by moving the copy out of the remaining time to alarmtimer_do_nsleep() which is shared between the real nanosleep function and the restart function. The pointer to the timespec64 which is updated has to be stored in the restart block anyway. Instead of storing it only in the restart case, store it before calling alarmtimer_do_nsleep() and copy the remaining time in the signal exit path. [ tglx: Added changelog ] Signed-off-by: Al Viro <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: John Stultz <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-14posix-cpu-timers: Move copyout of timespec into do_cpu_nanosleep()Al Viro1-35/+28
The posix-cpu-timer nanosleep() implementation can be simplified by moving the copy out of the remaining time to do_cpu_nanosleep() which is shared between the real nanosleep function and the restart function. The pointer to the timespec64 which is updated has to be stored in the restart block anyway. Instead of storing it only in the restart case, store it before calling do_cpu_nanosleep() and copy the remaining time in the signal exit path. [ tglx: Added changelog ] Signed-off-by: Al Viro <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: John Stultz <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-12posix-timers: Handle relative posix-timers correctlyThomas Gleixner1-0/+13
The recent rework of the posix timer internals broke the magic posix mechanism, which requires that relative timers are not affected by modifications of the underlying clock. That means relative CLOCK_REALTIME timers cannot use CLOCK_REALTIME, because that can be set and adjusted. The underlying hrtimer switches the clock for these timers to CLOCK_MONOTONIC. That still works, but reading the remaining time of such a timer has been broken in the rework. The old code used the hrtimer internals directly and avoided the posix clock callbacks. Now common_timer_get() uses the underlying kclock->timer_get() callback, which is still CLOCK_REALTIME based. So the remaining time of such a timer is calculated against the wrong time base. Handle it by switching the k_itimer->kclock pointer according to the resulting hrtimer mode. k_itimer->it_clock still contains CLOCK_REALTIME because the timer might be set with ABSTIME later and then it needs to switch back to the realtime posix clock implementation. Fixes: eae1c4ae275f ("posix-timers: Make use of cancel/arm callbacks") Reported-by: Andrei Vagin <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: John Stultz <[email protected]> Cc: Cyrill Gorcunov <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-12posix-timers: Zero out oldval itimerspecThomas Gleixner1-0/+2
The recent posix timer rework moved the clearing of the itimerspec to the real syscall implementation, but forgot that the kclock->timer_get() is used by timer_settime() as well. That results in an uninitialized variable and bogus values returned to user space. Add the missing memset to timer_settime(). Fixes: eabdec043853 ("posix-timers: Zero settings value in common code") Reported-by: Andrei Vagin <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: John Stultz <[email protected]> Cc: Cyrill Gorcunov <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-12posix-timers: Fix inverted SIGEV_NONE logic in common_timer_get()Thomas Gleixner1-1/+1
The refactoring of the posix-timer core to allow better code sharing introduced inverted logic vs. SIGEV_NONE timers in common_timer_get(). That causes hrtimer_forward() to be called on active timers, which rightfully triggers the warning hrtimer_forward(). Make sig_none what it says: signal mode == SIGEV_NONE. Fixes: 91d57bae0868 ("posix-timers: Make use of forward/remaining callbacks") Reported-by: Ye Xiaolong <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: John Stultz <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-04alarmtimer: Switch over to generic set/get/rearm routineThomas Gleixner3-110/+29
All required callbacks are in place. Switch the alarm timer based posix interval timer callbacks to the common implementation and remove the incorrect private implementation. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: John Stultz <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-04alarmtimer: Implement arm callbackThomas Gleixner1-0/+22
Preparatory change to utilize the common posix timer mechanisms. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: John Stultz <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-04alarmtimer: Implement try_to_cancel callbackThomas Gleixner1-0/+10
Preparatory change to utilize the common posix timer mechanisms. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: John Stultz <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-04alarmtimer: Implement remaining callbackThomas Gleixner1-9/+22
Preparatory change to utilize the common posix timer mechanisms. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: John Stultz <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-04alarmtimer: Implement forward callbackThomas Gleixner1-0/+13
Preparatory change to utilize the common posix timer mechanisms. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: John Stultz <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-04alarmtimer: Implement timer_rearm() callbackThomas Gleixner1-1/+14
Preparatory change to utilize the common posix timer mechanisms. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: John Stultz <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-04posix-timers: Make use of cancel/arm callbacksThomas Gleixner1-81/+100
Replace the hrtimer calls by calls to the new try_to_cancel()/arm() kclock callbacks and move the hrtimer specific implementation into the corresponding callback functions. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: John Stultz <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-04posix-timers: Add cancel/arm callbacksThomas Gleixner1-0/+3
Add timer_try_to_cancel() and timer_arm() callbacks to kclock which allow to make common_timer_set() usable by both hrtimer and alarmtimer based clocks. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: John Stultz <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-04posix-timers: Zero settings value in common codeThomas Gleixner2-6/+2
Zero out the settings struct in the common code so the callbacks do not have to do it themself. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: John Stultz <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-04posix-timers: Make use of forward/remaining callbacksThomas Gleixner1-15/+49
Replace the hrtimer calls by calls to the new forward/remaining kclock callbacks and move the hrtimer specific implementation into the corresponding callback functions. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: John Stultz <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-04posix-timers: Add forward/remaining callbacksThomas Gleixner1-0/+2
Add two callbacks to kclock which allow using common_)timer_get() for both hrtimer and alarm timer based clocks. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: John Stultz <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-04posix-timers: Add active flag to k_itimerThomas Gleixner2-1/+9
Keep track of the activation state of posix timers. This is a preparatory change for making common_timer_get() usable by both hrtimer and alarm timer implementations. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: John Stultz <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-04posix-timers: Use timer_rearm() callback in posixtimer_rearm()Thomas Gleixner3-10/+11
Use the new timer_rearm() callback to replace the conditional hardcoded calls into the hrtimer and cpu timer code. This allows later to bring the same logic to alarmtimers. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: John Stultz <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-04posix-timers: Rename do_schedule_next_timerThomas Gleixner4-8/+8
That function is a misnomer. Rename it with a proper prefix to posixtimer_rearm(). Signed-off-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: John Stultz <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-04posix-timers: Add timer_rearm() callbackThomas Gleixner1-15/+18
Add a timer_rearm() callback which is used to make the rescheduling of posix interval timers independent of the underlying clock implementation. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: John Stultz <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-04posix-timers: Store k_clock pointer in k_itimerThomas Gleixner3-3/+8
Having the k_clock pointer in the k_itimer struct avoids the lookup in several code pathes and makes the next steps of unification of the hrtimer and alarmtimer based posix timers simpler. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: John Stultz <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-04posix-timers: Move interval out of the unionThomas Gleixner3-19/+18
Preparatory patch to unify the alarm timer and hrtimer based posix interval timer handling. The interval is used as a criteria for rearming decisions so moving it out of the clock specific data structures allows later unification. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: John Stultz <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-04posix-timers: Unify overrun/requeue_pending handlingThomas Gleixner2-18/+15
hrtimer based posix-timers and posix-cpu-timers handle the update of the rearming and overflow related status fields differently. Move that update to the common rearming code. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: John Stultz <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-04posix-timers: Move posix-timer internals to coreThomas Gleixner6-30/+36
None of these declarations is required outside of kernel/time. Move them to an internal header. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: John Stultz <[email protected]> Cc: Christoph Hellwig <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-04posix-timers: Cleanup struct k_itimerThomas Gleixner1-21/+40
As a preparation for further changes, cleanup the formatting of the k_itimer structure and add kernel doc comments. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: John Stultz <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-04posix-timers: Avoid gazillions of forward declarationsThomas Gleixner1-101/+89
Move it below the actual implementations as there are new callbacks coming which would require even more forward declarations. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: John Stultz <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
2017-06-04posix-clocks: Remove interval timer facility and mmap/fasync callbacksThomas Gleixner2-135/+0
The only user of this facility is ptp_clock, which does not implement any of those functions. Remove them to prevent accidental users. Especially the interval timer interfaces are now more or less impossible to implement because the necessary infrastructure has been confined to the core code. Aside of that it's really complex to make these callbacks implemented according to spec as the alarm timer implementation demonstrates. If at all then a nanosleep callback might be a reasonable extension. For now keep just what ptp_clock needs. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: John Stultz <[email protected]> Link: http://lkml.kernel.org/r/[email protected]