[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <43d78927-3955-acde-a2d1-d2b82932a7a6@huawei.com>
Date: Mon, 2 Jul 2018 17:34:34 +0800
From: gengdongjiu <gengdongjiu@...wei.com>
To: Thomas Gleixner <tglx@...utronix.de>,
<linux-rt-users@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<anna-maria@...utronix.de>, <john.stultz@...aro.org>
CC: Hangaohuai <hangaohuai@...wei.com>,
"zhangjianwei (D)" <zhangjianwei8@...wei.com>,
<yangchuanlong@...wei.com>,
"Zhangbin (EulerOS)" <zhangbin46@...wei.com>,
<liupeifeng3@...wei.com>
Subject: hrtimer become inaccurate with RT patch
Hi Thomas/Anna/John,
Recently I found that the hrtimer become inaccurate when there is a RT
process runs on the same cpu core, and the kernel has applied preempt_rt
patch.
The Linux kernel version is v4.1.46, and the preempt_rt patch is
patch-4.1.46-rt52.patch.
I know that in the preempt_rt environment the interrupt handlers no
longer run in interrupt context but in process context, so that RT
process will not be interrupt. But if the hrtimer is also runs in
process context the timer is useless when it's inaccurate. so I want to
consult you whether this is expected behavior? whether is reasonable to move the timer IRQ
handling to a thread?
Check the patch-4.1.46-rt52.patch will found in function
'hrtimer_interrupt' the modify below:
@@ -1296,7 +1539,10 @@ retry:
if (basenow.tv64 < hrtimer_get_softexpires_tv64(timer))
break;
- __run_hrtimer(timer, &basenow);
+ if (!hrtimer_rt_defer(timer))
+ __run_hrtimer(timer, &basenow);
+ else
+ raise = 1;
}
}
/* Reevaluate the clock bases for the next expiry */
@@ -1357,6 +1603,9 @@ retry:
tick_program_event(expires_next, 1);
printk_once(KERN_WARNING "hrtimer: interrupt took %llu ns\n",
ktime_to_ns(delta));
+out:
+ if (raise)
+ raise_softirq_irqoff(HRTIMER_SOFTIRQ);
}
I think this is why hrtimer is run as a thread, I tried to set
hrtimer.irqsafe to 1, but the timer still seemed not right. Could anyone
give some advise? Thanks.
Powered by blists - more mailing lists