Skip to contentSkip to conversation

2.4.29 arch/i386/entry.S question

DISCUSSION Der Herr Hofrat 1 participant 1 message Jun 5, 2005

lore
Share & tools
lore
#0 lore raw

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