linux/drivers/misc/sgi-xp
Thomas Gleixner 997754f114 misc/sgi-xp: Replace in_interrupt() usage
The usage of in_interrupt() in xpc_partition_disengaged() is clearly
intended to avoid canceling the timeout timer when the function is invoked
from the timer callback.

While in_interrupt() is deprecated and ill defined as it does not provide
what the name suggests it catches the intended case.

Add an argument to xpc_partition_disengaged() which is true if called
from timer and otherwise false.
Use del_timer_sync() instead of del_singleshot_timer_sync() which is the
same thing.

Note: This does not prevent reentrancy into the function as the function
has no concurrency control and timer callback and regular task context
callers can happen concurrently on different CPUs or the timer can
interrupt the task context before it is able to cancel it.

While the only driver which is providing the arch_xpc_ops callbacks
(xpc_uv) seems not to have a reentrancy problem and the only negative
effect would be a double dev_info() entry in dmesg, the whole mechanism is
conceptually broken.

But that's not subject of this cleanup endeavour and left as an exercise to
the folks who might have interest to make that code fully correct.

[bigeasy: Add the argument, use del_timer_sync().]

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Cliff Whickman <cpw@sgi.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Robin Holt <robinmholt@gmail.com>
Cc: Steve Wahl <steve.wahl@hpe.com>
Cc: Dimitri Sivanich <dimitri.sivanich@hpe.com>
Cc: Russ Anderson <russ.anderson@hpe.com>
Reviewed-by: Steve Wahl <steve.wahl@hpe.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Link: https://lore.kernel.org/r/20201119103151.ppo45mj53ulbxjx4@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-12-09 19:35:52 +01:00
..
Makefile misc/sgi-xp: remove SGI SN2 support 2019-08-16 11:33:56 -07:00
xp.h x86/platform/uv: Update Copyrights to conform to HPE standards 2020-10-07 09:10:07 +02:00
xp_main.c x86/platform/uv: Update Copyrights to conform to HPE standards 2020-10-07 09:10:07 +02:00
xp_uv.c x86/platform/uv: Update Copyrights to conform to HPE standards 2020-10-07 09:10:07 +02:00
xpc.h misc/sgi-xp: Replace in_interrupt() usage 2020-12-09 19:35:52 +01:00
xpc_channel.c sgi-xp: Replace spin_is_locked() with lockdep 2018-10-15 20:54:17 +02:00
xpc_main.c misc/sgi-xp: Replace in_interrupt() usage 2020-12-09 19:35:52 +01:00
xpc_partition.c misc/sgi-xp: Replace in_interrupt() usage 2020-12-09 19:35:52 +01:00
xpc_uv.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
xpnet.c x86/platform/uv: Update Copyrights to conform to HPE standards 2020-10-07 09:10:07 +02:00