Skip to content
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

JIT: consider locking Goroutine thread until JIT exits #153

Closed
mathetake opened this issue Jan 21, 2022 · 2 comments · Fixed by #957
Closed

JIT: consider locking Goroutine thread until JIT exits #153

mathetake opened this issue Jan 21, 2022 · 2 comments · Fixed by #957

Comments

@mathetake
Copy link
Member

mathetake commented Jan 21, 2022

We could use runtime.LockOSThread() to block Goruntime from switching the goroutine via async preemption which can happen at any point of execution.

Even though we've tested the JIT execution is stable without locking (as in jit/engine_test.go ), there might be still some condition where the JIT would fail.

This needs more through investigation on how Goroutine saves CPU registers when switches happens (at source code level), and more test cases to ensure whether or not we need thread blocking via LockOSThread.

@CannibalVox
Copy link

Be aware that parking/unparking threads under runtime.LockOSThread() seems to cause context switches golang/go#21827

I suspect that locking will also cause context switches on any goroutine that have accumulated on the M in question since the last time it was locked, but I could be wrong about this.

@mathetake
Copy link
Member Author

@CannibalVox thanks for the info!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants