Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull irq fixes from Thomas Gleixner:
"A slighlty large fix for a subtle issue in the CPU hotplug code of
certain ARM SoCs, where the not yet online cpu needs to setup the cpu
local timer and needs to set the interrupt affinity to itself.
Setting interrupt affinity to a not online cpu is prohibited and
therefor the timer interrupt ends up on the wrong cpu, which leads to
nasty complications.

The SoC folks tried to hack around that in the SoC code in some more
than nasty ways. The proper solution is to have a way to enforce the
affinity setting to a not online cpu. The core patch to the genirq
code provides that facility and the follow up patches make use of it
in the GIC interrupt controller and the exynos timer driver.

The change to the core code has no implications to existing users,
except for the rename of the locked function and therefor the
necessary fixup in mips/cavium. Aside of that, no runtime impact is
possible, as none of the existing interrupt chips implements anything
which depends on the force argument of the irq_set_affinity()
callback"

* 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
clocksource: Exynos_mct: Register clock event after request_irq()
clocksource: Exynos_mct: Use irq_force_affinity() in cpu bringup
irqchip: Gic: Support forced affinity setting
genirq: Allow forcing cpu affinity of interrupts

+52 -25
+1 -1
arch/mips/cavium-octeon/octeon-irq.c
··· 635 635 cpumask_clear(&new_affinity); 636 636 cpumask_set_cpu(cpumask_first(cpu_online_mask), &new_affinity); 637 637 } 638 - __irq_set_affinity_locked(data, &new_affinity); 638 + irq_set_affinity_locked(data, &new_affinity, false); 639 639 } 640 640 641 641 static int octeon_irq_ciu_set_affinity(struct irq_data *data,
+3 -9
drivers/clocksource/exynos_mct.c
··· 416 416 evt->set_mode = exynos4_tick_set_mode; 417 417 evt->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; 418 418 evt->rating = 450; 419 - clockevents_config_and_register(evt, clk_rate / (TICK_BASE_CNT + 1), 420 - 0xf, 0x7fffffff); 421 419 422 420 exynos4_mct_write(TICK_BASE_CNT, mevt->base + MCT_L_TCNTB_OFFSET); 423 421 ··· 428 430 evt->irq); 429 431 return -EIO; 430 432 } 433 + irq_force_affinity(mct_irqs[MCT_L0_IRQ + cpu], cpumask_of(cpu)); 431 434 } else { 432 435 enable_percpu_irq(mct_irqs[MCT_L0_IRQ], 0); 433 436 } 437 + clockevents_config_and_register(evt, clk_rate / (TICK_BASE_CNT + 1), 438 + 0xf, 0x7fffffff); 434 439 435 440 return 0; 436 441 } ··· 451 450 unsigned long action, void *hcpu) 452 451 { 453 452 struct mct_clock_event_device *mevt; 454 - unsigned int cpu; 455 453 456 454 /* 457 455 * Grab cpu pointer in each case to avoid spurious ··· 460 460 case CPU_STARTING: 461 461 mevt = this_cpu_ptr(&percpu_mct_tick); 462 462 exynos4_local_timer_setup(&mevt->evt); 463 - break; 464 - case CPU_ONLINE: 465 - cpu = (unsigned long)hcpu; 466 - if (mct_int_type == MCT_INT_SPI) 467 - irq_set_affinity(mct_irqs[MCT_L0_IRQ + cpu], 468 - cpumask_of(cpu)); 469 463 break; 470 464 case CPU_DYING: 471 465 mevt = this_cpu_ptr(&percpu_mct_tick);
+6 -2
drivers/irqchip/irq-gic.c
··· 246 246 bool force) 247 247 { 248 248 void __iomem *reg = gic_dist_base(d) + GIC_DIST_TARGET + (gic_irq(d) & ~3); 249 - unsigned int shift = (gic_irq(d) % 4) * 8; 250 - unsigned int cpu = cpumask_any_and(mask_val, cpu_online_mask); 249 + unsigned int cpu, shift = (gic_irq(d) % 4) * 8; 251 250 u32 val, mask, bit; 251 + 252 + if (!force) 253 + cpu = cpumask_any_and(mask_val, cpu_online_mask); 254 + else 255 + cpu = cpumask_first(mask_val); 252 256 253 257 if (cpu >= NR_GIC_CPU_IF || cpu >= nr_cpu_ids) 254 258 return -EINVAL;
+34 -1
include/linux/interrupt.h
··· 203 203 204 204 extern cpumask_var_t irq_default_affinity; 205 205 206 - extern int irq_set_affinity(unsigned int irq, const struct cpumask *cpumask); 206 + /* Internal implementation. Use the helpers below */ 207 + extern int __irq_set_affinity(unsigned int irq, const struct cpumask *cpumask, 208 + bool force); 209 + 210 + /** 211 + * irq_set_affinity - Set the irq affinity of a given irq 212 + * @irq: Interrupt to set affinity 213 + * @mask: cpumask 214 + * 215 + * Fails if cpumask does not contain an online CPU 216 + */ 217 + static inline int 218 + irq_set_affinity(unsigned int irq, const struct cpumask *cpumask) 219 + { 220 + return __irq_set_affinity(irq, cpumask, false); 221 + } 222 + 223 + /** 224 + * irq_force_affinity - Force the irq affinity of a given irq 225 + * @irq: Interrupt to set affinity 226 + * @mask: cpumask 227 + * 228 + * Same as irq_set_affinity, but without checking the mask against 229 + * online cpus. 230 + * 231 + * Solely for low level cpu hotplug code, where we need to make per 232 + * cpu interrupts affine before the cpu becomes online. 233 + */ 234 + static inline int 235 + irq_force_affinity(unsigned int irq, const struct cpumask *cpumask) 236 + { 237 + return __irq_set_affinity(irq, cpumask, true); 238 + } 239 + 207 240 extern int irq_can_set_affinity(unsigned int irq); 208 241 extern int irq_select_affinity(unsigned int irq); 209 242
+2 -1
include/linux/irq.h
··· 394 394 395 395 extern void irq_cpu_online(void); 396 396 extern void irq_cpu_offline(void); 397 - extern int __irq_set_affinity_locked(struct irq_data *data, const struct cpumask *cpumask); 397 + extern int irq_set_affinity_locked(struct irq_data *data, 398 + const struct cpumask *cpumask, bool force); 398 399 399 400 #if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_PENDING_IRQ) 400 401 void irq_move_irq(struct irq_data *data);
+6 -11
kernel/irq/manage.c
··· 180 180 struct irq_chip *chip = irq_data_get_irq_chip(data); 181 181 int ret; 182 182 183 - ret = chip->irq_set_affinity(data, mask, false); 183 + ret = chip->irq_set_affinity(data, mask, force); 184 184 switch (ret) { 185 185 case IRQ_SET_MASK_OK: 186 186 cpumask_copy(data->affinity, mask); ··· 192 192 return ret; 193 193 } 194 194 195 - int __irq_set_affinity_locked(struct irq_data *data, const struct cpumask *mask) 195 + int irq_set_affinity_locked(struct irq_data *data, const struct cpumask *mask, 196 + bool force) 196 197 { 197 198 struct irq_chip *chip = irq_data_get_irq_chip(data); 198 199 struct irq_desc *desc = irq_data_to_desc(data); ··· 203 202 return -EINVAL; 204 203 205 204 if (irq_can_move_pcntxt(data)) { 206 - ret = irq_do_set_affinity(data, mask, false); 205 + ret = irq_do_set_affinity(data, mask, force); 207 206 } else { 208 207 irqd_set_move_pending(data); 209 208 irq_copy_pending(desc, mask); ··· 218 217 return ret; 219 218 } 220 219 221 - /** 222 - * irq_set_affinity - Set the irq affinity of a given irq 223 - * @irq: Interrupt to set affinity 224 - * @mask: cpumask 225 - * 226 - */ 227 - int irq_set_affinity(unsigned int irq, const struct cpumask *mask) 220 + int __irq_set_affinity(unsigned int irq, const struct cpumask *mask, bool force) 228 221 { 229 222 struct irq_desc *desc = irq_to_desc(irq); 230 223 unsigned long flags; ··· 228 233 return -EINVAL; 229 234 230 235 raw_spin_lock_irqsave(&desc->lock, flags); 231 - ret = __irq_set_affinity_locked(irq_desc_get_irq_data(desc), mask); 236 + ret = irq_set_affinity_locked(irq_desc_get_irq_data(desc), mask, force); 232 237 raw_spin_unlock_irqrestore(&desc->lock, flags); 233 238 return ret; 234 239 }