[ANNOUNCE] v4.16.18-rt9

Dear RT folks!

I'm pleased to announce the v4.16.18-rt9 patch set.

Changes since v4.16.18-rt8:

  - A patch from upstream to avoid a warning in the kthread code. The
    warning was part of the stable update.

  - Revert of a timer patch which is no longer since the initial problem
    was addressed upstream. Patch by Anna-Maria Gleixner.

Known issues
     - A warning triggered in "rcu_note_context_switch" originated from
       SyS_timer_gettime(). The issue was always there, it is now
       visible. Reported by Grygorii Strashko and Daniel Wagner.

The delta patch against v4.16.18-rt8 is appended below and can be found here:

     https://cdn.kernel.org/pub/linux/kernel/projects/rt/4.16/incr/patch-4.16.18-rt8-rt9.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.16.18-rt9

The RT patch against v4.16.18 can be found here:

    https://cdn.kernel.org/pub/linux/kernel/projects/rt/4.16/older/patch-4.16.18-rt9.patch.xz

The split quilt queue is available at:

    https://cdn.kernel.org/pub/linux/kernel/projects/rt/4.16/older/patches-4.16.18-rt9.tar.xz

Sebastian

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
diff --git a/patches/Revert-timer-delay-waking-softirqs-from-the-jiffy-ti.patch b/patches/Revert-timer-delay-waking-softirqs-from-the-jiffy-ti.patch
new file mode 100644
index 0000000..5173035
--- /dev/null
+++ b/patches/Revert-timer-delay-waking-softirqs-from-the-jiffy-ti.patch
@@ -0,0 +1,34 @@
+From: Anna-Maria Gleixner <anna-maria@linutronix.de>
+Date: Thu, 5 Jul 2018 12:43:18 +0200
+Subject: [PATCH] Revert "timer: delay waking softirqs from the jiffy tick"
+
+This patch was required as long as RT tasks where accounted to CFS
+load but this was only a work around. Upstream Commit 17bdcf949d03
+("sched: Drop all load weight manipulation for RT tasks") fixed the
+accounting of RT tasks into CFS load.
+
+Remove the patch and fix dependencies.
+
+Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
+Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+---
+ kernel/time/timer.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/kernel/time/timer.c
++++ b/kernel/time/timer.c
+@@ -1666,13 +1666,13 @@ void update_process_times(int user_tick)
+ 
+ 	/* Note: this timer irq context must be accounted for as well. */
+ 	account_process_tick(p, user_tick);
+-	scheduler_tick();
+ 	run_local_timers();
+ 	rcu_check_callbacks(user_tick);
+ #ifdef CONFIG_IRQ_WORK
+ 	if (in_irq())
+ 		irq_work_tick();
+ #endif
++	scheduler_tick();
+ 	if (IS_ENABLED(CONFIG_POSIX_TIMERS))
+ 		run_posix_cpu_timers(p);
+ }
diff --git a/patches/cpu-hotplug--Implement-CPU-pinning.patch b/patches/cpu-hotplug--Implement-CPU-pinning.patch
index feebdad..8c6cf8d 100644
--- a/patches/cpu-hotplug--Implement-CPU-pinning.patch
+++ b/patches/cpu-hotplug--Implement-CPU-pinning.patch
@@ -10,8 +10,8 @@
 
 --- a/include/linux/sched.h
 +++ b/include/linux/sched.h
-@@ -602,6 +602,7 @@ struct task_struct {
- #if defined(CONFIG_PREEMPT_COUNT) && defined(CONFIG_SMP)
+@@ -649,6 +649,7 @@ struct task_struct {
+ #if defined(CONFIG_SMP) && defined(CONFIG_PREEMPT_RT_BASE)
  	int				migrate_disable;
  	int				migrate_disable_update;
 +	int				pinned_on_cpu;
diff --git a/patches/irqwork-Move-irq-safe-work-to-irq-context.patch b/patches/irqwork-Move-irq-safe-work-to-irq-context.patch
index 813d778..bf98fb7 100644
--- a/patches/irqwork-Move-irq-safe-work-to-irq-context.patch
+++ b/patches/irqwork-Move-irq-safe-work-to-irq-context.patch
@@ -55,8 +55,8 @@
   * Synchronize against the irq_work @entry, ensures the entry is not
 --- a/kernel/time/timer.c
 +++ b/kernel/time/timer.c
-@@ -1676,7 +1676,7 @@ void update_process_times(int user_tick)
- 	scheduler_tick();
+@@ -1675,7 +1675,7 @@ void update_process_times(int user_tick)
+ 	account_process_tick(p, user_tick);
  	run_local_timers();
  	rcu_check_callbacks(user_tick);
 -#if defined(CONFIG_IRQ_WORK) && !defined(CONFIG_PREEMPT_RT_FULL)
diff --git a/patches/irqwork-push_most_work_into_softirq_context.patch b/patches/irqwork-push_most_work_into_softirq_context.patch
index 5df75fe..27ae4a7 100644
--- a/patches/irqwork-push_most_work_into_softirq_context.patch
+++ b/patches/irqwork-push_most_work_into_softirq_context.patch
@@ -169,8 +169,8 @@
  /*
 --- a/kernel/time/timer.c
 +++ b/kernel/time/timer.c
-@@ -1676,7 +1676,7 @@ void update_process_times(int user_tick)
- 	scheduler_tick();
+@@ -1675,7 +1675,7 @@ void update_process_times(int user_tick)
+ 	account_process_tick(p, user_tick);
  	run_local_timers();
  	rcu_check_callbacks(user_tick);
 -#ifdef CONFIG_IRQ_WORK
diff --git a/patches/kthread-Allow-kthread_park-on-a-parked-kthread.patch b/patches/kthread-Allow-kthread_park-on-a-parked-kthread.patch
new file mode 100644
index 0000000..1b86c73
--- /dev/null
+++ b/patches/kthread-Allow-kthread_park-on-a-parked-kthread.patch
@@ -0,0 +1,70 @@
+From: Peter Zijlstra <peterz@infradead.org>
+Date: Fri, 4 May 2018 11:11:42 +0200
+Subject: [PATCH] kthread: Allow kthread_park() on a parked kthread
+
+[ Upstream commit b1f5b378e126133521df668379249fb8265121f1 ]
+
+The following commit:
+
+  85f1abe0019f ("kthread, sched/wait: Fix kthread_parkme() completion issue")
+
+added a WARN() in the case where we call kthread_park() on an already
+parked thread, because the old code wasn't doing the right thing there
+and it wasn't at all clear that would happen.
+
+It turns out, this does in fact happen, so we have to deal with it.
+
+Instead of potentially returning early, also wait for the completion.
+This does however mean we have to use complete_all() and re-initialize
+the completion on re-use.
+
+Reported-by: LKP <lkp@01.org>
+Tested-by: Meelis Roos <mroos@linux.ee>
+Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: kernel test robot <lkp@intel.com>
+Cc: wfg@linux.intel.com
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Fixes: 85f1abe0019f ("kthread, sched/wait: Fix kthread_parkme() completion issue")
+Link: http://lkml.kernel.org/r/20180504091142.GI12235@hirez.programming.kicks-ass.net
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+---
+ kernel/kthread.c | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/kernel/kthread.c b/kernel/kthread.c
+index 2017a39ab490..481951bf091d 100644
+--- a/kernel/kthread.c
++++ b/kernel/kthread.c
+@@ -193,7 +193,7 @@ EXPORT_SYMBOL_GPL(kthread_parkme);
+ 
+ void kthread_park_complete(struct task_struct *k)
+ {
+-	complete(&to_kthread(k)->parked);
++	complete_all(&to_kthread(k)->parked);
+ }
+ 
+ static int kthread(void *_create)
+@@ -459,6 +459,7 @@ void kthread_unpark(struct task_struct *k)
+ 	if (test_bit(KTHREAD_IS_PER_CPU, &kthread->flags))
+ 		__kthread_bind(k, kthread->cpu, TASK_PARKED);
+ 
++	reinit_completion(&kthread->parked);
+ 	clear_bit(KTHREAD_SHOULD_PARK, &kthread->flags);
+ 	wake_up_state(k, TASK_PARKED);
+ }
+@@ -483,9 +484,6 @@ int kthread_park(struct task_struct *k)
+ 	if (WARN_ON(k->flags & PF_EXITING))
+ 		return -ENOSYS;
+ 
+-	if (WARN_ON_ONCE(test_bit(KTHREAD_SHOULD_PARK, &kthread->flags)))
+-		return -EBUSY;
+-
+ 	set_bit(KTHREAD_SHOULD_PARK, &kthread->flags);
+ 	if (k != current) {
+ 		wake_up_process(k);
+-- 
+2.18.0
+
diff --git a/patches/localversion.patch b/patches/localversion.patch
index 68c7b97..02952cd 100644
--- a/patches/localversion.patch
+++ b/patches/localversion.patch
@@ -10,4 +10,4 @@
 --- /dev/null
 +++ b/localversion-rt
 @@ -0,0 +1 @@
-+-rt8
++-rt9
diff --git a/patches/series b/patches/series
index 81b81cf..2eccc15 100644
--- a/patches/series
+++ b/patches/series
@@ -5,6 +5,8 @@
 ############################################################
 # UPSTREAM merged
 ############################################################
+kthread-Allow-kthread_park-on-a-parked-kthread.patch
+
 #AMD-iommu
 0001-iommu-amd-Use-raw-locks-on-atomic-context-paths.patch
 0002-iommu-amd-Don-t-use-dev_data-in-irte_ga_set_affinity.patch
@@ -293,6 +295,7 @@
 # TIMERS
 timers-prepare-for-full-preemption.patch
 timer-delay-waking-softirqs-from-the-jiffy-tick.patch
+Revert-timer-delay-waking-softirqs-from-the-jiffy-ti.patch
 nohz-Prevent-erroneous-tick-stop-invocations.patch
 
 # KVM require constant freq TSC (smp function call -> cpufreq)