x86/spec_ctrl: Fix several bugs in SPEC_CTRL_ENTRY_FROM_INTR_IST
Quoted 10 lines · 2018年2月14日 20:21于 Andrew Cooper <[email protected]>写道:
Quoted 7 lines · zhenzhong.duan
Quoted 4 lines
(quoted diff) +0
-0@@ -286,13 +286,13 @@setz %dl
and %dl, STACK_CPUINFO_FIELD(use_shadow_spec_ctrl)(%r14)Is it safe to remove the 'xor %edx, %edx' above? setz set whole byte 1 or 0.
Quoted 7 lines
It is safe, but it is not a good idea.
Using setz is an 8bit operation, which will suffer a register merge stall in the pipeline as we know for certain at this point that the upper bits of %edx are nonzero at this point. (An encoding which allowed setz %eax would have been far more useful in 64bit code.)
Thanks for explain. But just curious does processor has ideas the whole register is zeroed and avoid a merge?
thanks
zduan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 16 lines · zhenzhong.duan
2018年2月14日 20:21于 Andrew Cooper <[email protected]
Quoted 7 lines · <mailto:[email protected]>>写道:
Quoted 5 lines · zhenzhong.duan
Quoted 4 lines
(quoted diff) +0
-0@@ -286,13 +286,13 @@setz %dl
and %dl, STACK_CPUINFO_FIELD(use_shadow_spec_ctrl)(%r14)Is it safe to remove the 'xor %edx, %edx' above? setz set whole
byte 1
Quoted 5 lines
Quoted 2 lines
or 0.
It is safe, but it is not a good idea.
Quoted 8 lines
Quoted 5 lines
Using setz is an 8bit operation, which will suffer a register merge stall in the pipeline as we know for certain at this point that the upper bits of %edx are nonzero at this point. (An encoding which allowed setz %eax would have been far more useful in 64bit code.)
Thanks for explain. But just curious does processor has ideas the whole register is zeroed and avoid a merge?
Yes. See the Zeroing Idioms section in the optimisation manual. Tracking which registers are zero helps breaks read-after-write data dependences in the pipeline.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel