Latency histogram broken after "hrtimer: Set expiry time before switch_hrtimer_base()"
In an rt-kernel with CONFIG_MISSED_TIMER_OFFSETS_HIST enabled, __hrtimer_start_range_ns() now crashes, as new_base is not assigned before it is used.
I'm not sure how this should be fixed; is it:
kernel/hrtimer.c +1 -1
@@ -1108,7 +1108,7 @@ int __hrtimer_start_range_ns(struct hrti#ifdef CONFIG_MISSED_TIMER_OFFSETS_HIST { -ktime_t now = new_base->get_time (); +ktime_t now = base->get_time ();if (ktime_to_ns (tim) <ktime_to_ns (now)) timer->praecox = now;
--- END ---
or:
kernel/hrtimer.c +5 -5
@@ -1106,6 +1106,11 @@ int __hrtimer_start_range_ns(struct hrti#endif } +hrtimer_set_expires_range_ns (timer, tim, delta_ns); + +/* Switch the timer base, if necessary: */ + new_base =switch_hrtimer_base (timer, base, mode &HRTIMER_MODE_PINNED ); +#ifdef CONFIG_MISSED_TIMER_OFFSETS_HIST {ktime_t now = new_base->get_time ();
@@ -1117,11 +1122,6 @@ int __hrtimer_start_range_ns(struct hrti }#endif -hrtimer_set_expires_range_ns (timer, tim, delta_ns); - -/* Switch the timer base, if necessary: */ - new_base =switch_hrtimer_base (timer, base, mode &HRTIMER_MODE_PINNED ); -timer_stats_hrtimer_set_start_info (timer); leftmost =enqueue_hrtimer (timer, new_base);
--- END ---
or something else?
Ben.
Signature · 2 lines
Ben Hutchings 73.46% of all statistics are made up.
Quoted 3 lines · Ben Hutchings
In an rt-kernel with
CONFIG_MISSED_TIMER_OFFSETS_HISTenabled,__hrtimer_start_range_ns()now crashes, asnew_baseis not assigned before it is used.
Oh yeah, forgot about this.
Quoted 1 line
I'm not sure how this should be fixed; is it:
My (3.12-ish tree) merge resolution was the later, but it shouldn't matter which you choose, what's stored where is unchanged pre/post.
Quoted 47 lines
kernel/hrtimer.c +1
-2@@ -1108,7 +1108,7 @@ int __hrtimer_start_range_ns(struct hrti#ifdef CONFIG_MISSED_TIMER_OFFSETS_HIST { -ktime_t now = new_base->get_time (); +ktime_t now = base->get_time ();if (ktime_to_ns (tim) <ktime_to_ns (now)) timer->praecox = now; --- END ---or:
kernel/hrtimer.c +5
-6@@ -1106,6 +1106,11 @@ int __hrtimer_start_range_ns(struct hrti#endif } +hrtimer_set_expires_range_ns (timer, tim, delta_ns); + +/* Switch the timer base, if necessary: */ + new_base =switch_hrtimer_base (timer, base, mode &HRTIMER_MODE_PINNED ); +#ifdef CONFIG_MISSED_TIMER_OFFSETS_HIST {ktime_t now = new_base->get_time ();@@ -1117,11 +1122,6 @@ int __hrtimer_start_range_ns(struct hrti }#endif -hrtimer_set_expires_range_ns (timer, tim, delta_ns); - -/* Switch the timer base, if necessary: */ - new_base =switch_hrtimer_base (timer, base, mode &HRTIMER_MODE_PINNED ); -timer_stats_hrtimer_set_start_info (timer); leftmost =enqueue_hrtimer (timer, new_base); --- END ---or something else?
Ben.
(CCs stable -rt maintainer)
Quoted 61 lines · Mike Galbraith
Quoted 3 lines · Ben Hutchings
In an rt-kernel with
CONFIG_MISSED_TIMER_OFFSETS_HISTenabled,__hrtimer_start_range_ns()now crashes, asnew_baseis not assigned before it is used.Oh yeah, forgot about this.
Quoted 1 line
I'm not sure how this should be fixed; is it:
My (3.12-ish tree) merge resolution was the later, but it shouldn't matter which you choose, what's stored where is unchanged pre/post.
Quoted 47 lines
kernel/hrtimer.c +1
-2@@ -1108,7 +1108,7 @@ int __hrtimer_start_range_ns(struct hrti#ifdef CONFIG_MISSED_TIMER_OFFSETS_HIST { -ktime_t now = new_base->get_time (); +ktime_t now = base->get_time ();if (ktime_to_ns (tim) <ktime_to_ns (now)) timer->praecox = now; --- END ---or:
kernel/hrtimer.c +5
-6@@ -1106,6 +1106,11 @@ int __hrtimer_start_range_ns(struct hrti#endif } +hrtimer_set_expires_range_ns (timer, tim, delta_ns); + +/* Switch the timer base, if necessary: */ + new_base =switch_hrtimer_base (timer, base, mode &HRTIMER_MODE_PINNED ); +#ifdef CONFIG_MISSED_TIMER_OFFSETS_HIST {ktime_t now = new_base->get_time ();@@ -1117,11 +1122,6 @@ int __hrtimer_start_range_ns(struct hrti }#endif -hrtimer_set_expires_range_ns (timer, tim, delta_ns); - -/* Switch the timer base, if necessary: */ - new_base =switch_hrtimer_base (timer, base, mode &HRTIMER_MODE_PINNED ); -timer_stats_hrtimer_set_start_info (timer); leftmost =enqueue_hrtimer (timer, new_base); --- END ---or something else?
Ben.
Carsten Emde
Tested-byQuoted 7 lines · Mike Galbraith
[..]
Quoted 5 lines · Mike Galbraith
Quoted 3 lines · Ben Hutchings
In an rt-kernel with
CONFIG_MISSED_TIMER_OFFSETS_HISTenabled,__hrtimer_start_range_ns()now crashes, asnew_baseis not assigned before it is used.
Quoted 6 lines
Quoted 6 lines
Oh yeah, forgot about this.
Quoted 1 line
I'm not sure how this should be fixed; is it:
My (3.12-ish tree) merge resolution was the later, but it shouldn't matter which you choose, what's stored where is unchanged pre/post.
I can confirm that 3.12.22-rt34 systems with CONFIG_MISSED_TIMER_OFFSETS_HIST enabled crash at an early boot stage. After applying Ben's second patch proposal, all is back to normal.
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
kernel/hrtimer.c +1
-1@@ -1108,7 +1108,7 @@ int __hrtimer_start_range_ns(struct hrti#ifdef CONFIG_MISSED_TIMER_OFFSETS_HIST { -ktime_t now = new_base->get_time (); +ktime_t now = base->get_time ();
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
kernel/hrtimer.c +0
-1if (ktime_to_ns (tim) <ktime_to_ns (now)) timer->praecox = now; --- END ---or:
Didn't use this one.
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
kernel/hrtimer.c +5
-5@@ -1106,6 +1106,11 @@ int __hrtimer_start_range_ns(struct hrti#endif } +hrtimer_set_expires_range_ns (timer, tim, delta_ns); + +/* Switch the timer base, if necessary: */ + new_base =switch_hrtimer_base (timer, base, mode &HRTIMER_MODE_PINNED ); +#ifdef CONFIG_MISSED_TIMER_OFFSETS_HIST {ktime_t now = new_base->get_time ();@@ -1117,11 +1122,6 @@ int __hrtimer_start_range_ns(struct hrti }#endif -hrtimer_set_expires_range_ns (timer, tim, delta_ns); - -/* Switch the timer base, if necessary: */ - new_base =switch_hrtimer_base (timer, base, mode &HRTIMER_MODE_PINNED ); -timer_stats_hrtimer_set_start_info (timer);
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
kernel/hrtimer.c +0
-1leftmost =enqueue_hrtimer (timer, new_base); --- END ---or something else?
Thanks,
-Carsten.