[Skiboot] [PATCH] asm/head: balance branches to avoid link stack predictor mispredicts
Stewart Smith
stewart at linux.ibm.com
Wed Apr 17 17:39:46 AEST 2019
Nicholas Piggin <npiggin at gmail.com> writes:
> The Linux wrapper for OPAL call and return is arranged like this:
>
> __opal_call:
> mflr r0
> std r0,PPC_STK_LROFF(r1)
> LOAD_REG_ADDR(r11, opal_return)
> mtlr r11
> hrfid -> OPAL
>
> opal_return:
> ld r0,PPC_STK_LROFF(r1)
> mtlr r0
> blr
>
> When skiboot returns to Linux, it branches to LR (i.e., opal_return)
> with a blr. This unbalances the link stack predictor and will cause
> mispredicts back up the return stack.
Okay, wow. Also, cool. I'm guessing you spent some time with instruction
traces. Merged to master as of 32a23ae6b0d3549bec7338e439e504db263dc390
I also now feel even worse about the multiple seconds that can be spent
in some OPAL calls in pathalogical cases.
--
Stewart Smith
OPAL Architect, IBM.
More information about the Skiboot
mailing list