[rt] Refresh "genirq: Do not invoke the affinity callback via a workqueue on RT" for context changes in 4.19.114

This commit is contained in:
Salvatore Bonaccorso 2020-04-16 23:18:43 +02:00
parent 81ec71f423
commit 4e3802ddec
2 changed files with 18 additions and 20 deletions

2
debian/changelog vendored
View File

@ -1622,6 +1622,8 @@ linux (4.19.115-1) UNRELEASED; urgency=medium
* [rt] Refresh "workqueue: Use normal rcu" for context changes in 4.19.112
* [rt] Refresh "signals: Allow rt tasks to cache one sigqueue struct" for
context changes in 4.19.112
* [rt] Refresh "genirq: Do not invoke the affinity callback via a workqueue
on RT" for context changes in 4.19.114
[ Ben Hutchings ]
* [x86] Drop "Add a SysRq option to lift kernel lockdown" (Closes: #947021)

View File

@ -16,8 +16,6 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
kernel/irq/manage.c | 46 ++++++++++++++++++++++++++++++++++++---
2 files changed, 49 insertions(+), 3 deletions(-)
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 315f852b4981..a943c07b54ba 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -13,6 +13,7 @@
@ -28,7 +26,7 @@ index 315f852b4981..a943c07b54ba 100644
#include <linux/atomic.h>
#include <asm/ptrace.h>
@@ -225,6 +226,7 @@ extern void resume_device_irqs(void);
@@ -225,6 +226,7 @@
* struct irq_affinity_notify - context for notification of IRQ affinity changes
* @irq: Interrupt to which notification applies
* @kref: Reference count, for internal use
@ -36,7 +34,7 @@ index 315f852b4981..a943c07b54ba 100644
* @work: Work item, for internal use
* @notify: Function to be called on change. This will be
* called in process context.
@@ -236,7 +238,11 @@ extern void resume_device_irqs(void);
@@ -236,7 +238,11 @@
struct irq_affinity_notify {
unsigned int irq;
struct kref kref;
@ -48,24 +46,22 @@ index 315f852b4981..a943c07b54ba 100644
void (*notify)(struct irq_affinity_notify *, const cpumask_t *mask);
void (*release)(struct kref *ref);
};
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 3c26d0708709..eadcbfbd434a 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -285,7 +285,12 @@ int irq_set_affinity_locked(struct irq_data *data, const struct cpumask *mask,
@@ -285,7 +285,12 @@
if (desc->affinity_notify) {
kref_get(&desc->affinity_notify->kref);
+
+#ifdef CONFIG_PREEMPT_RT_BASE
+ swork_queue(&desc->affinity_notify->swork);
+ if (!swork_queue(&desc->affinity_notify->swork)) {
+#else
schedule_work(&desc->affinity_notify->work);
if (!schedule_work(&desc->affinity_notify->work)) {
+#endif
}
irqd_set(data, IRQD_AFFINITY_SET);
@@ -323,10 +328,8 @@ int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m)
/* Work was already scheduled, drop our extra ref */
kref_put(&desc->affinity_notify->kref,
desc->affinity_notify->release);
@@ -327,10 +332,8 @@
}
EXPORT_SYMBOL_GPL(irq_set_affinity_hint);
@ -77,7 +73,7 @@ index 3c26d0708709..eadcbfbd434a 100644
struct irq_desc *desc = irq_to_desc(notify->irq);
cpumask_var_t cpumask;
unsigned long flags;
@@ -348,6 +351,35 @@ static void irq_affinity_notify(struct work_struct *work)
@@ -352,6 +355,35 @@
kref_put(&notify->kref, notify->release);
}
@ -113,7 +109,7 @@ index 3c26d0708709..eadcbfbd434a 100644
/**
* irq_set_affinity_notifier - control notification of IRQ affinity changes
* @irq: Interrupt for which to enable/disable notification
@@ -376,7 +408,12 @@ irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify)
@@ -380,7 +412,12 @@
if (notify) {
notify->irq = irq;
kref_init(&notify->kref);
@ -126,17 +122,17 @@ index 3c26d0708709..eadcbfbd434a 100644
}
raw_spin_lock_irqsave(&desc->lock, flags);
@@ -385,7 +422,10 @@ irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify)
@@ -389,10 +426,13 @@
raw_spin_unlock_irqrestore(&desc->lock, flags);
if (old_notify) {
+#ifndef CONFIG_PREEMPT_RT_BASE
+ /* Need to address this for PREEMPT_RT */
cancel_work_sync(&old_notify->work);
if (cancel_work_sync(&old_notify->work)) {
/* Pending work had a ref, put that one too */
kref_put(&old_notify->kref, old_notify->release);
}
+#endif
kref_put(&old_notify->kref, old_notify->release);
}
--
2.25.1