Skip to contentSkip to conversation

hrtimer: Fix hang seen if tick_init_highres() failed

PATCH In review Guenter Roeck 3 participants 3 messages Aug 22, 2015 High-resolution timers, timer wheel, clockevents

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hrtimer: Fix hang seen if tick_init_highres() failed

Commit 75e3b37d0598 ("hrtimer: Drop return code of hrtimer_switch_to_hres()") drops the return code of hrtimer_switch_to_hres(). While doing so, it also drops the return statement itself on failure. This may cause a system hang. Seen when running arm:multi_v7_defconfig in qemu with devicetree file vexpress-v2p-ca9.

Fixes 75e3b37d0598 ("hrtimer: Drop return code of hrtimer_switch_to_hres()")
Cc Luiz Capitulino <[email protected]>
---
 kernel/time/hrtimer.c | 1 +
 1 file changed, 1 insertion(+)
kernel/time/hrtimer.c +1 -0
index 5c4fe50e47d3..457a373e2181 100644
@@ -695,6 +695,7 @@ static void hrtimer_switch_to_hres(void)
 	if (tick_init_highres()) {
 		printk(KERN_WARNING "Could not switch to high resolution "
 				    "mode on CPU %d\n", base->cpu);
+		return;
 	}
 	base->hres_active = 1;
 	hrtimer_resolution = HIGH_RES_NSEC;
Signature · 1 line
2.1.4
#1 lore raw

[tip:timers/core] hrtimer: Handle failure of tick_init_highres() gracefully

hrtimer: Handle failure of tick_init_highres() gracefully
Commit-ID:  85e1cd6e769dfc84995270d0a4838021fcb8602d
Gitweb:     http://git.kernel.org/tip/85e1cd6e769dfc84995270d0a4838021fcb8602d
Author:     Guenter Roeck <[email protected]>
AuthorDate: Sat, 22 Aug 2015 01:10:47 -0700
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Sat, 22 Aug 2015 10:57:50 +0200

hrtimer: Handle failure of tick_init_highres() gracefully

Commit 75e3b37d0598 ("hrtimer: Drop return code of hrtimer_switch_to_hres()") drops the return code of hrtimer_switch_to_hres(). While doing so, it also drops the return statement itself on failure. This may cause a system hang. Seen when running arm:multi_v7_defconfig in qemu with devicetree file vexpress-v2p-ca9.

Fixes 75e3b37d0598 ("hrtimer: Drop return code of hrtimer_switch_to_hres()")
Cc Luiz Capitulino <[email protected]>
---
 kernel/time/hrtimer.c | 1 +
 1 file changed, 1 insertion(+)
kernel/time/hrtimer.c +1 -0
index 5c4fe50..457a373 100644
@@ -695,6 +695,7 @@ static void hrtimer_switch_to_hres(void)
 	if (tick_init_highres()) {
 		printk(KERN_WARNING "Could not switch to high resolution "
 				    "mode on CPU %d\n", base->cpu);
+		return;
 	}
 	base->hres_active = 1;
 	hrtimer_resolution = HIGH_RES_NSEC;
Reviewed-by on v1 1/1
#2 lore raw
In reply to Guenter Roeck
Quoted 9 lines · On Sat, 22 Aug 2015 01:10:47 -0700 Guenter Roeck <[email protected]> wrote:

Commit 75e3b37d0598 ("hrtimer: Drop return code of hrtimer_switch_to_hres()") drops the return code of hrtimer_switch_to_hres(). While doing so, it also drops the return statement itself on failure. This may cause a system hang. Seen when running arm:multi_v7_defconfig in qemu with devicetree file vexpress-v2p-ca9.

Fixes 75e3b37d0598 ("hrtimer: Drop return code of hrtimer_switch_to_hres()")
Cc Luiz Capitulino <[email protected]>

Thanks for catching it Guenter!

Quoted 16 lines
---
 kernel/time/hrtimer.c | 1 +
 1 file changed, 1 insertion(+)
kernel/time/hrtimer.c +1 -0
index 5c4fe50e47d3..457a373e2181 100644
@@ -695,6 +695,7 @@ static void hrtimer_switch_to_hres(void)
 	if (tick_init_highres()) {
 		printk(KERN_WARNING "Could not switch to high resolution "
 				    "mode on CPU %d\n", base->cpu);
+		return;
 	}
 	base->hres_active = 1;
 	hrtimer_resolution = HIGH_RES_NSEC;