Skip to contentSkip to conversation

Intel P6 vs P7 system call performance

DISCUSSION [email protected] 2 participants 2 messages Dec 18, 2002 – Dec 19, 2002

lore
Share & tools
lore
#0 lore raw
Quoted 7 lines · Richard B. Johnson

The number of CPU clocks necessary to make the 'far' or full-pointer call by pushing the segment register, the offset, then issuing a 'lret' is 33 clocks on a Pentium II.

longcall clocks = 46
call clocks = 13
actual full-pointer call clocks = 33

this is not correct. the assumed target (of a _far_ call) would issue a far return and only an offset would be left on the stack to return to (oops). the code segment of the orginal caller needs pushed to create the seg:off pair and hence a far return would land back at the original calling routine. this is a very convoluted method of making the orginal call being far, as simply calling far in the first pace should issue much faster. OTOH, if you are making a workaround to an already existing piece of code, this works beautifully (with the additional seg pushed on the stack).

b.

#1 lore raw
Quoted 9 lines · On Wed, 18 Dec 2002 [email protected] wrote:
Quoted 7 lines · Richard B. Johnson

The number of CPU clocks necessary to make the 'far' or full-pointer call by pushing the segment register, the offset, then issuing a 'lret' is 33 clocks on a Pentium II.

longcall clocks = 46
call clocks = 13
actual full-pointer call clocks = 33

Quoted 9 lines

this is not correct. the assumed target (of a _far_ call) would issue a far return and only an offset would be left on the stack to return to (oops). the code segment of the orginal caller needs pushed to create the seg:off pair and hence a far return would land back at the original calling routine. this is a very convoluted method of making the orginal call being far, as simply calling far in the first pace should issue much faster. OTOH, if you are making a workaround to an already existing piece of code, this works beautifully (with the additional seg pushed on the stack).

The target, i.e., the label 'goto' would be the reserved page for the system call. The whole purpose was to minimize the number of CPU cycles necessary to call 0xfffff000 and return. The system call does not have issue a 'far' return, it can do anything it requires. The page at 0xfffff000 is mapped into every process and is in that process CS space already.

I have already gotten responses from people who looked at the code and said it was broken. It is not broken. It does what is expected. It takes the same number of CPU cycles as:

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

... which is the current proposal. It has the advantage that only the return address is on the stack when the target code is executed.

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.