lists.linaro.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
List overview
Download
Y2038
June 2015
----- 2024 -----
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
y2038@lists.linaro.org
26 participants
64 discussions
Start a n
N
ew thread
[PATCH v4 09/25] posix-timers:Change the implementation for timer_settime syscall
by Baolin Wang
This patch splits out the guts of the timer_settime syscall and changes the timer_settime syscall implementation to prepare the converting to 64bit methods for the timer_settime syscall function in posix-timers.c file. Signed-off-by: Baolin Wang <baolin.wang(a)linaro.org> --- kernel/time/posix-timers.c | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c index 2adeb29..99ccb3c 100644 --- a/kernel/time/posix-timers.c +++ b/kernel/time/posix-timers.c @@ -920,27 +920,18 @@ common_timer_set(struct k_itimer *timr, int flags, return 0; } -/* Set a POSIX.1b interval timer */ -SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags, - const struct itimerspec __user *, new_setting, - struct itimerspec __user *, old_setting) +static int __timer_settime(timer_t timer_id, int flags, struct itimerspec *new_spec, + struct itimerspec *old_spec) { struct k_itimer *timr; - struct itimerspec new_spec, old_spec; int error = 0; unsigned long flag; - struct itimerspec *rtn = old_setting ? &old_spec : NULL; struct k_clock *kc; - if (!new_setting) + if (!timespec_valid(&new_spec->it_interval) || + !timespec_valid(&new_spec->it_value)) return -EINVAL; - if (copy_from_user(&new_spec, new_setting, sizeof (new_spec))) - return -EFAULT; - - if (!timespec_valid(&new_spec.it_interval) || - !timespec_valid(&new_spec.it_value)) - return -EINVAL; retry: timr = lock_timer(timer_id, &flag); if (!timr) @@ -950,14 +941,34 @@ retry: if (WARN_ON_ONCE(!kc || !kc->timer_set)) error = -EINVAL; else - error = kc->timer_set(timr, flags, &new_spec, rtn); + error = kc->timer_set(timr, flags, new_spec, old_spec); unlock_timer(timr, flag); if (error == TIMER_RETRY) { - rtn = NULL; // We already got the old time... + old_spec = NULL; // We already got the old time... goto retry; } + return error; +} + +/* Set a POSIX.1b interval timer */ +SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags, + const struct itimerspec __user *, new_setting, + struct itimerspec __user *, old_setting) +{ + struct itimerspec new_spec, old_spec; + int error = 0; + struct itimerspec *rtn = old_setting ? &old_spec : NULL; + + if (!new_setting) + return -EINVAL; + + if (copy_from_user(&new_spec, new_setting, sizeof (new_spec))) + return -EFAULT; + + error = __timer_settime(timer_id, flags, &new_spec, rtn); + if (old_setting && !error && copy_to_user(old_setting, &old_spec, sizeof (old_spec))) error = -EFAULT; -- 1.7.9.5
9 years, 5 months
1
0
0
0
[PATCH v4] isdn: Use ktime_t instead of 'struct timeval'
by Tina Ruchandani
'struct timeval' uses 32-bit representation for seconds which will overflow in year 2038 and beyond. mISDN/clock.c needs to compute and store elapsed time in intervals of 125 microseconds. This patch replaces the usage of 'struct timeval' with 64-bit ktime_t which is y2038 safe. The patch also replaces do_gettimeofday (wall-clock time) with ktime_get (monotonic time) since we only care about elapsed time here. Signed-off-by: Tina Ruchandani <ruchandani.tina(a)gmail.com> Suggested-by: Arnd Bergmnann <arnd(a)arndb.de> -- Changes in v4: - Fix compile error (NS_PER_SEC -> NSEC_PER_SEC) Changes in v3: - Use division scheme suggested by Arnd Bergmann to avoid a (64-bit variable) / (32-bit variable) expression. Changes in v2: - Avoid possible truncation bug caused by assigning ktime_us_delta output to a 16-bit number. - Use ktime_us_delta, more concise than a combination of ktime_sub and ktime_to_us. --- drivers/isdn/mISDN/clock.c | 56 ++++++++++++++++++---------------------------- include/linux/mISDNif.h | 2 +- 2 files changed, 23 insertions(+), 35 deletions(-) diff --git a/drivers/isdn/mISDN/clock.c b/drivers/isdn/mISDN/clock.c index 693fb7c..409c508 100644 --- a/drivers/isdn/mISDN/clock.c +++ b/drivers/isdn/mISDN/clock.c @@ -37,6 +37,7 @@ #include <linux/types.h> #include <linux/stddef.h> #include <linux/spinlock.h> +#include <linux/ktime.h> #include <linux/mISDNif.h> #include <linux/export.h> #include "core.h" @@ -45,7 +46,7 @@ static u_int *debug; static LIST_HEAD(iclock_list); static DEFINE_RWLOCK(iclock_lock); static u16 iclock_count; /* counter of last clock */ -static struct timeval iclock_tv; /* time stamp of last clock */ +static ktime_t iclock_tv; /* time stamp of last clock */ static int iclock_tv_valid; /* already received one timestamp */ static struct mISDNclock *iclock_current; @@ -53,7 +54,7 @@ void mISDN_init_clock(u_int *dp) { debug = dp; - do_gettimeofday(&iclock_tv); + iclock_tv = ktime_get(); } static void @@ -139,12 +140,11 @@ mISDN_unregister_clock(struct mISDNclock *iclock) EXPORT_SYMBOL(mISDN_unregister_clock); void -mISDN_clock_update(struct mISDNclock *iclock, int samples, struct timeval *tv) +mISDN_clock_update(struct mISDNclock *iclock, int samples, ktime_t *tv) { u_long flags; - struct timeval tv_now; - time_t elapsed_sec; - int elapsed_8000th; + ktime_t tv_now; + u16 delta; write_lock_irqsave(&iclock_lock, flags); if (iclock_current != iclock) { @@ -160,28 +160,22 @@ mISDN_clock_update(struct mISDNclock *iclock, int samples, struct timeval *tv) /* increment sample counter by given samples */ iclock_count += samples; if (tv) { /* tv must be set, if function call is delayed */ - iclock_tv.tv_sec = tv->tv_sec; - iclock_tv.tv_usec = tv->tv_usec; - } else - do_gettimeofday(&iclock_tv); + iclock_tv = *tv; + } else { + iclock_tv = ktime_get(); + } } else { /* calc elapsed time by system clock */ if (tv) { /* tv must be set, if function call is delayed */ - tv_now.tv_sec = tv->tv_sec; - tv_now.tv_usec = tv->tv_usec; - } else - do_gettimeofday(&tv_now); - elapsed_sec = tv_now.tv_sec - iclock_tv.tv_sec; - elapsed_8000th = (tv_now.tv_usec / 125) - - (iclock_tv.tv_usec / 125); - if (elapsed_8000th < 0) { - elapsed_sec -= 1; - elapsed_8000th += 8000; + tv_now = *tv; + } else { + tv_now = ktime_get(); } + delta = ktime_divns(ktime_sub(tv_now, iclock_tv), + (NSEC_PER_SEC / 8000)); /* add elapsed time to counter and set new timestamp */ - iclock_count += elapsed_sec * 8000 + elapsed_8000th; - iclock_tv.tv_sec = tv_now.tv_sec; - iclock_tv.tv_usec = tv_now.tv_usec; + iclock_count += delta; + iclock_tv = tv_now; iclock_tv_valid = 1; if (*debug & DEBUG_CLOCK) printk("Received first clock from source '%s'.\n", @@ -195,22 +189,16 @@ unsigned short mISDN_clock_get(void) { u_long flags; - struct timeval tv_now; - time_t elapsed_sec; - int elapsed_8000th; + ktime_t tv_now; + u16 delta; u16 count; read_lock_irqsave(&iclock_lock, flags); /* calc elapsed time by system clock */ - do_gettimeofday(&tv_now); - elapsed_sec = tv_now.tv_sec - iclock_tv.tv_sec; - elapsed_8000th = (tv_now.tv_usec / 125) - (iclock_tv.tv_usec / 125); - if (elapsed_8000th < 0) { - elapsed_sec -= 1; - elapsed_8000th += 8000; - } + tv_now = ktime_get(); + delta = ktime_divns(ktime_sub(tv_now, iclock_tv), + (NSEC_PER_SEC / 8000)); /* add elapsed time to counter */ - count = iclock_count + elapsed_sec * 8000 + elapsed_8000th; + count = iclock_count + delta; read_unlock_irqrestore(&iclock_lock, flags); return count; } diff --git a/include/linux/mISDNif.h b/include/linux/mISDNif.h index 246a352..ac02c54 100644 --- a/include/linux/mISDNif.h +++ b/include/linux/mISDNif.h @@ -596,7 +596,7 @@ static inline struct mISDNdevice *dev_to_mISDN(struct device *dev) } extern void set_channel_address(struct mISDNchannel *, u_int, u_int); -extern void mISDN_clock_update(struct mISDNclock *, int, struct timeval *); +extern void mISDN_clock_update(struct mISDNclock *, int, ktime_t *); extern unsigned short mISDN_clock_get(void); extern const char *mISDNDevName4ch(struct mISDNchannel *); -- 2.2.0.rc0.207.ga3a616c
9 years, 5 months
2
1
0
0
[PATCH] drm/exynos/ipp: Replace struct timeval usage
by Tina Ruchandani
'struct timeval' uses a 32-bit seconds representation which will overflow in the year 2038 and beyond. This patch replaces the use of struct timeval with struct timespec64 which uses a 64-bit seconds representation and is y2038 safe. The patch is part of a larger effort to remove all 32-bit timekeeping variables (timeval, time_t and timespec) from the kernel. --- drivers/gpu/drm/exynos/exynos_drm_ipp.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_ipp.c b/drivers/gpu/drm/exynos/exynos_drm_ipp.c index b7f1cbc..7cd4a97 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_ipp.c +++ b/drivers/gpu/drm/exynos/exynos_drm_ipp.c @@ -16,6 +16,7 @@ #include <linux/types.h> #include <linux/clk.h> #include <linux/pm_runtime.h> +#include <linux/time64.h> #include <drm/drmP.h> #include <drm/exynos_drm.h> @@ -1414,7 +1415,7 @@ static int ipp_send_event(struct exynos_drm_ippdrv *ippdrv, struct drm_exynos_ipp_queue_buf qbuf; struct drm_exynos_ipp_send_event *e; struct list_head *head; - struct timeval now; + struct timespec64 now; unsigned long flags; u32 tbuf_id[EXYNOS_DRM_OPS_MAX] = {0, }; int ret, i; @@ -1518,10 +1519,11 @@ static int ipp_send_event(struct exynos_drm_ippdrv *ippdrv, e = list_first_entry(&c_node->event_list, struct drm_exynos_ipp_send_event, base.link); - do_gettimeofday(&now); - DRM_DEBUG_KMS("tv_sec[%ld]tv_usec[%ld]\n", now.tv_sec, now.tv_usec); + getnstimeofday64(&now); + DRM_DEBUG_KMS("tv_sec[%lld]tv_usec[%lld]\n", now.tv_sec, (now.tv_nsec / + NSEC_PER_SEC)); e->event.tv_sec = now.tv_sec; - e->event.tv_usec = now.tv_usec; + e->event.tv_usec = now.tv_nsec / NSEC_PER_SEC; e->event.prop_id = property->prop_id; /* set buffer id about source destination */ -- 2.2.0.rc0.207.ga3a616c
9 years, 5 months
2
1
0
0
[PATCH v4 00/25] Convert the posix_clock_operations and k_clock structure to ready for 2038
by Baolin Wang
This patch series changes the 32-bit time types (timespec/itimerspec) to the 64-bit types (timespec64/itimerspec64), since 32-bit time types will break in the year 2038. This patch series introduces new methods with timespec64/itimerspec64 type, and removes the old ones with timespec/itimerspec type for posix_clock_operations and k_clock structure. Baolin Wang (25): time:Introduce struct itimerspec64 timekeeping:Introduce the current_kernel_time64() hrtimer:Introduce hrtimer_get_res64() security: Introduce security_settime64() time:Introduce the do_sys_settimeofday64() posix-timers:Introduce {get,put}_timespec/{get,put}_itimerspec posix-timers: Split up timer_gettime()/timer_settime()/clock_settime()/ clock_gettime()/clock_getres(). posix-timers: Convert timer_gettime()/timer_settime()/clock_settime()/ clock_gettime()/clock_getres() to timespec64/itimerspec64. mmtimer:Convert to timespec64/itimerspec64 alarmtimer:Convert to timespec64/itimerspec64 posix-clock:Convert to timespec64/itimerspec64 time:Introduce timespec64_to_jiffies()/jiffies_to_timespec64() cputime:Introduce cputime_to_timespec64()/timespec64_to_cputime() posix-cpu-timers:Convert to timespec64/itimerspec64 k_clock:Remove timespec/itimerspec arch/powerpc/include/asm/cputime.h | 6 +- arch/s390/include/asm/cputime.h | 8 +- drivers/char/mmtimer.c | 36 +++-- drivers/ptp/ptp_clock.c | 26 +--- include/asm-generic/cputime_jiffies.h | 10 +- include/asm-generic/cputime_nsecs.h | 4 +- include/linux/cputime.h | 16 ++ include/linux/hrtimer.h | 16 +- include/linux/jiffies.h | 21 ++- include/linux/posix-clock.h | 10 +- include/linux/posix-timers.h | 18 +-- include/linux/security.h | 25 +++- include/linux/time64.h | 35 +++++ include/linux/timekeeping.h | 26 +++- kernel/time/alarmtimer.c | 43 +++--- kernel/time/hrtimer.c | 10 +- kernel/time/posix-clock.c | 20 +-- kernel/time/posix-cpu-timers.c | 84 ++++++----- kernel/time/posix-timers.c | 259 +++++++++++++++++++++------------ kernel/time/time.c | 20 +-- kernel/time/timekeeping.c | 6 +- kernel/time/timekeeping.h | 1 - security/commoncap.c | 2 +- security/security.c | 2 +- 24 files changed, 437 insertions(+), 267 deletions(-) -- 1.7.9.5
9 years, 5 months
2
2
0
0
← Newer
1
2
3
4
5
6
7
Older →
Jump to page:
1
2
3
4
5
6
7
Results per page:
10
25
50
100
200