avr32: deal with double restarts
PATCH 6/6 avr32: deal with double restarts
a) take handling of reschedule, signals and keychains into a new helper - work_pending(). All looping is done there now; asm glue calls that if we have anything for it to do.
b) do_signal() gets explicit "may restart" flag as an argument; after the first call during that loop it gets unconditional 0.
c) sigreturn() sets a thread flag - TIF_NORESTART. It is included into the "work_pending() has something to do" mask. work_pending() clears it, clearing its may_restart flag if it had done so.
--- arch/avr32/include/asm/thread_info.h | 3 ++ arch/avr32/kernel/entry-avr32b.S | 45 ++++------------------------ arch/avr32/kernel/signal.c | 55 ++++++++++++++++++++++++---------- 3 files changed, 48 insertions(+), 55 deletions(-)
arch/avr32/include/asm/thread_info.h +3 -0
@@ -85,6 +85,7 @@ static inline struct thread_info *current_thread_info(void)#define TIF_RESTORE_SIGMASK 7/* restore signal mask in do_signal */ #define TIF_CPU_GOING_TO_SLEEP 8/* CPU is entering sleep 0 mode */ #define TIF_NOTIFY_RESUME 9/* callback before returning to user */ +#define TIF_NORESTART 10#define TIF_FREEZE 29#define TIF_DEBUG 30/* debugging enabled */ #define TIF_USERSPACE 31/* true if FS sets userspace */
@@ -98,6 +99,7 @@ static inline struct thread_info *current_thread_info(void)#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)#define _TIF_CPU_GOING_TO_SLEEP (1 << TIF_CPU_GOING_TO_SLEEP)#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) +#define _TIF_NORESTART (1 << TIF_NORESTART)#define _TIF_FREEZE (1 << TIF_FREEZE)/* Note: The masks below must never span more than 16 bits! */
@@ -106,6 +108,7 @@ static inline struct thread_info *current_thread_info(void)#define _TIF_WORK_MASK \ ((1 << TIF_SIGPENDING) \ | _TIF_NOTIFY_RESUME \ + | _TIF_NORESTART \ | (1 << TIF_NEED_RESCHED) \ | (1 << TIF_POLLING_NRFLAG) \ | (1 << TIF_BREAKPOINT) \
arch/avr32/kernel/entry-avr32b.S +6 -39
63 lines not on this page · raw message
arch/avr32/kernel/signal.c +39 -16
79 lines not on this page · raw message
Signature · 1 line
1.5.6.5
On Wed, 2010-12-15 at 10:39 +0000, Al Viro wrote:
Hi Al,
Quoted 10 lines
a) take handling of reschedule, signals and keychains into a new helper -
work_pending(). All looping is done there now; asm glue calls that if we have anything for it to do.b)
do_signal()gets explicit "may restart" flag as an argument; after the first call during that loop it gets unconditional 0.c)
sigreturn()sets a thread flag -TIF_NORESTART. It is included into the "work_pending()has something to do" mask.work_pending()clears it, clearing itsmay_restartflag if it had done so.
Testing this patch series on top of the latest kernel release it bombs out quite early with a
Bus error at physical address 0x6c6110e4 (read access) DTLB dump:
(...)
Do you have any additional information I might have overlooked? On what hardware and how have you tested this?
<snipp patch>
arch/avr32/kernel/signal.c static void do_signal(struct pt_regs *regs, int syscall) · line 320
Quoted 2 lines
arch/avr32/kernel/signal.c +1
-1-asmlinkage void do_notify_resume(struct pt_regs *regs, struct thread_info *ti) +asmlinkage int work_pending(struct pt_regs *regs, struct thread_info *ti, int may_restart)
This line could be broken into two lines be within width limits, and in addition the work_pending name conflicts with the work_pending macro in workqueue.h.
<snipp>
Signature · 1 line
Hans-Christian Egtvedt