Linux v3.18.138-rt116-rc1
Subsystems (2)
cover Linux v3.18.138-rt116-rc1
From: Tom Zanussi <[email protected]>
Dear RT Folks,
This is the RT stable review cycle of patch 3.18.138-rt116-rc1.
Please scream at me if I messed something up. Please test the patches too.
The -rc release will be uploaded to kernel.org and will be deleted when the final release is out. This is just a review release (or release candidate).
The pre-releases will not be pushed to the git repository, only the final release is.
If all goes well, this patch will be converted to the next main release on 2019-05-09.
To build 3.18.138-rt116-rc1 directly, the following patches should be applied:
https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.18.tar.xz
https://www.kernel.org/pub/linux/kernel/v3.x/patch-3.18.138.xz
https://www.kernel.org/pub/linux/kernel/projects/rt/3.18/patch-3.18.138-rt116-rc1.patch.xz
You can also build from 3.18.138-rt115 by applying the incremental patch:
Enjoy,
-- Tom
Julien Grall (1):
tty/sysrq: Convert show_lock to raw_spinlock_t
Sebastian Andrzej Siewior (2):
softirq: Avoid "local_softirq_pending" messages if ksoftirqd is
blocked
powerpc/pseries/iommu: Use a locallock instead local_irq_save()
Tom Zanussi (1):
Linux 3.18.138-rt116-rc1
arch/powerpc/platforms/pseries/iommu.c | 16 ++++++---- drivers/tty/sysrq.c | 6 ++-- kernel/softirq.c | 57 ++++++++++++++++++++++++---------- localversion-rt | 2 +- 4 files changed, 55 insertions(+), 26 deletions(-)
Signature · 1 line
2.14.1
PATCH 1/4 softirq: Avoid "local_softirq_pending" messages if ksoftirqd is blocked
From: Sebastian Andrzej Siewior <[email protected]>
v3.18.138-rt116-rc1 stable review patch.
If anyone has any objections, please let me know.
-----------
[ Upstream commit 2cf32c1a3d9352df8017dbf84a1462c4a60a1826 ]
If the ksoftirqd thread has a softirq pending and is blocked on the `local_softirq_locks' lock then softirq_check_pending_idle() won't complain because the "lock owner" will mask away this softirq from the mask of pending softirqs.
If ksoftirqd has an additional softirq pending then it won't be masked out because we never look at ksoftirqd's mask.
If there are still pending softirqs while going to idle check ksoftirqd's and ktimersfotd's mask before complaining about unhandled softirqs.
--- kernel/softirq.c | 57 ++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 16 deletions(-)
kernel/softirq.c +41 -16
@@ -91,6 +91,31 @@ static inline void softirq_clr_runner(unsigned int sirq) sr->runner[sirq] =NULL ; } +static bool softirq_check_runner_tsk (struct task_struct *tsk, +unsigned int *pending) +{ +bool ret = false; + +if (!tsk) +return ret; + +/* +* The wakeup code in rtmutex.c wakes up the task +* _before_ it sets pi_blocked_on to NULL under +* tsk->pi_lock. So we need to check for both: state +* and pi_blocked_on. +*/ +raw_spin_lock (&tsk->pi_lock); +if (tsk->pi_blocked_on || tsk->state ==TASK_RUNNING ) { +/* Clear all bits pending in that task */ + *pending &= ~(tsk->softirqs_raised); + ret = true; + } +raw_spin_unlock (&tsk->pi_lock); + +return ret; +} +/* * On preempt-rt a softirq running context might be blocked on a * lock. There might be no other runnable task on this CPU because the
@@ -103,6 +128,7 @@ static inline void softirq_clr_runner(unsigned int sirq)*/ void softirq_check_pending_idle (void ) { +struct task_struct *tsk;static int rate_limit;struct softirq_runner *sr = &__get_cpu_var (softirq_runners);u32 warnpending;
@@ -112,24 +138,23 @@ void softirq_check_pending_idle(void)return ; warnpending =local_softirq_pending () &SOFTIRQ_STOP_IDLE_MASK ; +if (!warnpending) +return ;for (i =0 ; i <NR_SOFTIRQS ; i++) { -struct task_struct *tsk = sr->runner[i]; + tsk = sr->runner[i]; -/* -* The wakeup code in rtmutex.c wakes up the task -* _before_ it sets pi_blocked_on to NULL under -* tsk->pi_lock. So we need to check for both: state -* and pi_blocked_on. -*/ -if (tsk) { -raw_spin_lock (&tsk->pi_lock); -if (tsk->pi_blocked_on || tsk->state ==TASK_RUNNING ) { -/* Clear all bits pending in that task */ - warnpending &= ~(tsk->softirqs_raised); - warnpending &= ~(1 << i); - } -raw_spin_unlock (&tsk->pi_lock); - } +if (softirq_check_runner_tsk (tsk, &warnpending)) + warnpending &= ~(1 << i); + } + +if (warnpending) { + tsk =__this_cpu_read (ksoftirqd); +softirq_check_runner_tsk (tsk, &warnpending); + } + +if (warnpending) { + tsk =__this_cpu_read (ktimer_softirqd); +softirq_check_runner_tsk (tsk, &warnpending); }if (warnpending) {
Signature · 1 line
2.14.1
PATCH 2/4 powerpc/pseries/iommu: Use a locallock instead local_irq_save()
In reply to [email protected]From: Sebastian Andrzej Siewior <[email protected]>
v3.18.138-rt116-rc1 stable review patch.
If anyone has any objections, please let me know.
-----------
[ Upstream commit 5c1b4cd70e2ca0c81038b65babe6dc66086322e0 ]
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().
Conflicts:
arch/powerpc/platforms/pseries/iommu.c
--- arch/powerpc/platforms/pseries/iommu.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
arch/powerpc/platforms/pseries/iommu.c +10 -6
@@ -36,6 +36,7 @@#include <linux/crash_dump.h> #include <linux/memory.h> #include <linux/of.h> +#include <linux/locallock.h> #include <asm/io.h> #include <asm/prom.h> #include <asm/rtas.h>
@@ -177,6 +178,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,
@@ -197,7 +199,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 =__get_cpu_var (tce_page);
@@ -208,7 +211,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); }
@@ -242,7 +245,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;
@@ -397,13 +400,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 =__get_cpu_var (tce_page);if (!tcep) { tcep = (__be64 *)__get_free_page (GFP_ATOMIC );if (!tcep) { -local_irq_enable (); +local_unlock_irq (tcp_page_lock);return -ENOMEM ; }__get_cpu_var (tce_page) = tcep;
@@ -449,7 +453,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; }
Signature · 1 line
2.14.1
PATCH 3/4 tty/sysrq: Convert show_lock to raw_spinlock_t
In reply to [email protected]From: Julien Grall <[email protected]>
v3.18.138-rt116-rc1 stable review patch.
If anyone has any objections, please let me know.
-----------
[ Upstream commit db80c207bffd0f49e984e9889ce62279bc3abd6c ]
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.
Conflicts:
drivers/tty/sysrq.c
--- drivers/tty/sysrq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/tty/sysrq.c +3 -3
@@ -206,7 +206,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) {
@@ -216,10 +216,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);printk (KERN_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)
Signature · 1 line
2.14.1
PATCH 4/4 Linux 3.18.138-rt116-rc1
In reply to [email protected]From: Tom Zanussi <[email protected]>
v3.18.138-rt116-rc1 stable review patch.
If anyone has any objections, please let me know.
-----------
--- localversion-rt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
localversion-rt +1 -1
@@ -1 +1 @@ --rt115 +-rt116-rc1
Signature · 1 line
2.14.1