exynos-linux-stable/include
Sebastian Andrzej Siewior e81cff1ced crypto: mcryptd - protect the per-CPU queue with a lock
commit 9abffc6f2efe46c3564c04312e52e07622d40e51 upstream.

mcryptd_enqueue_request() grabs the per-CPU queue struct and protects
access to it with disabled preemption. Then it schedules a worker on the
same CPU. The worker in mcryptd_queue_worker() guards access to the same
per-CPU variable with disabled preemption.

If we take CPU-hotplug into account then it is possible that between
queue_work_on() and the actual invocation of the worker the CPU goes
down and the worker will be scheduled on _another_ CPU. And here the
preempt_disable() protection does not work anymore. The easiest thing is
to add a spin_lock() to guard access to the list.

Another detail: mcryptd_queue_worker() is not processing more than
MCRYPTD_BATCH invocation in a row. If there are still items left, then
it will invoke queue_work() to proceed with more later. *I* would
suggest to simply drop that check because it does not use a system
workqueue and the workqueue is already marked as "CPU_INTENSIVE". And if
preemption is required then the scheduler should do it.
However if queue_work() is used then the work item is marked as CPU
unbound. That means it will try to run on the local CPU but it may run
on another CPU as well. Especially with CONFIG_DEBUG_WQ_FORCE_RR_CPU=y.
Again, the preempt_disable() won't work here but lock which was
introduced will help.
In order to keep work-item on the local CPU (and avoid RR) I changed it
to queue_work_on().

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-29 17:42:58 +01:00
..
acpi ACPICA: Linuxize: Restore and fix Intel compiler build 2017-02-26 11:10:52 +01:00
asm-generic percpu: make this_cpu_generic_read() atomic w.r.t. interrupts 2017-10-12 11:51:23 +02:00
clocksource
crypto crypto: mcryptd - protect the per-CPU queue with a lock 2017-12-29 17:42:58 +01:00
drm drm: Don't race connector registration 2017-06-17 06:41:53 +02:00
dt-bindings ARM: dts: Fix omap3 off mode pull defines 2017-11-21 09:23:22 +01:00
keys
kvm
linux bpf: fix branch pruning logic 2017-12-25 14:23:47 +01:00
math-emu
media Linux 4.8 2016-10-05 16:43:53 -03:00
memory
misc
net vhost-vsock: add pkt cancel capability 2017-12-25 14:23:37 +01:00
pcmcia
ras
rdma IB/core: Fix calculation of maximum RoCE MTU 2017-12-20 10:07:32 +01:00
rxrpc
scsi scsi: libsas: align sata_device's rps_resp on a cacheline 2017-12-14 09:28:11 +01:00
soc ARM: at91: define LPDDR types 2017-03-12 06:41:41 +01:00
sound ALSA: seq: Avoid invalid lockdep class warning 2017-11-15 15:53:18 +01:00
target target: fix ALUA transition timeout handling 2017-12-20 10:07:26 +01:00
trace SUNRPC: Fix tracepoint storage issues with svc_recv and svc_rqst_status 2017-11-30 08:39:07 +00:00
uapi usb: add helper to extract bits 12:11 of wMaxPacketSize 2017-12-20 10:07:16 +01:00
video fbdev changes for 4.9 2016-10-12 11:01:37 -07:00
xen swiotlb-xen: implement xen_swiotlb_dma_mmap callback 2017-10-05 09:44:05 +02:00
Kbuild