[S390] correct ktime to tod clock comparator conversion
authorMartin Schwidefsky <schwidefsky@de.ibm.com>
Fri, 17 Feb 2012 09:29:23 +0000 (10:29 +0100)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Fri, 17 Feb 2012 09:29:33 +0000 (10:29 +0100)
The conversion of the ktime to a value suitable for the clock comparator
does not take changes to wall_to_monotonic into account. In fact the
conversion just needs the boot clock (sched_clock_base_cc) and the
total_sleep_time.

This is applicable to 3.2+ kernels.

CC: stable@vger.kernel.org
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/kernel/time.c

index fa02f443f5f65dfa70c5804c9b411d9b357d7dd1..14da278febbfa89c2a20ea797fa9a4c6ff1a1de1 100644 (file)
@@ -113,11 +113,14 @@ static void fixup_clock_comparator(unsigned long long delta)
 static int s390_next_ktime(ktime_t expires,
                           struct clock_event_device *evt)
 {
+       struct timespec ts;
        u64 nsecs;
 
-       nsecs = ktime_to_ns(ktime_sub(expires, ktime_get_monotonic_offset()));
+       ts.tv_sec = ts.tv_nsec = 0;
+       monotonic_to_bootbased(&ts);
+       nsecs = ktime_to_ns(ktime_add(timespec_to_ktime(ts), expires));
        do_div(nsecs, 125);
-       S390_lowcore.clock_comparator = TOD_UNIX_EPOCH + (nsecs << 9);
+       S390_lowcore.clock_comparator = sched_clock_base_cc + (nsecs << 9);
        set_clock_comparator(S390_lowcore.clock_comparator);
        return 0;
 }
This page took 0.027546 seconds and 5 git commands to generate.