diff mbox

[1/9] timer_list: Add the base offset so remaining nsecs are accurate for non monotonic timers

Message ID 1439844063-7957-2-git-send-email-john.stultz@linaro.org
State Accepted
Commit 38bf985b05625df3fbbc1dbf543bdd2da447c2af
Headers show

Commit Message

John Stultz Aug. 17, 2015, 8:40 p.m. UTC
I noticed for non-monotonic timers in timer_list, some of the
output looked a little confusing.

For example:
 #1: <0000000000000000>, posix_timer_fn, S:01, hrtimer_start_range_ns, leap-a-day/2360
 # expires at 1434412800000000000-1434412800000000000 nsecs [in 1434410725062375469 to 1434410725062375469 nsecs]

You'll note the relative time till the expiration "[in xxx to
yyy nsecs]" is incorrect. This is because its printing the delta
between CLOCK_MONOTONIC time to the CLOCK_REALTIME expiration.

This patch fixes this issue by adding the clock offset to the
"now" time which we use to calculate the delta.

Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Daniel Bristot de Oliveira <bristot@redhat.com>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Jiri Bohac <jbohac@suse.cz>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
 kernel/time/timer_list.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

John Stultz Aug. 17, 2015, 9:05 p.m. UTC | #1
On Mon, Aug 17, 2015 at 2:01 PM, Shuah Khan <shuahkh@osg.samsung.com> wrote:
> On 08/17/2015 02:40 PM, John Stultz wrote:
>> I noticed for non-monotonic timers in timer_list, some of the
>> output looked a little confusing.
>>
>> For example:
>>  #1: <0000000000000000>, posix_timer_fn, S:01, hrtimer_start_range_ns, leap-a-day/2360
>>  # expires at 1434412800000000000-1434412800000000000 nsecs [in 1434410725062375469 to 1434410725062375469 nsecs]
>>
>> You'll note the relative time till the expiration "[in xxx to
>> yyy nsecs]" is incorrect. This is because its printing the delta
>> between CLOCK_MONOTONIC time to the CLOCK_REALTIME expiration.
>>
>> This patch fixes this issue by adding the clock offset to the
>> "now" time which we use to calculate the delta.
>>
>> Cc: Prarit Bhargava <prarit@redhat.com>
>> Cc: Daniel Bristot de Oliveira <bristot@redhat.com>
>> Cc: Richard Cochran <richardcochran@gmail.com>
>> Cc: Jan Kara <jack@suse.cz>
>> Cc: Jiri Bohac <jbohac@suse.cz>
>> Cc: Thomas Gleixner <tglx@linutronix.de>
>> Cc: Ingo Molnar <mingo@redhat.com>
>> Cc: Shuah Khan <shuahkh@osg.samsung.com>
>> Signed-off-by: John Stultz <john.stultz@linaro.org>
>> ---
>
> Hi John,
>
> I see just this patch in the series and not the others. Could you
> please make sure I am on the cc for all of them. I will review and
> try to get these into 4.3

So sorry here. I actually had you on CC for this from a previous patch
series this patch was included in, and didn't remove you before
sending. I'm hoping Ingo queues these for 4.3, so you shouldn't have
to do anything (unless you want to review it and provide any feedback
:).

thanks
-john
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
diff mbox

Patch

diff --git a/kernel/time/timer_list.c b/kernel/time/timer_list.c
index a4536e1..129c960 100644
--- a/kernel/time/timer_list.c
+++ b/kernel/time/timer_list.c
@@ -137,7 +137,7 @@  print_base(struct seq_file *m, struct hrtimer_clock_base *base, u64 now)
 		   (unsigned long long) ktime_to_ns(base->offset));
 #endif
 	SEQ_printf(m,   "active timers:\n");
-	print_active_timers(m, base, now);
+	print_active_timers(m, base, now + ktime_to_ns(base->offset));
 }
 
 static void print_cpu(struct seq_file *m, int cpu, u64 now)