]> git.hungrycats.org Git - linux/commit
cxl: Change contexts_lock to a mutex to fix sleep while atomic bug
authorIan Munsie <imunsie@au1.ibm.com>
Mon, 8 Dec 2014 08:17:55 +0000 (19:17 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 27 Jan 2015 16:29:36 +0000 (08:29 -0800)
commitd4a26d119b968328e0b039a00520e08cd862962a
tree15bfaf43d5fb7f38bd0a2455385e644c7a54f045
parent70819eaa82553959d226749ff06db808fe2ef2cc
cxl: Change contexts_lock to a mutex to fix sleep while atomic bug

commit ee41d11d53c8fc4968f0816504651541d606cf40 upstream.

We had a known sleep while atomic bug if a CXL device was forcefully
unbound while it was in use. This could occur as a result of EEH, or
manually induced with something like this while the device was in use:

echo 0000:01:00.0 > /sys/bus/pci/drivers/cxl-pci/unbind

The issue was that in this code path we iterated over each context and
forcefully detached it with the contexts_lock spin lock held, however
the detach also needed to take the spu_mutex, and call schedule.

This patch changes the contexts_lock to a mutex so that we are not in
atomic context while doing the detach, thereby avoiding the sleep while
atomic.

Also delete the related TODO comment, which suggested an alternate
solution which turned out to not be workable.

Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/cxl/context.c
drivers/misc/cxl/cxl.h
drivers/misc/cxl/native.c
drivers/misc/cxl/pci.c
drivers/misc/cxl/sysfs.c