On Tue, Apr 15, 2025, Andrew Cooper wrote:
On 11/04/2025 10:40 pm, Sean Christopherson wrote:
On Thu, Apr 10, 2025, Ross Philipson wrote:
+ * instruction can return for a number of reasons. Test to see if it returnedWhy load the value into EDX? At a glance, the value is never consumed.
+ * because the monitor was written to.
+ */
+ monitor
+
+1:
+ mfence
+ mwait
+ movl (%eax), %edx
+ testl %edx, %edxThis usage of MONITOR/MWAIT is flawed. The monitor needs to be re-armed in each
+ jz 1b
loop, otherwise mwait will be a glorified nop.
More importantly, the exit condition needs to be checked before monitor,
after monitor and before mwait.
Gah, yeah, I mean to say "before mwait".