diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2019-03-28 21:31:39 +0100 |
---|---|---|
committer | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2019-03-28 21:31:39 +0100 |
commit | f4c6069b6e6df1b35f94d48e1005d95bdffa9a38 (patch) | |
tree | 8cd63930a660aa0bb773bbd9d8d078aee4a02533 | |
parent | 845027a64065fc753f40ef1d3980ead51f011b53 (diff) | |
download | linux-rt-5.0.5-rt3-patches.tar.gz |
[ANNOUNCE] v5.0.5-rt3v5.0.5-rt3-patches
Dear RT folks!
I'm pleased to announce the v5.0.5-rt3 patch set.
Changes since v5.0.5-rt2:
- Multiple fixes for build failures introduced by the printk series.
Reported by the kbuild test robot, patched by John Ogness.
- Various powerpc fixes:
- Reorder TIF bits so the assembly code compiles. Reported by kbuild
test robot.
- Avoid acquiring a sleeping lock during the bring of the secondary
CPU.
- Use a local_lock instead of disabling interrupts as protection in
pseries' iommu code.
- Turn show_lock into raw_lock which is used during a sysrq request in
ARM64. Patch by Julien Grall.
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.
- rcutorture is currently broken on -RT. Reported by Juri Lelli.
The delta patch against v5.0.5-rt2 is appended below and can be found here:
https://cdn.kernel.org/pub/linux/kernel/projects/rt/5.0/incr/patch-5.0.5-rt2-rt3.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 v5.0.5-rt3
The RT patch against v5.0.5 can be found here:
https://cdn.kernel.org/pub/linux/kernel/projects/rt/5.0/older/patch-5.0.5-rt3.patch.xz
The split quilt queue is available at:
https://cdn.kernel.org/pub/linux/kernel/projects/rt/5.0/older/patches-5.0.5-rt3.tar.xz
Sebastian
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
11 files changed, 398 insertions, 70 deletions
diff --git a/patches/0006-printk-rb-add-blocking-reader-support.patch b/patches/0006-printk-rb-add-blocking-reader-support.patch index 6200f780f57e..5988d20f4e86 100644 --- a/patches/0006-printk-rb-add-blocking-reader-support.patch +++ b/patches/0006-printk-rb-add-blocking-reader-support.patch @@ -9,9 +9,9 @@ be triggered from any context. Signed-off-by: John Ogness <john.ogness@linutronix.de> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> --- - include/linux/printk_ringbuffer.h | 20 +++++++++++++++ - lib/printk_ringbuffer.c | 49 ++++++++++++++++++++++++++++++++++++++ - 2 files changed, 69 insertions(+) + include/linux/printk_ringbuffer.h | 20 +++++++++++++ + lib/printk_ringbuffer.c | 55 ++++++++++++++++++++++++++++++++++++++ + 2 files changed, 75 insertions(+) --- a/include/linux/printk_ringbuffer.h +++ b/include/linux/printk_ringbuffer.h @@ -96,20 +96,26 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> } atomic_long_set_release(&rb->head, res); atomic_dec(&rb->ctx); -@@ -185,6 +188,12 @@ void prb_commit(struct prb_handle *h) +@@ -185,6 +188,18 @@ void prb_commit(struct prb_handle *h) } prb_unlock(rb->cpulock, h->cpu); + + if (changed) { + atomic_long_inc(&rb->wq_counter); -+ if (wq_has_sleeper(rb->wq)) ++ if (wq_has_sleeper(rb->wq)) { ++#ifdef CONFIG_IRQ_WORK + irq_work_queue(rb->wq_work); ++#else ++ if (!in_nmi()) ++ wake_up_interruptible_all(rb->wq); ++#endif ++ } + } } /* -@@ -437,3 +446,43 @@ int prb_iter_next(struct prb_iterator *i +@@ -437,3 +452,43 @@ int prb_iter_next(struct prb_iterator *i return 1; } diff --git a/patches/0007-printk-rb-add-functionality-required-by-printk.patch b/patches/0007-printk-rb-add-functionality-required-by-printk.patch index 1be033acc472..5d5365b87f34 100644 --- a/patches/0007-printk-rb-add-functionality-required-by-printk.patch +++ b/patches/0007-printk-rb-add-functionality-required-by-printk.patch @@ -63,7 +63,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> atomic_dec(&rb->ctx); if (atomic_long_read(&rb->reserve) == res) -@@ -486,3 +491,93 @@ int prb_iter_wait_next(struct prb_iterat +@@ -492,3 +497,93 @@ int prb_iter_wait_next(struct prb_iterat return ret; } diff --git a/patches/0011-printk_safe-remove-printk-safe-code.patch b/patches/0011-printk_safe-remove-printk-safe-code.patch index 7523bd7af7f8..cfc39420685f 100644 --- a/patches/0011-printk_safe-remove-printk-safe-code.patch +++ b/patches/0011-printk_safe-remove-printk-safe-code.patch @@ -10,20 +10,46 @@ NOTE: This also removes printk flushing functionality. Signed-off-by: John Ogness <john.ogness@linutronix.de> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> --- - include/linux/hardirq.h | 2 - include/linux/printk.h | 27 -- - init/main.c | 1 - kernel/kexec_core.c | 1 - kernel/panic.c | 3 - kernel/printk/Makefile | 1 - kernel/printk/internal.h | 30 --- - kernel/printk/printk.c | 13 - - kernel/printk/printk_safe.c | 427 -------------------------------------------- - kernel/trace/trace.c | 2 - lib/nmi_backtrace.c | 6 - 11 files changed, 7 insertions(+), 506 deletions(-) + arch/powerpc/kernel/traps.c | 1 + arch/powerpc/kernel/watchdog.c | 5 + include/linux/hardirq.h | 2 + include/linux/printk.h | 27 -- + init/main.c | 1 + kernel/kexec_core.c | 1 + kernel/panic.c | 3 + kernel/printk/Makefile | 1 + kernel/printk/internal.h | 30 -- + kernel/printk/printk.c | 13 - + kernel/printk/printk_safe.c | 427 ----------------------------------------- + kernel/trace/trace.c | 2 + lib/nmi_backtrace.c | 6 + 13 files changed, 7 insertions(+), 512 deletions(-) delete mode 100644 kernel/printk/printk_safe.c +--- a/arch/powerpc/kernel/traps.c ++++ b/arch/powerpc/kernel/traps.c +@@ -174,7 +174,6 @@ extern void panic_flush_kmsg_start(void) + + extern void panic_flush_kmsg_end(void) + { +- printk_safe_flush_on_panic(); + kmsg_dump(KMSG_DUMP_PANIC); + bust_spinlocks(0); + debug_locks_off(); +--- a/arch/powerpc/kernel/watchdog.c ++++ b/arch/powerpc/kernel/watchdog.c +@@ -181,11 +181,6 @@ static void watchdog_smp_panic(int cpu, + + wd_smp_unlock(&flags); + +- printk_safe_flush(); +- /* +- * printk_safe_flush() seems to require another print +- * before anything actually goes out to console. +- */ + if (sysctl_hardlockup_all_cpu_backtrace) + trigger_allbutself_cpu_backtrace(); + --- a/include/linux/hardirq.h +++ b/include/linux/hardirq.h @@ -68,7 +68,6 @@ extern void irq_exit(void); diff --git a/patches/0025-printk-remove-unused-code.patch b/patches/0025-printk-remove-unused-code.patch index 7038b6737a0d..1160c2fa2014 100644 --- a/patches/0025-printk-remove-unused-code.patch +++ b/patches/0025-printk-remove-unused-code.patch @@ -8,10 +8,10 @@ previous log buffer implementation is no longer in use. Remove it. Signed-off-by: John Ogness <john.ogness@linutronix.de> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> --- - kernel/printk/internal.h | 53 -------------- - kernel/printk/printk.c | 167 +++-------------------------------------------- + kernel/printk/internal.h | 53 --------------- + kernel/printk/printk.c | 163 ++++------------------------------------------- lib/bust_spinlocks.c | 3 - 3 files changed, 13 insertions(+), 210 deletions(-) + 3 files changed, 17 insertions(+), 202 deletions(-) delete mode 100644 kernel/printk/internal.h --- a/kernel/printk/internal.h @@ -148,7 +148,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> #define PREFIX_MAX 32 #define LOG_LINE_MAX (1024 - PREFIX_MAX) -@@ -414,26 +370,6 @@ static u32 clear_idx; +@@ -414,24 +370,16 @@ static u32 clear_idx; #define LOG_LEVEL(v) ((v) & 0x07) #define LOG_FACILITY(v) ((v) >> 3 & 0xff) @@ -160,22 +160,22 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> -static char *log_buf = __log_buf; -static u32 log_buf_len = __LOG_BUF_LEN; - --/* Return log buffer address */ --char *log_buf_addr_get(void) --{ + /* Return log buffer address */ + char *log_buf_addr_get(void) + { - return log_buf; --} -- --/* Return log buffer size */ --u32 log_buf_len_get(void) --{ ++ return printk_rb.buffer; + } + + /* Return log buffer size */ + u32 log_buf_len_get(void) + { - return log_buf_len; --} -- ++ return (1 << printk_rb.size_bits); + } + /* human readable text of the record */ - static char *log_text(const struct printk_log *msg) - { -@@ -944,11 +880,6 @@ const struct file_operations kmsg_fops = +@@ -944,11 +892,6 @@ const struct file_operations kmsg_fops = */ void log_buf_vmcoreinfo_setup(void) { @@ -187,7 +187,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> /* * Export struct printk_log size and field offsets. User space tools can * parse it and detect any changes to structure down the line. -@@ -961,6 +892,8 @@ void log_buf_vmcoreinfo_setup(void) +@@ -961,6 +904,8 @@ void log_buf_vmcoreinfo_setup(void) } #endif @@ -196,7 +196,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> /* requested log_buf_len from kernel cmdline */ static unsigned long __initdata new_log_buf_len; -@@ -1026,9 +959,12 @@ static void __init log_buf_add_cpu(void) +@@ -1026,9 +971,12 @@ static void __init log_buf_add_cpu(void) #else /* !CONFIG_SMP */ static inline void log_buf_add_cpu(void) {} #endif /* CONFIG_SMP */ @@ -209,7 +209,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> unsigned long flags; char *new_log_buf; unsigned int free; -@@ -1067,6 +1003,7 @@ void __init setup_log_buf(int early) +@@ -1067,6 +1015,7 @@ void __init setup_log_buf(int early) pr_info("log_buf_len: %u bytes\n", log_buf_len); pr_info("early log buf free: %u(%u%%)\n", free, (free * 100) / __LOG_BUF_LEN); @@ -217,7 +217,16 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> } static bool __read_mostly ignore_loglevel; -@@ -2023,31 +1960,6 @@ asmlinkage __visible int printk(const ch +@@ -1962,7 +1911,7 @@ asmlinkage int vprintk_emit(int facility + } + EXPORT_SYMBOL(vprintk_emit); + +-__printf(1, 0) int vprintk_func(const char *fmt, va_list args) ++static __printf(1, 0) int vprintk_func(const char *fmt, va_list args) + { + return vprintk_emit(0, LOGLEVEL_DEFAULT, NULL, 0, fmt, args); + } +@@ -2023,31 +1972,6 @@ asmlinkage __visible int printk(const ch return r; } EXPORT_SYMBOL(printk); @@ -249,7 +258,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> #endif /* CONFIG_PRINTK */ #ifdef CONFIG_EARLY_PRINTK -@@ -2343,15 +2255,10 @@ void console_unblank(void) +@@ -2343,15 +2267,10 @@ void console_unblank(void) void console_flush_on_panic(void) { /* @@ -268,7 +277,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> } /* -@@ -2700,43 +2607,6 @@ static int __init printk_late_init(void) +@@ -2700,43 +2619,6 @@ static int __init printk_late_init(void) late_initcall(printk_late_init); #if defined CONFIG_PRINTK @@ -312,7 +321,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> static int printk_kthread_func(void *data) { struct prb_iterator iter; -@@ -2802,22 +2672,9 @@ static int __init init_printk_kthread(vo +@@ -2802,22 +2684,9 @@ static int __init init_printk_kthread(vo } late_initcall(init_printk_kthread); @@ -324,7 +333,8 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> - preempt_enable(); -} - - int vprintk_deferred(const char *fmt, va_list args) +-int vprintk_deferred(const char *fmt, va_list args) ++static int vprintk_deferred(const char *fmt, va_list args) { - int r; - diff --git a/patches/localversion.patch b/patches/localversion.patch index 279489a1d145..e36eb4b6666a 100644 --- a/patches/localversion.patch +++ b/patches/localversion.patch @@ -10,4 +10,4 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> --- /dev/null +++ b/localversion-rt @@ -0,0 +1 @@ -+-rt2 ++-rt3 diff --git a/patches/powerpc-preempt-lazy-support.patch b/patches/powerpc-preempt-lazy-support.patch index a749a9665319..07398b7fed4d 100644 --- a/patches/powerpc-preempt-lazy-support.patch +++ b/patches/powerpc-preempt-lazy-support.patch @@ -7,11 +7,11 @@ Implement the powerpc pieces for lazy preempt. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> --- arch/powerpc/Kconfig | 1 + - arch/powerpc/include/asm/thread_info.h | 9 +++++++-- + arch/powerpc/include/asm/thread_info.h | 16 ++++++++++++---- arch/powerpc/kernel/asm-offsets.c | 1 + - arch/powerpc/kernel/entry_32.S | 17 ++++++++++++----- - arch/powerpc/kernel/entry_64.S | 14 +++++++++++--- - 5 files changed, 32 insertions(+), 10 deletions(-) + arch/powerpc/kernel/entry_32.S | 29 +++++++++++++++++++---------- + arch/powerpc/kernel/entry_64.S | 26 ++++++++++++++++++-------- + 5 files changed, 51 insertions(+), 22 deletions(-) --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -34,24 +34,33 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> unsigned long local_flags; /* private flags for thread */ #ifdef CONFIG_LIVEPATCH unsigned long *livepatch_sp; -@@ -88,7 +90,7 @@ void arch_setup_new_exec(void); - /* - * thread information flag bit numbers - */ --#define TIF_SYSCALL_TRACE 0 /* syscall trace active */ -+#define TIF_NEED_RESCHED_LAZY 0 /* lazy rescheduling necessary */ - #define TIF_SIGPENDING 1 /* signal pending */ - #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ - #define TIF_FSCHECK 3 /* Check FS is USER_DS on return */ -@@ -112,6 +114,7 @@ void arch_setup_new_exec(void); +@@ -99,11 +101,12 @@ void arch_setup_new_exec(void); + #define TIF_SINGLESTEP 8 /* singlestepping active */ + #define TIF_NOHZ 9 /* in adaptive nohz mode */ + #define TIF_SECCOMP 10 /* secure computing */ +-#define TIF_RESTOREALL 11 /* Restore all regs (implies NOERROR) */ +-#define TIF_NOERROR 12 /* Force successful syscall return */ ++ ++#define TIF_NEED_RESCHED_LAZY 11 /* lazy rescheduling necessary */ ++#define TIF_SYSCALL_TRACEPOINT 12 /* syscall tracepoint instrumentation */ ++ + #define TIF_NOTIFY_RESUME 13 /* callback before returning to user */ + #define TIF_UPROBE 14 /* breakpointed or single-stepping */ +-#define TIF_SYSCALL_TRACEPOINT 15 /* syscall tracepoint instrumentation */ + #define TIF_EMULATE_STACK_STORE 16 /* Is an instruction emulation + for stack store? */ + #define TIF_MEMDIE 17 /* is terminating due to OOM killer */ +@@ -112,6 +115,9 @@ void arch_setup_new_exec(void); #endif #define TIF_POLLING_NRFLAG 19 /* true if poll_idle() is polling TIF_NEED_RESCHED */ #define TIF_32BIT 20 /* 32 bit binary */ -+#define TIF_SYSCALL_TRACE 21 /* syscall trace active */ ++#define TIF_RESTOREALL 21 /* Restore all regs (implies NOERROR) */ ++#define TIF_NOERROR 22 /* Force successful syscall return */ ++ /* as above, but as bit values */ #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) -@@ -131,6 +134,7 @@ void arch_setup_new_exec(void); +@@ -131,6 +137,7 @@ void arch_setup_new_exec(void); #define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT) #define _TIF_EMULATE_STACK_STORE (1<<TIF_EMULATE_STACK_STORE) #define _TIF_NOHZ (1<<TIF_NOHZ) @@ -59,7 +68,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> #define _TIF_FSCHECK (1<<TIF_FSCHECK) #define _TIF_SYSCALL_EMU (1<<TIF_SYSCALL_EMU) #define _TIF_SYSCALL_DOTRACE (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \ -@@ -140,8 +144,9 @@ void arch_setup_new_exec(void); +@@ -140,8 +147,9 @@ void arch_setup_new_exec(void); #define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \ _TIF_NOTIFY_RESUME | _TIF_UPROBE | \ _TIF_RESTORE_TM | _TIF_PATCH_PENDING | \ @@ -82,7 +91,49 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> --- a/arch/powerpc/kernel/entry_32.S +++ b/arch/powerpc/kernel/entry_32.S -@@ -885,7 +885,14 @@ user_exc_return: /* r10 contains MSR_KE +@@ -393,7 +393,9 @@ reenable_mmu: /* re-enable mmu so we + MTMSRD(r10) + lwz r9,TI_FLAGS(r12) + li r8,-MAX_ERRNO +- andi. r0,r9,(_TIF_SYSCALL_DOTRACE|_TIF_SINGLESTEP|_TIF_USER_WORK_MASK|_TIF_PERSYSCALL_MASK) ++ lis r0,(_TIF_SYSCALL_DOTRACE|_TIF_SINGLESTEP|_TIF_USER_WORK_MASK|_TIF_PERSYSCALL_MASK)@h ++ ori r0,r0, (_TIF_SYSCALL_DOTRACE|_TIF_SINGLESTEP|_TIF_USER_WORK_MASK|_TIF_PERSYSCALL_MASK)@l ++ and. r0,r9,r0 + bne- syscall_exit_work + cmplw 0,r3,r8 + blt+ syscall_exit_cont +@@ -511,13 +513,13 @@ END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRE + b syscall_dotrace_cont + + syscall_exit_work: +- andi. r0,r9,_TIF_RESTOREALL ++ andis. r0,r9,_TIF_RESTOREALL@h + beq+ 0f + REST_NVGPRS(r1) + b 2f + 0: cmplw 0,r3,r8 + blt+ 1f +- andi. r0,r9,_TIF_NOERROR ++ andis. r0,r9,_TIF_NOERROR@h + bne- 1f + lwz r11,_CCR(r1) /* Load CR */ + neg r3,r3 +@@ -526,12 +528,12 @@ END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRE + + 1: stw r6,RESULT(r1) /* Save result */ + stw r3,GPR3(r1) /* Update return value */ +-2: andi. r0,r9,(_TIF_PERSYSCALL_MASK) ++2: andis. r0,r9,(_TIF_PERSYSCALL_MASK)@h + beq 4f + + /* Clear per-syscall TIF flags if any are set. */ + +- li r11,_TIF_PERSYSCALL_MASK ++ lis r11,_TIF_PERSYSCALL_MASK@h + addi r12,r12,TI_FLAGS + 3: lwarx r8,0,r12 + andc r8,r8,r11 +@@ -888,7 +890,14 @@ user_exc_return: /* r10 contains MSR_KE cmpwi 0,r0,0 /* if non-zero, just restore regs and return */ bne restore andi. r8,r8,_TIF_NEED_RESCHED @@ -97,7 +148,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> lwz r3,_MSR(r1) andi. r0,r3,MSR_EE /* interrupts off? */ beq restore /* don't schedule if so */ -@@ -896,11 +903,11 @@ user_exc_return: /* r10 contains MSR_KE +@@ -899,11 +908,11 @@ user_exc_return: /* r10 contains MSR_KE */ bl trace_hardirqs_off #endif @@ -112,7 +163,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> #ifdef CONFIG_TRACE_IRQFLAGS /* And now, to properly rebalance the above, we tell lockdep they * are being turned back on, which will happen when we return -@@ -1223,7 +1230,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRE +@@ -1232,7 +1241,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRE #endif /* !(CONFIG_4xx || CONFIG_BOOKE) */ do_work: /* r10 contains MSR_KERNEL here */ @@ -121,7 +172,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> beq do_user_signal do_resched: /* r10 contains MSR_KERNEL here */ -@@ -1244,7 +1251,7 @@ do_resched: /* r10 contains MSR_KERNEL +@@ -1253,7 +1262,7 @@ do_resched: /* r10 contains MSR_KERNEL MTMSRD(r10) /* disable interrupts */ CURRENT_THREAD_INFO(r9, r1) lwz r9,TI_FLAGS(r9) @@ -132,7 +183,48 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> beq restore_user --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S -@@ -780,7 +780,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S) +@@ -253,7 +253,9 @@ system_call: /* label this so stack tr + + ld r9,TI_FLAGS(r12) + li r11,-MAX_ERRNO +- andi. r0,r9,(_TIF_SYSCALL_DOTRACE|_TIF_SINGLESTEP|_TIF_USER_WORK_MASK|_TIF_PERSYSCALL_MASK) ++ lis r0,(_TIF_SYSCALL_DOTRACE|_TIF_SINGLESTEP|_TIF_USER_WORK_MASK|_TIF_PERSYSCALL_MASK)@h ++ ori r0,r0,(_TIF_SYSCALL_DOTRACE|_TIF_SINGLESTEP|_TIF_USER_WORK_MASK|_TIF_PERSYSCALL_MASK)@l ++ and. r0,r9,r0 + bne- .Lsyscall_exit_work + + andi. r0,r8,MSR_FP +@@ -370,25 +372,25 @@ END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR) + /* If TIF_RESTOREALL is set, don't scribble on either r3 or ccr. + If TIF_NOERROR is set, just save r3 as it is. */ + +- andi. r0,r9,_TIF_RESTOREALL ++ andis. r0,r9,_TIF_RESTOREALL@h + beq+ 0f + REST_NVGPRS(r1) + b 2f + 0: cmpld r3,r11 /* r11 is -MAX_ERRNO */ + blt+ 1f +- andi. r0,r9,_TIF_NOERROR ++ andis. r0,r9,_TIF_NOERROR@h + bne- 1f + ld r5,_CCR(r1) + neg r3,r3 + oris r5,r5,0x1000 /* Set SO bit in CR */ + std r5,_CCR(r1) + 1: std r3,GPR3(r1) +-2: andi. r0,r9,(_TIF_PERSYSCALL_MASK) ++2: andis. r0,r9,(_TIF_PERSYSCALL_MASK)@h + beq 4f + + /* Clear per-syscall TIF flags if any are set. */ + +- li r11,_TIF_PERSYSCALL_MASK ++ lis r11,(_TIF_PERSYSCALL_MASK)@h + addi r12,r12,TI_FLAGS + 3: ldarx r10,0,r12 + andc r10,r10,r11 +@@ -780,7 +782,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S) bl restore_math b restore #endif @@ -141,7 +233,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> beq 2f bl restore_interrupts SCHEDULE_USER -@@ -842,10 +842,18 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S) +@@ -842,10 +844,18 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S) #ifdef CONFIG_PREEMPT /* Check if we need to preempt */ @@ -161,7 +253,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> cmpwi cr0,r8,0 bne restore ld r0,SOFTE(r1) -@@ -862,7 +870,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S) +@@ -862,7 +872,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S) /* Re-test flags and eventually loop */ CURRENT_THREAD_INFO(r9, r1) ld r4,TI_FLAGS(r9) diff --git a/patches/powerpc-pseries-iommu-Use-a-locallock-instead-local_ir.patch b/patches/powerpc-pseries-iommu-Use-a-locallock-instead-local_ir.patch new file mode 100644 index 000000000000..28223738e843 --- /dev/null +++ b/patches/powerpc-pseries-iommu-Use-a-locallock-instead-local_ir.patch @@ -0,0 +1,94 @@ +From: Sebastian Andrzej Siewior <bigeasy@linutronix.de> +Date: Tue, 26 Mar 2019 18:31:54 +0100 +Subject: [PATCH] powerpc/pseries/iommu: Use a locallock instead + local_irq_save() + +The locallock protects the per-CPU variable tce_page. The function +attempts to allocate memory while tce_page is protected (by disabling +interrupts). + +Use local_irq_save() instead of local_irq_disable(). + +Cc: stable-rt@vger.kernel.org +Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> +--- + arch/powerpc/platforms/pseries/iommu.c | 16 ++++++++++------ + 1 file changed, 10 insertions(+), 6 deletions(-) + +diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c +index 8fc8fe0b98485..14ecedbd8ff12 100644 +--- a/arch/powerpc/platforms/pseries/iommu.c ++++ b/arch/powerpc/platforms/pseries/iommu.c +@@ -38,6 +38,7 @@ + #include <linux/of.h> + #include <linux/iommu.h> + #include <linux/rculist.h> ++#include <linux/locallock.h> + #include <asm/io.h> + #include <asm/prom.h> + #include <asm/rtas.h> +@@ -191,6 +192,7 @@ static int tce_build_pSeriesLP(struct iommu_table *tbl, long tcenum, + } + + static DEFINE_PER_CPU(__be64 *, tce_page); ++static DEFINE_LOCAL_IRQ_LOCK(tcp_page_lock); + + static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum, + long npages, unsigned long uaddr, +@@ -211,7 +213,8 @@ static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum, + direction, attrs); + } + +- local_irq_save(flags); /* to protect tcep and the page behind it */ ++ /* to protect tcep and the page behind it */ ++ local_lock_irqsave(tcp_page_lock, flags); + + tcep = __this_cpu_read(tce_page); + +@@ -222,7 +225,7 @@ static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum, + tcep = (__be64 *)__get_free_page(GFP_ATOMIC); + /* If allocation fails, fall back to the loop implementation */ + if (!tcep) { +- local_irq_restore(flags); ++ local_unlock_irqrestore(tcp_page_lock, flags); + return tce_build_pSeriesLP(tbl, tcenum, npages, uaddr, + direction, attrs); + } +@@ -256,7 +259,7 @@ static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum, + tcenum += limit; + } while (npages > 0 && !rc); + +- local_irq_restore(flags); ++ local_unlock_irqrestore(tcp_page_lock, flags); + + if (unlikely(rc == H_NOT_ENOUGH_RESOURCES)) { + ret = (int)rc; +@@ -414,13 +417,14 @@ static int tce_setrange_multi_pSeriesLP(unsigned long start_pfn, + u64 rc = 0; + long l, limit; + +- local_irq_disable(); /* to protect tcep and the page behind it */ ++ /* to protect tcep and the page behind it */ ++ local_lock_irq(tcp_page_lock); + tcep = __this_cpu_read(tce_page); + + if (!tcep) { + tcep = (__be64 *)__get_free_page(GFP_ATOMIC); + if (!tcep) { +- local_irq_enable(); ++ local_unlock_irq(tcp_page_lock); + return -ENOMEM; + } + __this_cpu_write(tce_page, tcep); +@@ -466,7 +470,7 @@ static int tce_setrange_multi_pSeriesLP(unsigned long start_pfn, + + /* error cleanup: caller will clear whole range */ + +- local_irq_enable(); ++ local_unlock_irq(tcp_page_lock); + return rc; + } + +-- +2.20.1 + diff --git a/patches/powerpc-stackprotector-work-around-stack-guard-init-.patch b/patches/powerpc-stackprotector-work-around-stack-guard-init-.patch new file mode 100644 index 000000000000..3464b5daba51 --- /dev/null +++ b/patches/powerpc-stackprotector-work-around-stack-guard-init-.patch @@ -0,0 +1,34 @@ +From: Sebastian Andrzej Siewior <bigeasy@linutronix.de> +Date: Tue, 26 Mar 2019 18:31:29 +0100 +Subject: [PATCH ] powerpc/stackprotector: work around stack-guard init from + atomic + +This is invoked from the secondary CPU in atomic context. On x86 we use +tsc instead. On Power we XOR it against mftb() so lets use stack address +as the initial value. + +Cc: stable-rt@vger.kernel.org +Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> +--- + arch/powerpc/include/asm/stackprotector.h | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/arch/powerpc/include/asm/stackprotector.h b/arch/powerpc/include/asm/stackprotector.h +index 1c8460e235838..e764eb4b6c284 100644 +--- a/arch/powerpc/include/asm/stackprotector.h ++++ b/arch/powerpc/include/asm/stackprotector.h +@@ -24,7 +24,11 @@ static __always_inline void boot_init_stack_canary(void) + unsigned long canary; + + /* Try to get a semi random initial value. */ ++#ifdef CONFIG_PREEMPT_RT_FULL ++ canary = (unsigned long)&canary; ++#else + canary = get_random_canary(); ++#endif + canary ^= mftb(); + canary ^= LINUX_VERSION_CODE; + canary &= CANARY_MASK; +-- +2.20.1 + diff --git a/patches/printk-set-deferred-to-default-loglevel-enforce-mask.patch b/patches/printk-set-deferred-to-default-loglevel-enforce-mask.patch index 25ca268c6197..41ee61ead7dc 100644 --- a/patches/printk-set-deferred-to-default-loglevel-enforce-mask.patch +++ b/patches/printk-set-deferred-to-default-loglevel-enforce-mask.patch @@ -29,7 +29,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> cont_add(ctx, cpu, facility, level, lflags, text, text_len); @@ -2674,7 +2674,7 @@ late_initcall(init_printk_kthread); - int vprintk_deferred(const char *fmt, va_list args) + static int vprintk_deferred(const char *fmt, va_list args) { - return vprintk_emit(0, LOGLEVEL_SCHED, NULL, 0, fmt, args); + return vprintk_emit(0, LOGLEVEL_DEFAULT, NULL, 0, fmt, args); diff --git a/patches/series b/patches/series index 89779e5b99cc..6561ada148b7 100644 --- a/patches/series +++ b/patches/series @@ -5,6 +5,7 @@ ############################################################ # UPSTREAM merged ############################################################ +tty-sysrq-Convert-show_lock-to-raw_spinlock_t.patch ############################################################ # POSTED by others @@ -26,6 +27,7 @@ sched-fair-Robustify-CFS-bandwidth-timer-locking.patch # John's printk series # [RFC PATCH v1 00/25] printk: new implementation # Date: Tue, 12 Feb 2019 15:29:38 +0100 +# Plus build fixes merged 0001-printk-rb-add-printk-ring-buffer-documentation.patch 0002-printk-rb-add-prb-locking-functions.patch 0003-printk-rb-define-ring-buffer-struct-and-initializer.patch @@ -334,6 +336,9 @@ squashfs-make-use-of-local-lock-in-multi_cpu-decompr.patch # X86 thermal-Defer-thermal-wakups-to-threads.patch +# POWER +powerpc-pseries-iommu-Use-a-locallock-instead-local_ir.patch + # CPU get light epoll-use-get-cpu-light.patch mm-vmalloc-use-get-cpu-light.patch @@ -410,6 +415,7 @@ crypto-cryptd-add-a-lock-instead-preempt_disable-loc.patch # RANDOM panic-disable-random-on-rt.patch x86-stackprot-no-random-on-rt.patch +powerpc-stackprotector-work-around-stack-guard-init-.patch random-make-it-work-on-rt.patch random-avoid-preempt_disable-ed-section.patch diff --git a/patches/tty-sysrq-Convert-show_lock-to-raw_spinlock_t.patch b/patches/tty-sysrq-Convert-show_lock-to-raw_spinlock_t.patch new file mode 100644 index 000000000000..484fb05d02d0 --- /dev/null +++ b/patches/tty-sysrq-Convert-show_lock-to-raw_spinlock_t.patch @@ -0,0 +1,60 @@ +From: Julien Grall <julien.grall@arm.com> +Date: Wed, 13 Mar 2019 11:40:34 +0000 +Subject: [PATCH] tty/sysrq: Convert show_lock to raw_spinlock_t + +Systems which don't provide arch_trigger_cpumask_backtrace() will +invoke showacpu() from a smp_call_function() function which is invoked +with disabled interrupts even on -RT systems. + +The function acquires the show_lock lock which only purpose is to +ensure that the CPUs don't print simultaneously. Otherwise the +output would clash and it would be hard to tell the output from CPUx +apart from CPUy. + +On -RT the spin_lock() can not be acquired from this context. A +raw_spin_lock() is required. It will introduce the system's latency +by performing the sysrq request and other CPUs will block on the lock +until the request is done. This is okay because the user asked for a +backtrace of all active CPUs and under "normal circumstances in +production" this path should not be triggered. + +Signed-off-by: Julien Grall <julien.grall@arm.com> +[bigeasy@linuxtronix.de: commit description] +Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> +Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Cc: stable-rt@vger.kernel.org +Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> +--- + drivers/tty/sysrq.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c +index 1f03078ec3527..8473557c7ab2a 100644 +--- a/drivers/tty/sysrq.c ++++ b/drivers/tty/sysrq.c +@@ -208,7 +208,7 @@ static struct sysrq_key_op sysrq_showlocks_op = { + #endif + + #ifdef CONFIG_SMP +-static DEFINE_SPINLOCK(show_lock); ++static DEFINE_RAW_SPINLOCK(show_lock); + + static void showacpu(void *dummy) + { +@@ -218,10 +218,10 @@ static void showacpu(void *dummy) + if (idle_cpu(smp_processor_id())) + return; + +- spin_lock_irqsave(&show_lock, flags); ++ raw_spin_lock_irqsave(&show_lock, flags); + pr_info("CPU%d:\n", smp_processor_id()); + show_stack(NULL, NULL); +- spin_unlock_irqrestore(&show_lock, flags); ++ raw_spin_unlock_irqrestore(&show_lock, flags); + } + + static void sysrq_showregs_othercpus(struct work_struct *dummy) +-- +2.20.1 + |