VMPI Spin-loop hint for x86

RESOLVED FIXED

Status

Tamarin
Virtual Machine
RESOLVED FIXED
7 years ago
7 years ago

People

(Reporter: Simon Wilkinson, Unassigned)

Tracking

(Blocks: 1 bug)

Details

Attachments

(1 attachment, 2 obsolete attachments)

(Reporter)

Description

7 years ago
Created attachment 500842 [details] [diff] [review]
Initial Patch

Certain processors (namely, Intel Pentium 4's and Xeons) require the insertion of a PAUSE instruction in spin-wait loops to reduce observed memory ordering violations.

The attached patch extends VMPI to provide a PAUSE intrinsic for x86 platforms. (It is a NO-OP for non-x86 platforms and is ignored by x86 processors that do not require it.)

See:
Intel 64 and IA-32 Architectures Software Developer's Manual Volume 2B 4-71
(Reporter)

Updated

7 years ago
Blocks: 562687
(Reporter)

Updated

7 years ago
Blocks: 575544
(Reporter)

Updated

7 years ago
Attachment #500842 - Attachment is patch: true
Attachment #500842 - Attachment mime type: application/octet-stream → text/plain
(Reporter)

Updated

7 years ago
Attachment #500842 - Flags: superreview?(edwsmith)
Attachment #500842 - Flags: review?(kpalacz)

Comment 1

7 years ago
Comment on attachment 500842 [details] [diff] [review]
Initial Patch

Looks good to me, FWIW.

The description in the comment seems to imply that the memory ordering violations would have been observable to application code and the extra instruction is needed for correctness. My understanding is that the processor would recover from a violation with or without an extra instruction, but the instruction can help avoid a costly recovery and helps with performance. Clarification?
Attachment #500842 - Flags: review?(kpalacz) → review+
(Reporter)

Comment 2

7 years ago
(In reply to comment #1)
> Comment on attachment 500842 [details] [diff] [review]
> Initial Patch
> 
> Looks good to me, FWIW.
> 
> The description in the comment seems to imply that the memory ordering
> violations would have been observable to application code and the extra
> instruction is needed for correctness. My understanding is that the processor
> would recover from a violation with or without an extra instruction, but the
> instruction can help avoid a costly recovery and helps with performance.
> Clarification?

Yes, this is just a hint to the processor. There is nothing observable to application code.

The docs are misleading in this regard. I'll change them.

Updated

7 years ago
Attachment #500842 - Flags: superreview?(edwsmith) → superreview+
(Reporter)

Comment 3

7 years ago
Created attachment 514934 [details] [diff] [review]
Revised docs. MQ rev 241
Attachment #500842 - Attachment is obsolete: true
(Reporter)

Comment 4

7 years ago
Created attachment 515117 [details] [diff] [review]
Rebased. MQ rev 247
Attachment #514934 - Attachment is obsolete: true

Comment 5

7 years ago
changeset: 6004:6c6da1aa0104
user:      Simon Wilkinson <siwilkin>
summary:   Bug 622608: Adds VMPI_spinloopPause() (r=kpalacz, sr=edwsmith).

http://hg.mozilla.org/tamarin-redux/rev/6c6da1aa0104
(Reporter)

Updated

7 years ago
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.