linux/arch/powerpc/sysdev
Cédric Le Goater a9dadc1c51 powerpc/xive: Fix the size of the cpumask used in xive_find_target_in_mask()
When called from xive_irq_startup(), the size of the cpumask can be
larger than nr_cpu_ids. This can result in a WARN_ON such as:

  WARNING: CPU: 10 PID: 1 at ../arch/powerpc/sysdev/xive/common.c:476 xive_find_target_in_mask+0x110/0x2f0
  ...
  NIP [c00000000008a310] xive_find_target_in_mask+0x110/0x2f0
  LR [c00000000008a2e4] xive_find_target_in_mask+0xe4/0x2f0
  Call Trace:
    xive_find_target_in_mask+0x74/0x2f0 (unreliable)
    xive_pick_irq_target.isra.1+0x200/0x230
    xive_irq_startup+0x60/0x180
    irq_startup+0x70/0xd0
    __setup_irq+0x7bc/0x880
    request_threaded_irq+0x14c/0x2c0
    request_event_sources_irqs+0x100/0x180
    __machine_initcall_pseries_init_ras_IRQ+0x104/0x134
    do_one_initcall+0x68/0x1d0
    kernel_init_freeable+0x290/0x374
    kernel_init+0x24/0x170
    ret_from_kernel_thread+0x5c/0x74

This happens because we're being called with our affinity mask set to
irq_default_affinity. That in turn was populated using
cpumask_setall(), which sets NR_CPUs worth of bits, not nr_cpu_ids
worth. Finally cpumask_weight() will return > nr_cpu_ids when passed a
mask which has > nr_cpu_ids bits set.

Fix it by limiting the value returned by cpumask_weight().

Signed-off-by: Cédric Le Goater <clg@kaod.org>
[mpe: Add change log details on actual cause]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2017-08-24 15:20:18 +10:00
..
ge
xics powerpc/powernv: Fix oops on P9 DD1 in cause_ipi() 2017-04-26 23:28:12 +10:00
xive powerpc/xive: Fix the size of the cpumask used in xive_find_target_in_mask() 2017-08-24 15:20:18 +10:00
6xx-suspend.S
axonram.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00
cpm1.c powerpc/8xx: Adding support of IRQ in MPC8xx GPIO 2017-05-02 22:35:00 -05:00
cpm2.c
cpm2_pic.c
cpm2_pic.h
cpm_common.c
dart.h
dart_iommu.c
dcr-low.S
dcr.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00
ehv_pic.c
fsl_85xx_cache_ctlr.h
fsl_85xx_cache_sram.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00
fsl_85xx_l2ctlr.c
fsl_gtm.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00
fsl_lbc.c
fsl_mpic_err.c
fsl_mpic_timer_wakeup.c
fsl_msi.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00
fsl_msi.h
fsl_pci.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00
fsl_pci.h
fsl_pmc.c
fsl_rcpm.c
fsl_rio.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00
fsl_rio.h
fsl_rmu.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00
fsl_soc.c powerpc/cpm1: link to CONFIG_CPM1 instead of CONFIG_8xx 2017-08-10 23:32:05 +10:00
fsl_soc.h powerpc/cpm1: link to CONFIG_CPM1 instead of CONFIG_8xx 2017-08-10 23:32:05 +10:00
grackle.c
i8259.c
indirect_pci.c
ipic.c powerpc/ipic: Support edge on IRQ0 2017-07-24 21:20:31 +10:00
ipic.h
Kconfig
Makefile powerpc/8xx: Move mpc8xx_pic.c from sysdev to platform/8xx 2017-08-10 23:32:07 +10:00
micropatch.c
mmio_nvram.c
mpc5xxx_clocks.c
mpic.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00
mpic.h
mpic_msgr.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00
mpic_msi.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00
mpic_timer.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00
mpic_u3msi.c
msi_bitmap.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00
mv64x60.h
mv64x60_dev.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00
mv64x60_pci.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00
mv64x60_pic.c
mv64x60_udbg.c
of_rtc.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00
pmi.c
rtc_cmos_setup.c
scom.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00
simple_gpio.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00
simple_gpio.h
tsi108_dev.c
tsi108_pci.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00
udbg_memcons.c
xilinx_intc.c
xilinx_pci.c