[Skiboot] [PATCH] asm/head: balance branches to avoid link stack predictor mispredicts
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:
> mflr r0
> std r0,PPC_STK_LROFF(r1)
> LOAD_REG_ADDR(r11, opal_return)
> mtlr r11
> hrfid -> OPAL
> ld r0,PPC_STK_LROFF(r1)
> mtlr r0
> 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.
OPAL Architect, IBM.
More information about the Skiboot