History

genirq: Make force irq threading setup more robust

The support of force threading interrupts which are set up with both a primary and a threaded handler wreckaged the setup of regular requested threaded interrupts (primary handler == NULL). The reason is that it does not check whether the primary handler is set to the default handler which wakes the handler thread. Instead it replaces the thread handler with the primary handler as it would do with force threaded interrupts which have been requested via request_irq(). So both the primary and the thread handler become the same which then triggers the warnon that the thread handler tries to wakeup a not configured secondary thread. Fortunately this only happens when the driver omits the IRQF_ONESHOT flag when requesting the threaded interrupt, which is normaly caught by the sanity checks when force irq threading is disabled. Fix it by skipping the force threading setup when a regular threaded interrupt is requested. As a consequence the interrupt request which lacks the IRQ_ONESHOT flag is rejected correctly instead of silently wreckaging it.

Thomas Gleixner committed 8 years ago

Commit d1f03011 parent 6b470371 file · +8 −1Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/irq/manage.c+8−1
@@ -1068,6 +1068,13 @@ static int irq_setup_forced_threading(struct irqaction *new) · 1067 unmodified lines
1068 if (new->flags & (IRQF_NO_THREAD | IRQF_PERCPU | IRQF_ONESHOT))1068 if (new->flags & (IRQF_NO_THREAD | IRQF_PERCPU | IRQF_ONESHOT))
1069 return 0;1069 return 0;
1070 1070
1071 /*
1072 * No further action required for interrupts which are requested as
1073 * threaded interrupts already
1074 */
1075 if (new->handler == irq_default_primary_handler)
1076 return 0;
1077
1071 new->flags |= IRQF_ONESHOT;1078 new->flags |= IRQF_ONESHOT;
1072 1079
1073 /*1080 /*
@@ -1075,7 +1082,7 @@ static int irq_setup_forced_threading(struct irqaction *new) · 1 unmodified line
1075 * thread handler. We force thread them as well by creating a1082 * thread handler. We force thread them as well by creating a
1076 * secondary action.1083 * secondary action.
1077 */1084 */
1078 if (new->handler != irq_default_primary_handler && new->thread_fn) {1085 if (new->handler && new->thread_fn) {
1079 /* Allocate the secondary action */1086 /* Allocate the secondary action */
1080 new->secondary = kzalloc(sizeof(struct irqaction), GFP_KERNEL);1087 new->secondary = kzalloc(sizeof(struct irqaction), GFP_KERNEL);
1081 if (!new->secondary)1088 if (!new->secondary)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t