2.4.29 arch/i386/entry.S question

From: Der Herr Hofrat
Date: Sun Jun 05 2005 - 03:02:13 EST




Hi !

Kernel 2.4.29 (unpatched)
Arch i386

I'm trying to understand the details of what is going on here. As I
understand this, the cli/sti braces are intended for atomicity of
need_resched and signals, but what does the comment at the sti them mean ?
can one get to signal_return without entering at ret_from_sys_call ?
I assumed the sti is just balancing the cli - woong ?

arch/i386/kernel/entry.S:

ENTRY(ret_from_sys_call)
cli # need_resched and signals atomic test
cmpl $0,need_resched(%ebx)
jne reschedule
cmpl $0,sigpending(%ebx)
jne signal_return
restore_all:
RESTORE_ALL

ALIGN
signal_return:
sti # we can get here from an interrupt handler

Also if need_resched and sigpending were not handled atomically, that is if
one removes the cli/sti - would that actually break anything ? It seems that
it could be inefficient as one would reschedule in cases without this
being necessary, and could call do_signal without that it is needed, or is
there more to it ? I removed the cli/sti and rebuilt the system, but could
not find any imediate problems (which off course does not really say much
yet).

thx !
hofrat
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/