Skip to contentSkip to conversation

Intel P6 vs P7 system call performance

DISCUSSION Manfred Spraul 3 participants 4 messages Dec 17, 2002

lore
Share & tools
lore
#0 lore raw
Quoted 8 lines

pushl %ebp
movl $0xfffff000, %ebp
call *%ebp
popl %ebp

You could avoid clobbering a register with something like

pushl $0xfffff000
call *(%esp)
addl %esp,4

--
Manfred

#1 lore raw
Quoted 9 lines · Manfred Spraul
Quoted 8 lines

pushl %ebp
movl $0xfffff000, %ebp
call *%ebp
popl %ebp

Quoted 6 lines

You could avoid clobbering a register with something like

pushl $0xfffff000
call *(%esp)
addl %esp,4

This is a near 'call'.

	pushl $0xfffff000
	ret

This is a 'far' 'call' that I think you will need to reload the segment back to user-mode segments on the return.

	pushl	$KERNEL_CS
	pushl	$0xfffff000
	lret

Cheers,
Dick Johnson
Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips). Why is the government concerned about the lunatic fringe? Think about it.

#2 lore raw
Quoted 18 lines · Richard B. Johnson
Quoted 9 lines · Manfred Spraul
Quoted 8 lines

pushl %ebp
movl $0xfffff000, %ebp
call *%ebp
popl %ebp

Quoted 6 lines

You could avoid clobbering a register with something like

pushl $0xfffff000
call *(%esp)
addl %esp,4

Quoted 5 lines

This is a near 'call'.

	pushl $0xfffff000
	ret

I hate answering my own stuff......... This gets back and modifies no registers.

Actually I should be:

	pushl	$next_address	# Where to go when the call returns
	pushl	$0xfffff000	# Put this on the stack
	ret			# 'Return' to it (jump)

next_address: # Were we end up after

Cheers,
Dick Johnson
Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips). Why is the government concerned about the lunatic fringe? Think about it.

#3 lore raw
Quoted 6 lines · Richard B. Johnson

Actually I should be:

	pushl	$next_address	# Where to go when the call returns
	pushl	$0xfffff000	# Put this on the stack
	ret			# 'Return' to it (jump)

next_address: # Were we end up after

You just killed that process' performance by causing the return-stack branch prediction buffer to go out of sync.

It might have worked ok on a 486, but P6+ don't like it one bit.

This is also why I'm slightly unhappy about the
s/int $0x80/call <address of sysenter>/ approach, since it leads to yet another recursion level and risk overflowing the RSB.