Thread (103 messages) 103 messages, 10 authors, 2013-03-11

Re: [RFC PATCH v1 11/31] ARC: Low level IRQ/Trap/Exception(non-MMU) Handling

From: Vineet Gupta <hidden>
Date: 2012-12-27 13:30:03
Also in: lkml

On Thursday 27 December 2012 02:30 PM, Vineet Gupta wrote:
On Friday 16 November 2012 10:28 AM, Al Viro wrote:
quoted
quoted
+	; --------- check for signals/restore-sigmask ------------
+	bbit0  r9, TIF_SIGPENDING, chk_next_work
+
+	; save CALLEE Regs.
+	; (i)  If this signal causes coredump - full regfile needed
+	; (ii) If signal is SIGTRAP/SIGSTOP, task is being traced thus
+	;      tracer might call PEEKUSR for a CALLEE reg
+	;
+	; NOTE: SP will grow up by size of CALLEE Reg-File
+	SAVE_CALLEE_SAVED_USER		; clobbers r12
+
+	; save location of saved Callee Regs @ thread_struct->callee
+	GET_CURR_TASK_FIELD_PTR   TASK_THREAD, r10
+	st  sp, [r10, THREAD_CALLEE_REG]
+
+	bl  @do_signal
+
+	; unwind SP for cheap discard of Callee saved Regs
+	DISCARD_CALLEE_SAVED_USER
Uh-oh...  And what if tracer wanted to modify callee-saved regs?
So the solution would be to either unconditionally restore all the 13 callee regs
- or add additional state (struct thread) where ptrace makes a note that it wrote
to a callee reg which is used here to conditional-ize the restore. Former is
simpler to do - although it might ill-affect micro-benchmarks such as LMBench
lat_sig. Anyhow correctness comes before optimization.
Havign coded above, I just couldn't accept the anti-optimization here. Is it
absolute sin to take a look at current->ptrace != 0 in deciding whether to
save/restore the regs. However that won't work for coredump case.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help