arm64: factor work_pending state machine to C
authorChris Metcalf <cmetcalf@mellanox.com>
Thu, 14 Jul 2016 20:48:14 +0000 (16:48 -0400)
committerWill Deacon <will.deacon@arm.com>
Mon, 22 Aug 2016 09:00:48 +0000 (10:00 +0100)
commit421dd6fa6709ebee4f888ed89da5c103c77caee1
tree2ee670bc18f5fbe691906340c0a54b42f7f2635a
parent0a7d87a7776e2616334473c4209e277b6ca300e5
arm64: factor work_pending state machine to C

Currently ret_fast_syscall, work_pending, and ret_to_user form an ad-hoc
state machine that can be difficult to reason about due to duplicated
code and a large number of branch targets.

This patch factors the common logic out into the existing
do_notify_resume function, converting the code to C in the process,
making the code more legible.

This patch tries to closely mirror the existing behaviour while using
the usual C control flow primitives. As local_irq_{disable,enable} may
be instrumented, we balance exception entry (where we will almost most
likely enable IRQs) with a call to trace_hardirqs_on just before the
return to userspace.

Signed-off-by: Chris Metcalf <cmetcalf@mellanox.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/kernel/entry.S
arch/arm64/kernel/signal.c