v4.11.12-rt15
Subsystems (2)
Dear RT folks!
I'm pleased to announce the v4.11.12-rt15 patch set.
Changes since v4.11.12-rt14:
- Programmed wake ups (nanosleep, clock_nanosleep, …) by a task with RT priority will still be carried out in the hardirq context (nothing changes). If it is programmed by task with a normal priority then the wake up will be carried out in the softirq context via the ktimersoftd thread.
The advantage is that multiple wake ups of non-RT tasks won't disturb the RT task. Reported by Gratian Crisan.
- Paul Gortmaker reported splat during boot when TSC (on x86) becomes unstable and kernel switches to an alternative. This has been fixed by cherry-picking a patch from upstream.
- After the hrtimer rework, certain wake ups (like those programmed in the past using the softirq context) won't fire. Reported by Mike Galbraith, patched by Anna-Maria Gleixner.
- After the hrtimer rework, wake ups using CLOCK_REALTIME and a relative delay were affected by clock_settime() (they should have not been). Reported by Mike Galbraith.
Known issues
None
The delta patch against v4.11.12-rt14 is appended below and can be found here:
https://cdn.kernel.org/pub/linux/kernel/projects/rt/4.11/incr/patch-4.11.12-rt14-rt15.patch.xz
You can get this release via the git tree at:
git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git v4.11.12-rt15
The RT patch against v4.11.12 can be found here:
https://cdn.kernel.org/pub/linux/kernel/projects/rt/4.11/older/patch-4.11.12-rt15.patch.xz
The split quilt queue is available at:
https://cdn.kernel.org/pub/linux/kernel/projects/rt/4.11/older/patches-4.11.12-rt15.tar.xz
Sebastian
kernel/sched/clock.c +39 -21
@@ -124,6 +124,12 @@ int sched_clock_stable(void)return static_branch_likely (&__sched_clock_stable); } +static void __scd_stamp (struct sched_clock_data *scd) +{ + scd->tick_gtod =ktime_get_ns (); + scd->tick_raw =sched_clock (); +} +static void __set_sched_clock_stable (void ) {struct sched_clock_data *scd;
@@ -148,8 +154,37 @@ static void __set_sched_clock_stable(void)tick_dep_clear (TICK_DEP_BIT_CLOCK_UNSTABLE ); } +/* +* If we ever get here, we're screwed, because we found out -- typically after +* the fact -- that TSC wasn't good. This means all our clocksources (including +* ktime) could have reported wrong values. +* +* What we do here is an attempt to fix up and continue sort of where we left +* off in a coherent manner. +* +* The only way to fully avoid random clock jumps is to boot with: +* "tsc=unstable". +*/ static void __sched_clock_work (struct work_struct *work) { +struct sched_clock_data *scd; +int cpu; + +/* take a current timestamp and set 'now' */ +preempt_disable (); + scd =this_scd (); +__scd_stamp (scd); + scd->clock = scd->tick_gtod + __gtod_offset; +preempt_enable (); + +/* clone to all CPUs */ +for_each_possible_cpu (cpu) +per_cpu (sched_clock_data, cpu) = *scd; + +printk (KERN_INFO "sched_clock: Marking unstable (%lld, %lld)<-(%lld, %lld)\n" , + scd->tick_gtod, __gtod_offset, + scd->tick_raw, __sched_clock_offset); +static_branch_disable (&__sched_clock_stable); }
@@ -157,27 +192,11 @@ static DECLARE_WORK(sched_clock_work, __sched_clock_work);static void __clear_sched_clock_stable (void ) { -struct sched_clock_data *scd =this_scd (); - -/* -* Attempt to make the stable->unstable transition continuous. -* -* Trouble is, this is typically called from the TSC watchdog -* timer, which is late per definition. This means the tick -* values can already be screwy. -* -* Still do what we can. -*/ - __gtod_offset = (scd->tick_raw + __sched_clock_offset) - (scd->tick_gtod); - -printk (KERN_INFO "sched_clock: Marking unstable (%lld, %lld)<-(%lld, %lld)\n" , - scd->tick_gtod, __gtod_offset, - scd->tick_raw, __sched_clock_offset); +if (!sched_clock_stable ()) +return ;tick_dep_set (TICK_DEP_BIT_CLOCK_UNSTABLE ); - -if (sched_clock_stable ()) -schedule_work (&sched_clock_work); +schedule_work (&sched_clock_work); }void clear_sched_clock_stable (void )
@@ -364,8 +383,7 @@ void sched_clock_tick(void)* XXX arguably we can skip this if we expose tsc_clocksource_reliable */ scd =this_scd (); - scd->tick_raw =sched_clock (); - scd->tick_gtod =ktime_get_ns (); +__scd_stamp (scd);if (!sched_clock_stable () &&likely (sched_clock_running))sched_clock_local (scd);
kernel/time/hrtimer.c +28 -3
@@ -562,8 +562,14 @@ static inline ktime_t hrtimer_update_base(struct hrtimer_cpu_base *base)ktime_t *offs_boot = &base->clock_base[HRTIMER_BASE_BOOTTIME ].offset;ktime_t *offs_tai = &base->clock_base[HRTIMER_BASE_TAI ].offset; -return ktime_get_update_offsets_now (&base->clock_was_set_seq, +ktime_t now =ktime_get_update_offsets_now (&base->clock_was_set_seq, offs_real, offs_boot, offs_tai); + + base->clock_base[HRTIMER_BASE_REALTIME_SOFT ].offset = *offs_real; + base->clock_base[HRTIMER_BASE_BOOTTIME_SOFT ].offset = *offs_boot; + base->clock_base[HRTIMER_BASE_TAI_SOFT ].offset = *offs_tai; + +return now; }/*
@@ -1252,6 +1258,8 @@ static void __hrtimer_init(struct hrtimer *timer, clockid_t clock_id, clock_id =CLOCK_MONOTONIC ; else if (clock_id == CLOCK_REALTIME_SOFT) clock_id =CLOCK_MONOTONIC_SOFT ; + else if (clock_id == CLOCK_REALTIME_HARD) + clock_id =CLOCK_MONOTONIC_HARD ; } base =hrtimer_clockid_to_base (clock_id);
@@ -1622,14 +1630,31 @@ static enum hrtimer_restart hrtimer_wakeup(struct hrtimer *timer)return HRTIMER_NORESTART ; } +#ifdef CONFIG_PREEMPT_RT_FULL +static bool task_is_elevated (struct task_struct *tsk) +{ +int policy = tsk->policy; + +if (policy ==SCHED_FIFO || policy ==SCHED_RR ) +return true; +if (policy ==SCHED_DEADLINE ) +return true; +return false; +} +#endif +static void __hrtimer_init_sleeper (struct hrtimer_sleeper *sl,clockid_t clock_id,enum hrtimer_mode mode,struct task_struct *task) {#ifdef CONFIG_PREEMPT_RT_FULL -if (!(clock_id &HRTIMER_BASE_SOFT_MASK )) - clock_id |=HRTIMER_BASE_HARD_MASK ; +if (!(clock_id & (HRTIMER_BASE_HARD_MASK |HRTIMER_BASE_SOFT_MASK ))) { +if (task_is_elevated (current) || system_state !=SYSTEM_RUNNING ) + clock_id |=HRTIMER_BASE_HARD_MASK ; +else + clock_id |=HRTIMER_BASE_SOFT_MASK ; + }#endif __hrtimer_init (&sl->timer, clock_id, mode); sl->timer.function = hrtimer_wakeup;
localversion-rt +1 -1
@@ -1 +1 @@ --rt14 +-rt15
Quoted 222 lines · On Wednesday 11 October 2017 06:35:33 Sebastian Andrzej Siewior wrote:
Dear RT folks!
I'm pleased to announce the v4.11.12-rt15 patch set.
Changes since v4.11.12-rt14:
- Programmed wake ups (nanosleep,
clock_nanosleep, …) by a task with RT priority will still be carried out in the hardirq context (nothing changes). If it is programmed by task with a normal priority then the wake up will be carried out in the softirq context via the ktimersoftd thread.
The advantage is that multiple wake ups of non-RT tasks won't disturb the RT task. Reported by Gratian Crisan.- Paul Gortmaker reported splat during boot when TSC (on x86)
becomes unstable and kernel switches to an alternative. This has been fixed by cherry-picking a patch from upstream.- After the hrtimer rework, certain wake ups (like those programmed
in the past using the softirq context) won't fire. Reported by Mike Galbraith, patched by Anna-Maria Gleixner.- After the hrtimer rework, wake ups using
CLOCK_REALTIMEand a relative delay were affected byclock_settime()(they should have not been). Reported by Mike Galbraith.Known issues
NoneThe delta patch against v4.11.12-rt14 is appended below and can be found here:
https://cdn.kernel.org/pub/linux/kernel/projects/rt/4.11/incr/patch-4.
11.12-rt14-rt15.patch.xzYou can get this release via the git tree at:
git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git
v4.11.12-rt15The RT patch against v4.11.12 can be found here:
https://cdn.kernel.org/pub/linux/kernel/projects/rt/4.11/older/patch-4
.11.12-rt15.patch.xzThe split quilt queue is available at:
https://cdn.kernel.org/pub/linux/kernel/projects/rt/4.11/older/patches
-4.11.12-rt15.tar.xzSebastian
kernel/sched/clock.c +8
-0@@ -124,6 +124,12 @@ int sched_clock_stable(void)return static_branch_likely (&__sched_clock_stable); } +static void __scd_stamp (struct sched_clock_data *scd) +{ + scd->tick_gtod =ktime_get_ns (); + scd->tick_raw =sched_clock (); +} +static void __set_sched_clock_stable (void ) {struct sched_clock_data *scd;@@ -148,8 +154,37 @@ static void __set_sched_clock_stable(void)tick_dep_clear (TICK_DEP_BIT_CLOCK_UNSTABLE ); } +/* +* If we ever get here, we're screwed, because we found out -- typically after + * the fact -- that TSC wasn't good. This means all our clocksources (including + * ktime) could have reported wrong values.
+ *
+ * What we do here is an attempt to fix up and continue sort of where we left + * off in a coherent manner.
+ *
+ * The only way to fully avoid random clock jumps is to boot with:
+ * "tsc=unstable".
+ */
static void__sched_clock_work(struct work_struct *work)
{kernel/sched/clock.c +15
-0+struct sched_clock_data *scd; +int cpu; + +/* take a current timestamp and set 'now' */ +preempt_disable (); + scd =this_scd (); +__scd_stamp (scd); + scd->clock = scd->tick_gtod + __gtod_offset; +preempt_enable (); + +/* clone to all CPUs */ +for_each_possible_cpu (cpu) +per_cpu (sched_clock_data, cpu) = *scd; + + printk(KERN_INFO "sched_clock: Marking unstable (%lld, %lld)<-(%lld,%lld)\n", +
scd->tick_gtod,__gtod_offset,kernel/sched/clock.c +2
-12+ scd->tick_raw, __sched_clock_offset); +static_branch_disable (&__sched_clock_stable); }@@ -157,27 +192,11 @@ static DECLARE_WORK(sched_clock_work, __sched_clock_work);static void __clear_sched_clock_stable (void ) { -struct sched_clock_data *scd =this_scd (); - -/* -* Attempt to make the stable->unstable transition continuous. -* -* Trouble is, this is typically called from the TSC watchdog -* timer, which is late per definition. This means the tick -* values can already be screwy. -* -* Still do what we can. -*/ - __gtod_offset = (scd->tick_raw + __sched_clock_offset) -(
scd->tick_gtod); -kernel/sched/clock.c +0
-1- printk(KERN_INFO "sched_clock: Marking unstable (%lld, %lld)<-(%lld,%lld)\n", -
scd->tick_gtod,__gtod_offset,kernel/sched/clock.c +3
-4- scd->tick_raw, __sched_clock_offset); +if (!sched_clock_stable ()) +return ;tick_dep_set (TICK_DEP_BIT_CLOCK_UNSTABLE ); - -if (sched_clock_stable ()) -schedule_work (&sched_clock_work); +schedule_work (&sched_clock_work); }void clear_sched_clock_stable (void )@@ -364,8 +383,7 @@ void sched_clock_tick(void)* XXX arguably we can skip this if we expose
tsc_clocksource_reliable*/kernel/sched/clock.c +1
-2scd =this_scd (); - scd->tick_raw =sched_clock (); - scd->tick_gtod =ktime_get_ns (); +__scd_stamp (scd);if (!sched_clock_stable () &&likely (sched_clock_running))sched_clock_local (scd);kernel/time/hrtimer.c +0
-0@@ -562,8 +562,14 @@ static inline ktime_t hrtimer_update_base(struct
hrtimer_cpu_base*base)ktime_t*offs_boot= &base->clock_base[HRTIMER_BASE_BOOTTIME].offset;ktime_t*offs_tai= &base->clock_base[HRTIMER_BASE_TAI].offset;kernel/time/hrtimer.c +27
-3-return ktime_get_update_offsets_now (&base->clock_was_set_seq, +ktime_t now =ktime_get_update_offsets_now (&base->clock_was_set_seq, offs_real, offs_boot, offs_tai); + + base->clock_base[HRTIMER_BASE_REALTIME_SOFT ].offset = *offs_real; + base->clock_base[HRTIMER_BASE_BOOTTIME_SOFT ].offset = *offs_boot; + base->clock_base[HRTIMER_BASE_TAI_SOFT ].offset = *offs_tai; + +return now; }/* @@ -1252,6 +1258,8 @@ static void __hrtimer_init(struct hrtimer *timer, clockid_t clock_id, clock_id = CLOCK_MONOTONIC; else if (clock_id == CLOCK_REALTIME_SOFT) clock_id =CLOCK_MONOTONIC_SOFT ; + else if (clock_id == CLOCK_REALTIME_HARD) + clock_id =CLOCK_MONOTONIC_HARD ; } base =hrtimer_clockid_to_base (clock_id);@@ -1622,14 +1630,31 @@ static enum hrtimer_restart hrtimer_wakeup(struct hrtimer *timer) return HRTIMER_NORESTART; } +#ifdef CONFIG_PREEMPT_RT_FULL +static bool task_is_elevated (struct task_struct *tsk) +{ +int policy = tsk->policy; + +if (policy ==SCHED_FIFO || policy ==SCHED_RR ) +return true; +if (policy ==SCHED_DEADLINE ) +return true; +return false; +} +#endif +static void __hrtimer_init_sleeper (struct hrtimer_sleeper *sl,clockid_t clock_id,enum hrtimer_mode mode,struct task_struct *task) {#ifdef CONFIG_PREEMPT_RT_FULL -if (!(clock_id &HRTIMER_BASE_SOFT_MASK )) - clock_id |=HRTIMER_BASE_HARD_MASK ; +if (!(clock_id & (HRTIMER_BASE_HARD_MASK |HRTIMER_BASE_SOFT_MASK ))) { + if (task_is_elevated(current) || system_state != SYSTEM_RUNNING) + clock_id |= HRTIMER_BASE_HARD_MASK; + else + clock_id |= HRTIMER_BASE_SOFT_MASK; + }#endif __hrtimer_init (&sl->timer, clock_id, mode); sl->timer.function = hrtimer_wakeup;localversion-rt +1
-2@@ -1 +1 @@ --rt14 +-rt15 --
Quoted 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Neat, and newer than the kernel.org release by several steps, its 4.10-rc3, so where can I get the whole thing, ready for a make menu|x|g| config?
I am trying to make linuxcnc run on a rock64, its so new you can still smell the paint.
Cheers, Gene Heskett
Signature · 4 lines
"There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) Genes Web page <http://geneslinuxbox.net:6309/gene>
On Wednesday 11 October 2017 14:57:36 Gene Heskett wrote:
git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git
v4.11.12-rt15
does not exist.
Cheers, Gene Heskett
Signature · 4 lines
"There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) Genes Web page <http://geneslinuxbox.net:6309/gene>
Quoted 4 lines · Gene Heskett
git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git
v4.11.12-rt15does not exist.
Hi Gene,
I'll download and build from
https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.11.tar.xz
https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.11.tar.sign
https://www.kernel.org/pub/linux/kernel/v4.x/patch-4.11.12.xz
https://www.kernel.org/pub/linux/kernel/v4.x/patch-4.11.12.sign
https://www.kernel.org/pub/linux/kernel/projects/rt/4.11/older/patch-4.11.12-rt15.patch.xz
https://www.kernel.org/pub/linux/kernel/projects/rt/4.11/older/patch-4.11.12-rt15.patch.sign
Regards,
Ralf
Quoted 19 lines · On Thursday 12 October 2017 00:42:08 Ralf Mardorf wrote:
Quoted 4 lines · Gene Heskett
git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git
v4.11.12-rt15does not exist.
Hi Gene,
I'll download and build from
https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.11.tar.xz
https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.11.tar.sign
https://www.kernel.org/pub/linux/kernel/v4.x/patch-4.11.12.xz
https://www.kernel.org/pub/linux/kernel/v4.x/patch-4.11.12.sign
https://www.kernel.org/pub/linux/kernel/projects/rt/4.11/older/patch-4
.11.12-rt15.patch.xz
https://www.kernel.org/pub/linux/kernel/projects/rt/4.11/older/patch-4
.11.12-rt15.patch.sign
Quoted 2 lines
Regards,
Ralf
All links worked.
Full rt-preempt build underway, _on_ the rock64. Thanks Ralf. Est 2 hours for kernel. I note this "make help" is much more "helpfull". Last time thru I didn't understand that making the dtsb's was a separate step, so of course the make install wasn't complete and the reboot was to the older kernel. I might even copy all this to the pi3b, but I expect a build on it will take most of a day. They use a /boot/config.txt to control which of several installed kernels to boot. I'm not 100% sure I have the rock64's boot selection mechanism understood yet.
Question you might know about: These logitech "unifying" keyboard/mouse buttons for wireless keyboards & mice, does one button handle both keyboard and mouse if dmesg reports it as unifying? I am wondering if that might be my missed events problem on the pi, which is driving my attempts to bring up the much faster rock64 as an lcnc controller.
This is something I've not seen discussed on any of the lists I'm subbed to.
Thanks again.
Cheers, Gene Heskett
Signature · 4 lines
"There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) Genes Web page <http://geneslinuxbox.net:6309/gene>
Quoted 6 lines · Gene Heskett
On Wednesday 11 October 2017 14:57:36 Gene Heskett wrote:
git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git
v4.11.12-rt15does not exist.
The URL is correct, the tag exists. What is the problem?
Quoted 1 line
Cheers, Gene Heskett
Sebastian
Quoted 10 lines · On Friday 13 October 2017 09:28:19 Sebastian Andrzej Siewior wrote:
Quoted 6 lines · Gene Heskett
On Wednesday 11 October 2017 14:57:36 Gene Heskett wrote:
git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git
v4.11.12-rt15does not exist.
The URL is correct, the tag exists. What is the problem?
"site does not exist"
Its moot now, Ralf sent me a recipe that worked. Built ok but not yet installed, the Dell running my mill has committed suicide. So thats project #1 ATM.
What I've built is 4.11.12-rt15. So its the same version.
Quoted 3 lines
Quoted 1 line
Cheers, Gene Heskett
Sebastian
Cheers, Gene Heskett
Signature · 4 lines
"There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) Genes Web page <http://geneslinuxbox.net:6309/gene>
Quoted 17 lines · On Friday 13 October 2017 10:57:20 Gene Heskett wrote:
Quoted 9 lines · On Friday 13 October 2017 09:28:19 Sebastian Andrzej Siewior wrote:
Quoted 6 lines · Gene Heskett
On Wednesday 11 October 2017 14:57:36 Gene Heskett wrote:
git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.gi
t v4.11.12-rt15does not exist.
The URL is correct, the tag exists. What is the problem?
"site does not exist"
Its moot now, Ralf sent me a recipe that worked. Built ok but not yet installed, the Dell running my mill has committed suicide. So thats project #1 ATM.
Quoted 7 lines
What I've built is 4.11.12-rt15. So its the same version.
Quoted 3 lines
Quoted 1 line
Cheers, Gene Heskett
Sebastian
Cheers, Gene Heskett
Update, the tail-less rodent on that machine died, and that killed keyboard and everything. So I'm off to get a couple more mice at wallies.
Cheers, Gene Heskett
Signature · 4 lines
"There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) Genes Web page <http://geneslinuxbox.net:6309/gene>