4.4.7-rt16
Subsystems (5)
Dear RT folks!
I'm pleased to announce the v4.4.7-rt16 patch set. Changes since v4.4.7-rt15:
- picked a few panic() re-entrance from NMI fixes from upstream. On -RT we have the same problem without NMI but with the soft/hard watchdog triggering panic().
- Don't take the port->lock on oops_in_progress. We had a trylock but that trylock does not work if invoked with IRQs off (like from the panic() caller). I am not very happy about this but if we keep it that way it would make sense to make a similar change for the other UART drivers…
- Rik van Riel and Clark Williams pointed out that a change made by Frederic Weisbecker in v4.5 could be backported and then we could remove some locking around vtime handling.
Known issues:
- CPU hotplug got a little better but can deadlock.
The delta patch against 4.4.7-rt15 is appended below and can be found here:
https://cdn.kernel.org/pub/linux/kernel/projects/rt/4.4/incr/patch-4.4.7-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.4.7-rt16
The RT patch against 4.4.7 can be found here:
https://cdn.kernel.org/pub/linux/kernel/projects/rt/4.4/patch-4.4.7-rt16.patch.xz
The split quilt queue is available at:
https://cdn.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4.7-rt16.tar.xz
Sebastian
arch/x86/kernel/nmi.c +12 -4
@@ -231,7 +231,7 @@ pci_serr_error(unsigned char reason, struct pt_regs *regs)#endif if (panic_on_unrecovered_nmi) -panic ("NMI: Not continuing" ); +nmi_panic (regs,"NMI: Not continuing" );pr_emerg ("Dazed and confused, but trying to continue\n" );
@@ -255,8 +255,16 @@ io_check_error(unsigned char reason, struct pt_regs *regs) reason, smp_processor_id());show_regs (regs); -if (panic_on_io_nmi) -panic ("NMI IOCK error: Not continuing" ); +if (panic_on_io_nmi) { +nmi_panic (regs,"NMI IOCK error: Not continuing" ); + +/* +* If we end up here, it means we have received an NMI while +* processing panic(). Simply return without delaying and +* re-enabling NMIs. +*/ +return ; + }/* Re-enable the IOCK line, wait for a few seconds */ reason = (reason &NMI_REASON_CLEAR_MASK ) |NMI_REASON_CLEAR_IOCHK ;
@@ -297,7 +305,7 @@ unknown_nmi_error(unsigned char reason, struct pt_regs *regs)pr_emerg ("Do you have a strange power saving mode enabled?\n" );if (unknown_nmi_panic || panic_on_unrecovered_nmi) -panic ("NMI: Not continuing" ); +nmi_panic (regs,"NMI: Not continuing" );pr_emerg ("Dazed and confused, but trying to continue\n" ); }
arch/x86/kernel/reboot.c +20 -0
@@ -726,6 +726,7 @@ static int crashing_cpu;static nmi_shootdown_cb shootdown_callback;static atomic_t waiting_for_crash_ipi; +static int crash_ipi_issued;static int crash_nmi_callback (unsigned int val,struct pt_regs *regs) {
@@ -788,6 +789,9 @@ void nmi_shootdown_cpus(nmi_shootdown_cb callback)smp_send_nmi_allbutself (); +/* Kick CPUs looping in NMI context. */ +WRITE_ONCE (crash_ipi_issued,1 ); + msecs =1000 ;/* Wait at most a second for the other cpus to stop */ while ((atomic_read (&waiting_for_crash_ipi) >0 ) && msecs) {mdelay (1 );
@@ -796,6 +800,22 @@ void nmi_shootdown_cpus(nmi_shootdown_cb callback) /* Leave the nmi callback set */ } + +/* Override the weak function in kernel/panic.c */ +void nmi_panic_self_stop (struct pt_regs *regs) +{ +while (1 ) { +/* +* Wait for the crash dumping IPI to be issued, and then +* call its callback directly. +*/ +if (READ_ONCE (crash_ipi_issued)) +crash_nmi_callback (0 , regs);/* Don't return */ + +cpu_relax (); + } +} +#else /* !CONFIG_SMP */ void nmi_shootdown_cpus (nmi_shootdown_cb callback) {
drivers/tty/serial/8250/8250_port.c +2 -2
@@ -2844,9 +2844,9 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s,serial8250_rpm_get (up); -if (port->sysrq) +if (port->sysrq || oops_in_progress) locked =0 ; -else if (oops_in_progress ||in_kdb_printk ()) +else if (in_kdb_printk ()) locked =spin_trylock_irqsave (&port->lock, flags);else spin_lock_irqsave (&port->lock, flags);
include/linux/init_task.h +1 -2
@@ -156,8 +156,7 @@ extern struct task_group root_task_group;#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN # define INIT_VTIME (tsk) \ - .vtime_lock = __RAW_SPIN_LOCK_UNLOCKED(tsk.vtime_lock), \ - .vtime_seq = SEQCNT_ZERO(tsk.vtime_seq), \ + .vtime_seqcount = SEQCNT_ZERO(tsk.vtime_seqcount), \ .vtime_snap = 0, \ .vtime_snap_whence = VTIME_SYS,#else
include/linux/kernel.h +9 -0
@@ -259,6 +259,7 @@ extern long (*panic_blink)(int state); __printf(1, 2)void panic (const char *fmt, ...)__noreturn __cold ; +void nmi_panic (struct pt_regs *regs,const char *msg);extern void oops_enter (void );extern void oops_exit (void );void print_oops_end_marker (void );
@@ -450,6 +451,14 @@ extern int sysctl_panic_on_stackoverflow;extern bool crash_kexec_post_notifiers;/* +* panic_cpu is used for synchronizing panic() and crash_kexec() execution. It +* holds a CPU number which is executing panic() currently. A value of +* PANIC_CPU_INVALID means no CPU has entered panic() or crash_kexec(). +*/ +extern atomic_t panic_cpu; +#define PANIC_CPU_INVALID -1 + +/* * Only to be used by arch init code. If the user over-wrote the default * CONFIG_PANIC_TIMEOUT, honor it. */
include/linux/sched.h +5 -3
@@ -1539,12 +1539,14 @@ struct task_struct {cputime_t gtime;struct prev_cputime prev_cputime;#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN -raw_spinlock_t vtime_lock; -seqcount_t vtime_seq; +seqcount_t vtime_seqcount;unsigned long long vtime_snap;enum { -VTIME_SLEEPING =0 , +/* Task is sleeping or running in a CPU with VTIME inactive */ +VTIME_INACTIVE =0 , +/* Task runs in userspace in a CPU with VTIME active */ VTIME_USER , +/* Task runs in kernelspace in a CPU with VTIME active */ VTIME_SYS , } vtime_snap_whence;#endif
kernel/fork.c +2 -3
@@ -1379,10 +1379,9 @@ static struct task_struct *copy_process(unsigned long clone_flags,prev_cputime_init (&p->prev_cputime);#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN -raw_spin_lock_init (&p->vtime_lock); -seqcount_init (&p->vtime_seq); +seqcount_init (&p->vtime_seqcount); p->vtime_snap =0 ; - p->vtime_snap_whence =VTIME_SLEEPING ; + p->vtime_snap_whence =VTIME_INACTIVE ;#endif #if defined(SPLIT_RSS_COUNTING )
kernel/panic.c +42 -3
73 lines not on this page · raw message
kernel/sched/cputime.c +27 -43
166 lines not on this page · raw message
kernel/watchdog.c +1 -1
@@ -361,7 +361,7 @@ static void watchdog_overflow_callback(struct perf_event *event,raw_spin_unlock (&watchdog_output_lock);if (hardlockup_panic) -panic ("Hard LOCKUP" ); +nmi_panic (regs,"Hard LOCKUP" );__this_cpu_write (hard_watchdog_warn, true);return ;
localversion-rt +1 -1
@@ -1 +1 @@ --rt15 +-rt16