[ANNOUNCE] v4.19.25-rt16

Dear RT folks!

I'm pleased to announce the v4.19.25-rt16 patch set.

Changes since v4.19.25-rt15:

  - The "preserve task state" change in cpu_chill() in the previous
    release is responsible for missing a wake up. Reported by Mike
    Galbraith.

  - The x86-32 lazy preempt code was broken. Reported by Andri Yngvason.

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.19.25-rt15 is appended below and can be found here:

     https://cdn.kernel.org/pub/linux/kernel/projects/rt/4.19/incr/patch-4.19.25-rt15-rt16.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.19.25-rt16

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

    https://cdn.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patch-4.19.25-rt16.patch.xz

The split quilt queue is available at:

    https://cdn.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.25-rt16.tar.xz

Sebastian

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
diff --git a/patches/arm-preempt-lazy-support.patch b/patches/arm-preempt-lazy-support.patch
index 34e2b9d..99a7df7 100644
--- a/patches/arm-preempt-lazy-support.patch
+++ b/patches/arm-preempt-lazy-support.patch
@@ -139,7 +139,7 @@
  
 --- a/arch/arm/kernel/signal.c
 +++ b/arch/arm/kernel/signal.c
-@@ -644,7 +644,8 @@ do_work_pending(struct pt_regs *regs, un
+@@ -652,7 +652,8 @@ do_work_pending(struct pt_regs *regs, un
  	 */
  	trace_hardirqs_off();
  	do {
diff --git a/patches/hrtimer-by-timers-by-default-into-the-softirq-context.patch b/patches/hrtimer-by-timers-by-default-into-the-softirq-context.patch
index 671ce0d6..9316777 100644
--- a/patches/hrtimer-by-timers-by-default-into-the-softirq-context.patch
+++ b/patches/hrtimer-by-timers-by-default-into-the-softirq-context.patch
@@ -69,7 +69,7 @@
  	timer->function = perf_mux_hrtimer_handler;
  }
  
-@@ -9173,7 +9173,7 @@ static void perf_swevent_init_hrtimer(st
+@@ -9181,7 +9181,7 @@ static void perf_swevent_init_hrtimer(st
  	if (!is_sampling_event(event))
  		return;
  
diff --git a/patches/hrtimer-cpu_chill-save-task-state-in-saved_state.patch b/patches/hrtimer-cpu_chill-save-task-state-in-saved_state.patch
new file mode 100644
index 0000000..350e776
--- /dev/null
+++ b/patches/hrtimer-cpu_chill-save-task-state-in-saved_state.patch
@@ -0,0 +1,55 @@
+From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+Date: Tue, 26 Feb 2019 12:31:10 +0100
+Subject: [PATCH] hrtimer: cpu_chill(): save task state in ->saved_state()
+
+In the previous change I saved the current task state on stack. This was
+bad because while the task is scheduled-out it might receive a wake-up.
+The wake up changes the task state and we must not destroy it.
+
+Save the task-state in ->saved_state under a PI-lock to unsure that
+state changes during are not missed while the task temporary scheduled
+out.
+
+Reported-by: Mike Galbraith <efault@gmx.de>
+Tested-by: Mike Galbraith <efault@gmx.de>
+Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+---
+ kernel/time/hrtimer.c |   18 +++++++++++++-----
+ 1 file changed, 13 insertions(+), 5 deletions(-)
+
+--- a/kernel/time/hrtimer.c
++++ b/kernel/time/hrtimer.c
+@@ -1900,20 +1900,28 @@ COMPAT_SYSCALL_DEFINE2(nanosleep, struct
+  */
+ void cpu_chill(void)
+ {
+-	ktime_t chill_time;
+ 	unsigned int freeze_flag = current->flags & PF_NOFREEZE;
+-	long saved_state;
++	struct task_struct *self = current;
++	ktime_t chill_time;
+ 
+-	saved_state = current->state;
+-	chill_time = ktime_set(0, NSEC_PER_MSEC);
++	raw_spin_lock_irq(&self->pi_lock);
++	self->saved_state = self->state;
+ 	__set_current_state_no_track(TASK_UNINTERRUPTIBLE);
++	raw_spin_unlock_irq(&self->pi_lock);
++
++	chill_time = ktime_set(0, NSEC_PER_MSEC);
++
+ 	current->flags |= PF_NOFREEZE;
+ 	sleeping_lock_inc();
+ 	schedule_hrtimeout(&chill_time, HRTIMER_MODE_REL_HARD);
+ 	sleeping_lock_dec();
+ 	if (!freeze_flag)
+ 		current->flags &= ~PF_NOFREEZE;
+-	__set_current_state_no_track(saved_state);
++
++	raw_spin_lock_irq(&self->pi_lock);
++	__set_current_state_no_track(self->saved_state);
++	self->saved_state = TASK_RUNNING;
++	raw_spin_unlock_irq(&self->pi_lock);
+ }
+ EXPORT_SYMBOL(cpu_chill);
+ #endif
diff --git a/patches/localversion.patch b/patches/localversion.patch
index 340816c..0cccc77 100644
--- a/patches/localversion.patch
+++ b/patches/localversion.patch
@@ -10,4 +10,4 @@
 --- /dev/null
 +++ b/localversion-rt
 @@ -0,0 +1 @@
-+-rt15
++-rt16
diff --git a/patches/net-add-back-the-missing-serialization-in-ip_send_un.patch b/patches/net-add-back-the-missing-serialization-in-ip_send_un.patch
index 77c40ed..1946d6d 100644
--- a/patches/net-add-back-the-missing-serialization-in-ip_send_un.patch
+++ b/patches/net-add-back-the-missing-serialization-in-ip_send_un.patch
@@ -50,7 +50,7 @@
  
  #include <net/net_namespace.h>
  #include <net/icmp.h>
-@@ -633,6 +634,7 @@ void tcp_v4_send_check(struct sock *sk,
+@@ -634,6 +635,7 @@ void tcp_v4_send_check(struct sock *sk,
  }
  EXPORT_SYMBOL(tcp_v4_send_check);
  
@@ -58,7 +58,7 @@
  /*
   *	This routine will send an RST to the other tcp.
   *
-@@ -767,6 +769,7 @@ static void tcp_v4_send_reset(const stru
+@@ -768,6 +770,7 @@ static void tcp_v4_send_reset(const stru
  	arg.tos = ip_hdr(skb)->tos;
  	arg.uid = sock_net_uid(net, sk && sk_fullsock(sk) ? sk : NULL);
  	local_bh_disable();
@@ -66,7 +66,7 @@
  	ctl_sk = *this_cpu_ptr(net->ipv4.tcp_sk);
  	if (sk)
  		ctl_sk->sk_mark = (sk->sk_state == TCP_TIME_WAIT) ?
-@@ -779,6 +782,7 @@ static void tcp_v4_send_reset(const stru
+@@ -780,6 +783,7 @@ static void tcp_v4_send_reset(const stru
  	ctl_sk->sk_mark = 0;
  	__TCP_INC_STATS(net, TCP_MIB_OUTSEGS);
  	__TCP_INC_STATS(net, TCP_MIB_OUTRSTS);
@@ -74,7 +74,7 @@
  	local_bh_enable();
  
  #ifdef CONFIG_TCP_MD5SIG
-@@ -859,6 +863,7 @@ static void tcp_v4_send_ack(const struct
+@@ -860,6 +864,7 @@ static void tcp_v4_send_ack(const struct
  	arg.tos = tos;
  	arg.uid = sock_net_uid(net, sk_fullsock(sk) ? sk : NULL);
  	local_bh_disable();
@@ -82,7 +82,7 @@
  	ctl_sk = *this_cpu_ptr(net->ipv4.tcp_sk);
  	if (sk)
  		ctl_sk->sk_mark = (sk->sk_state == TCP_TIME_WAIT) ?
-@@ -870,6 +875,7 @@ static void tcp_v4_send_ack(const struct
+@@ -871,6 +876,7 @@ static void tcp_v4_send_ack(const struct
  
  	ctl_sk->sk_mark = 0;
  	__TCP_INC_STATS(net, TCP_MIB_OUTSEGS);
diff --git a/patches/net-another-local-irq-disable-alloc-atomic-headache.patch b/patches/net-another-local-irq-disable-alloc-atomic-headache.patch
index 0e4e345..6bb46fc 100644
--- a/patches/net-another-local-irq-disable-alloc-atomic-headache.patch
+++ b/patches/net-another-local-irq-disable-alloc-atomic-headache.patch
@@ -40,7 +40,7 @@
  	return data;
  }
  
-@@ -408,13 +410,13 @@ struct sk_buff *__netdev_alloc_skb(struc
+@@ -412,13 +414,13 @@ struct sk_buff *__netdev_alloc_skb(struc
  	if (sk_memalloc_socks())
  		gfp_mask |= __GFP_MEMALLOC;
  
diff --git a/patches/net-core-protect-users-of-napi_alloc_cache-against-r.patch b/patches/net-core-protect-users-of-napi_alloc_cache-against-r.patch
index 9bb65bd..64cbb85 100644
--- a/patches/net-core-protect-users-of-napi_alloc_cache-against-r.patch
+++ b/patches/net-core-protect-users-of-napi_alloc_cache-against-r.patch
@@ -25,7 +25,7 @@
  
  static void *__netdev_alloc_frag(unsigned int fragsz, gfp_t gfp_mask)
  {
-@@ -361,9 +362,13 @@ EXPORT_SYMBOL(netdev_alloc_frag);
+@@ -363,9 +364,13 @@ EXPORT_SYMBOL(netdev_alloc_frag);
  
  static void *__napi_alloc_frag(unsigned int fragsz, gfp_t gfp_mask)
  {
@@ -41,7 +41,7 @@
  }
  
  void *napi_alloc_frag(unsigned int fragsz)
-@@ -457,9 +462,10 @@ EXPORT_SYMBOL(__netdev_alloc_skb);
+@@ -461,9 +466,10 @@ EXPORT_SYMBOL(__netdev_alloc_skb);
  struct sk_buff *__napi_alloc_skb(struct napi_struct *napi, unsigned int len,
  				 gfp_t gfp_mask)
  {
@@ -53,7 +53,7 @@
  
  	len += NET_SKB_PAD + NET_IP_ALIGN;
  
-@@ -477,7 +483,10 @@ struct sk_buff *__napi_alloc_skb(struct
+@@ -481,7 +487,10 @@ struct sk_buff *__napi_alloc_skb(struct
  	if (sk_memalloc_socks())
  		gfp_mask |= __GFP_MEMALLOC;
  
@@ -64,7 +64,7 @@
  	if (unlikely(!data))
  		return NULL;
  
-@@ -488,7 +497,7 @@ struct sk_buff *__napi_alloc_skb(struct
+@@ -492,7 +501,7 @@ struct sk_buff *__napi_alloc_skb(struct
  	}
  
  	/* use OR instead of assignment to avoid clearing of bits in mask */
@@ -73,7 +73,7 @@
  		skb->pfmemalloc = 1;
  	skb->head_frag = 1;
  
-@@ -720,23 +729,26 @@ void __consume_stateless_skb(struct sk_b
+@@ -724,23 +733,26 @@ void __consume_stateless_skb(struct sk_b
  
  void __kfree_skb_flush(void)
  {
@@ -102,7 +102,7 @@
  	/* record skb to CPU local list */
  	nc->skb_cache[nc->skb_count++] = skb;
  
-@@ -751,6 +763,7 @@ static inline void _kfree_skb_defer(stru
+@@ -755,6 +767,7 @@ static inline void _kfree_skb_defer(stru
  				     nc->skb_cache);
  		nc->skb_count = 0;
  	}
diff --git a/patches/series b/patches/series
index 38e3fc2..4016603 100644
--- a/patches/series
+++ b/patches/series
@@ -301,6 +301,7 @@
 # CPU CHILL
 rt-introduce-cpu-chill.patch
 hrtimer-Don-t-lose-state-in-cpu_chill.patch
+hrtimer-cpu_chill-save-task-state-in-saved_state.patch
 
 # block
 block-blk-mq-move-blk_queue_usage_counter_release-in.patch
@@ -399,6 +400,7 @@
 ftrace-Fix-trace-header-alignment.patch
 x86-preempt-lazy.patch
 x86-lazy-preempt-properly-check-against-preempt-mask.patch
+x86-lazy-preempt-use-proper-return-label-on-32bit-x8.patch
 arm-preempt-lazy-support.patch
 powerpc-preempt-lazy-support.patch
 arch-arm64-Add-lazy-preempt-support.patch
diff --git a/patches/x86-lazy-preempt-use-proper-return-label-on-32bit-x8.patch b/patches/x86-lazy-preempt-use-proper-return-label-on-32bit-x8.patch
new file mode 100644
index 0000000..98b1ce3
--- /dev/null
+++ b/patches/x86-lazy-preempt-use-proper-return-label-on-32bit-x8.patch
@@ -0,0 +1,37 @@
+From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+Date: Tue, 26 Feb 2019 14:53:49 +0100
+Subject: [PATCH] x86: lazy-preempt: use proper return label on 32bit-x86
+
+The lazy-preempt uses the wrong return label in case preemption isn't
+possible. This results crash while returning to the kernel.
+
+Use the correct return label if preemption isn' possible.
+
+Reported-by: Andri Yngvason <andri@yngvason.is>
+Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+---
+ arch/x86/entry/entry_32.S |    8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+--- a/arch/x86/entry/entry_32.S
++++ b/arch/x86/entry/entry_32.S
+@@ -773,15 +773,15 @@ ENTRY(resume_kernel)
+ 
+ 	# atleast preempt count == 0 ?
+ 	cmpl $_PREEMPT_ENABLED,PER_CPU_VAR(__preempt_count)
+-	jne restore_all
++	jne	restore_all_kernel
+ 
+ 	movl	PER_CPU_VAR(current_task), %ebp
+ 	cmpl	$0,TASK_TI_preempt_lazy_count(%ebp)	# non-zero preempt_lazy_count ?
+-	jnz	restore_all
++	jnz	restore_all_kernel
+ 
+ 	testl	$_TIF_NEED_RESCHED_LAZY, TASK_TI_flags(%ebp)
+-	jz	restore_all
+-	test_int_off:
++	jz	restore_all_kernel
++test_int_off:
+ #endif
+ 	testl	$X86_EFLAGS_IF, PT_EFLAGS(%esp)	# interrupts off (exception path) ?
+ 	jz	restore_all_kernel