]> git.ipfire.org Git - people/arne_f/kernel.git/commit
genirq/matrix: Deal with the sillyness of for_each_cpu() on UP
authorThomas Gleixner <tglx@linutronix.de>
Sun, 30 Aug 2020 17:07:53 +0000 (19:07 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Sep 2020 09:29:44 +0000 (11:29 +0200)
commita1b116511aa8e7331cc373504922b879e961c0b3
tree7a3f31553f07fb6bf4c76036795fefd01d4e09e0
parent8cb3561d084ef532cd13d4f1f9077a900ff9f740
genirq/matrix: Deal with the sillyness of for_each_cpu() on UP

commit 784a0830377d0761834e385975bc46861fea9fa0 upstream.

Most of the CPU mask operations behave the same way, but for_each_cpu() and
it's variants ignore the cpumask argument and claim that CPU0 is always in
the mask. This is historical, inconsistent and annoying behaviour.

The matrix allocator uses for_each_cpu() and can be called on UP with an
empty cpumask. The calling code does not expect that this succeeds but
until commit e027fffff799 ("x86/irq: Unbreak interrupt affinity setting")
this went unnoticed. That commit added a WARN_ON() to catch cases which
move an interrupt from one vector to another on the same CPU. The warning
triggers on UP.

Add a check for the cpumask being empty to prevent this.

Fixes: 2f75d9e1c905 ("genirq: Implement bitmap matrix allocator")
Reported-by: kernel test robot <rong.a.chen@intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/irq/matrix.c