lkml.org 
[lkml]   [2012]   [Dec]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH v1 11/31] ARC: Low level IRQ/Trap/Exception(non-MMU) Handling
On Thursday 27 December 2012 02:30 PM, Vineet Gupta wrote:
> On Friday 16 November 2012 10:28 AM, Al Viro wrote:
>>> + ; --------- 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.


\
 
 \ /
  Last update: 2012-12-27 15:01    [W:0.168 / U:2.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site