linux/arch/ia64/sn/kernel
Thomas Gleixner 9feb42ac88 ia64/sn/hwperf: Replace racy task affinity logic
sn_hwperf_op_cpu() which is invoked from an ioctl requires to run code on
the requested cpu. This is achieved by temporarily setting the affinity of
the calling user space thread to the requested CPU and reset it to the
original affinity afterwards.

That's racy vs. CPU hotplug and concurrent affinity settings for that
thread resulting in code executing on the wrong CPU and overwriting the
new affinity setting.

Replace it by using work_on_cpu_safe() which guarantees to run the code on
the requested CPU or to fail in case the CPU is offline.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: linux-ia64@vger.kernel.org
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Sebastian Siewior <bigeasy@linutronix.de>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Tejun Heo <tj@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Len Brown <lenb@kernel.org>
Link: http://lkml.kernel.org/r/alpine.DEB.2.20.1704122251450.2548@nanos
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2017-04-15 12:20:53 +02:00
..
sn2 ia64/sn/hwperf: Replace racy task affinity logic 2017-04-15 12:20:53 +02:00
bte_error.c
bte.c [IA64] sn: Do not needlessly convert between pointers and integers 2014-07-29 16:28:15 -07:00
huberror.c [IA64] genirq fixup for SGI/SN 2012-02-22 11:11:06 -08:00
idle.c
io_acpi_init.c ia64/PCI: Remove unused 'addr' and fix build warning 2016-05-05 10:29:14 -07:00
io_common.c IA64: drivers: remove __dev* attributes. 2013-01-03 15:57:13 -08:00
io_init.c ia64/PCI: Fix incorrect PCI resource end address 2016-05-05 10:29:13 -07:00
iomv.c [IA64] Move include/asm-ia64 to arch/ia64/include/asm 2008-08-01 10:21:21 -07:00
irq.c ia64: Validate online cpus in irq_set_affinity() callbacks 2014-03-12 13:07:40 +01:00
klconflib.c
machvec.c
Makefile ia64: change to new flag variables 2011-03-17 14:02:56 +01:00
mca.c ia64: don't use module_init for non-modular core kernel/mca.c code 2015-06-16 14:12:30 -04:00
msi_sn.c ia64/irq: Use access helper irq_data_get_affinity_mask() 2015-07-27 13:36:37 +02:00
pio_phys.S
setup.c ia64: sn_nodepda cannot be assigned to after this_cpu conversion. Use __this_cpu_write. 2014-09-02 11:52:36 -04:00
tiocx.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00