-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix some non-deterministic bugs. #638
Conversation
Periodically the PT hardware emits a PSB+ packet sequence. Each of these consists of: - A PSB packet. - other packets. - A PSBEnd packet. The Intel manual (Section 33.3.7) explains that the "other packets" are special and don't conform to the normal rules: > When a PSB packet is generated, it is followed by a PSBEND packet (Section > 33.4.2.18). One or more packets may be generated in between those two > packets, and these inform the decoder of the current state of the > processor. These packets, known collectively as PSB+, should be interpreted > as “status only”, since they do not imply any change of state at the time > of the PSB, nor are they associated directly with any instruction or event. > Thus, the normal binding and ordering rules that apply to these packets > outside of PSB+ can be ignored when these packets are between a PSB and > PSBEND. They inform the decoder of the state of the processor at the time > of the PSB. Our mistake was to allow target ip payloads in these "other packets" to update our decoder state, namely `self.cur_loc`. In some cases this would make it appear as though certain blocks were being re-executed in part. In turn this confused later parts of the JIT pipeline.
This looks fine to me, but let's put |
5a3d807 looks good? |
Works for me! Merge as-is? |
yup |
bors r+ |
Build failed: |
OK, so this is caused by new Rust. The -#![feature(once_cell)]
+#![feature(lazy_cell)] But this is scary:
Investigating... |
The loader has placed the embedded bitcode at an unaligned address! |
Yikes! |
It has probably always been this way, but Rust is now checking for misaligned pointer derefs it seems... It's not clear to me why there is an alignment requirement here. I thought that misaligned reads were valid on x86_64, but I may be wrong? I know sparc64 would outright crash... You will probably tell me it is UB I imagine :) |
I think "Rust the language" defines misaligned reads/writes as UB, no matter the underlying platform. [IMHO this is the correct definition: you don't want people to write code that will explode in weird ways on different platforms!] |
Here's a discussion I had on the Rust Zulip about this: And here's an issue about the error message not being quite right: |
The failures in this PR have been addressed separately in ykjit/ykllvm#60 and #639 |
bors r+ |
Build succeeded: |
This fixes our non-deterministic failures.
The first commit is the meat, the next commit raises a question I'd like to investigate next.
I have an idea why this is happening, but don't want to address it in this same PR.
(this was hard work :( )