On Saturday 11 April 2015 18:46:54 Baolin Wang wrote:
> This patch introduces the cputime_to_timespec64() function and
> jiffies_to_timespec64() function for converting the jiffies
> value to timespec64 value.
>
> Signed-off-by: Baolin Wang <baolin.wang(a)linaro.org>
> ---
> include/asm-generic/cputime_jiffies.h | 6 ++++++
> include/linux/jiffies.h | 2 ++
> kernel/time/time.c | 14 ++++++++++++++
> 3 files changed, 22 insertions(+)
>
> diff --git a/include/asm-generic/cputime_jiffies.h b/include/asm-generic/cputime_jiffies.h
> index fe386fc..c0c4fcb 100644
> --- a/include/asm-generic/cputime_jiffies.h
> +++ b/include/asm-generic/cputime_jiffies.h
> @@ -52,6 +52,12 @@ typedef u64 __nocast cputime64_t;
> jiffies_to_timespec(cputime_to_jiffies(__ct),__val)
>
> /*
> + * Convert cputime to timespec64.
> + */
> +#define cputime_to_timespec64(__ct,__val) \
> + jiffies_to_timespec64(cputime_to_jiffies(__ct),__val)
> +
> +/*
> * Convert cputime to timeval and back.
You missed an important piece here: cputime_to_timespec64 is architecture
specific, and arch/s390 as well as arch/powerpc have their own implementations,
so you have to introduce all three cputime_to_timespec64 implementations
before using it.
Arnd
On Saturday 11 April 2015 18:46:50 Baolin Wang wrote:
> This patch introduces the new methods with timespec64 type for k_clcok structure,
> converts the timepsec type to timespec64 type in k_clock structure and implements
> some callback function.
>
> This patch also converts the timespec type to timespec64 type for timekeeping_clocktai
> function which is used only in the posix-timers.c file.
>
> Next step will migrate all the k_clock users to use the new methods with timespec64 type,
> and it contains the files of mmtimer.c, alarmtimer.c, posix-clock.c and
> posix-cpu-timers.c.
>
> Signed-off-by: Baolin Wang <baolin.wang(a)linaro.org>
The changes in this patch all look good, but as I mentioned, I would
separate the two things you do here:
> struct k_clock {
> int (*clock_getres) (const clockid_t which_clock, struct timespec *tp);
> + int (*clock_getres64) (const clockid_t which_clock,
> + struct timespec64 *tp);
> int (*clock_set) (const clockid_t which_clock,
> const struct timespec *tp);
> + int (*clock_set64) (const clockid_t which_clock,
> + const struct timespec64 *tp);
> int (*clock_get) (const clockid_t which_clock, struct timespec * tp);
> + int (*clock_get64) (const clockid_t which_clock, struct timespec64 *tp);
> int (*clock_adj) (const clockid_t which_clock, struct timex *tx);
> int (*timer_create) (struct k_itimer *timer);
> int (*nsleep) (const clockid_t which_clock, int flags,
a) introducing and using the function pointers
> @@ -278,9 +284,9 @@ static int posix_get_tai(clockid_t which_clock, struct timespec *tp)
> static __init int init_posix_timers(void)
> {
> struct k_clock clock_realtime = {
> - .clock_getres = hrtimer_get_res,
> - .clock_get = posix_clock_realtime_get,
> - .clock_set = posix_clock_realtime_set,
> + .clock_getres64 = hrtimer_get_res64,
> + .clock_get64 = posix_clock_realtime_get,
> + .clock_set64 = posix_clock_realtime_set,
> .clock_adj = posix_clock_realtime_adj,
> .nsleep = common_nsleep,
and b) converting some of the k_clock definitions.
Arnd
On Saturday 11 April 2015 18:46:49 Baolin Wang wrote:
> This patch introduces hrtimer_get_res64() function to get the timer resolution
> with timespec64 type, and moves the hrtimer_get_res() function into
> include/linux/hrtimer.h as a 'static inline' helper that just calls hrtimer_get_res64.
>
> Signed-off-by: Baolin Wang <baolin.wang(a)linaro.org>
>
Looks good.
Arnd