Linux support: guest-thread scheduling, pthread sync, and GC fail-fast fixes#92
Closed
Spooks4576 wants to merge 5 commits into
Closed
Linux support: guest-thread scheduling, pthread sync, and GC fail-fast fixes#92Spooks4576 wants to merge 5 commits into
Spooks4576 wants to merge 5 commits into
Conversation
- Dispatch Ready guest threads promptly: pump on wake and add a 1ms dispatcher; make the pump reentrancy guard an interlocked CAS. - cond_wait now fully releases recursive mutexes and restores depth. - rwlock compat writers are exclusive with writer preference. - Self-lock on NORMAL/ADAPTIVE_NP mutexes blocks instead of nesting. - scePlayGoOpen no longer fails when the title ships no PlayGo metadata. - Report sync-object state and per-thread wait keys in stall dumps.
TryReadWideCString allocated its 1 MiB ceiling up front, putting a 2 MB array on the LOH for every vswprintf call. The GC that forced could not walk a guest thread's hijacked stack, so the runtime fail-fasted with a misleading "UnmanagedCallersOnly" error. Measure the string first, then allocate exactly its length. Warm Silk.NET and framework type initializers on the host thread so a guest thread is never the first to run a .cctor. Yield in the presenter when there is nothing to present: vkQueuePresentKHR is the only throttle on the window loop, so an empty RenderCore pegged a core and starved the guest threads it was waiting on. Also trace why a presentation is withheld, to chase the blank window.
The upstream native worker calls kernel32 through GetModuleHandle/ GetProcAddress, which this fork renamed to WindowsGetModuleHandle/ WindowsGetProcAddress for the Linux port. Point it at the renamed imports and short-circuit the lookup off Windows, where kernel32 is unresolvable.
Contributor
|
Could you post a screenshot of it working on Linux? |
Author
i will do so soon right now this is a step in the right direction towards Linux support |
Owner
Author
Author
|
Build Broke Something will wait on the other Linux Support Branch PR before giving my other changes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Brings the emulator up on Linux and fixes several runtime crashes that
blocked titles from reaching the Vulkan presenter.
Linux platform support
PhysicalVirtualMemoryworks off Windows.short-circuit the kernel32-only native worker off Windows.
Guest-thread scheduling and pthread semantics
resolves to one state, and correct rwlock/condvar wake-key handling.
GC fail-fast on guest threads
Guest threads execute managed HLE on a hijacked stack that the GC cannot
walk, so any collection landing mid-export fail-fasts the runtime with a
misleading "attempted to call an UnmanagedCallersOnly method from managed
code" error.
TryReadWideCStringwas the reliable trigger: it allocated its 1 MiBceiling up front, putting a 2 MB array on the Large Object Heap for every
vswprintfcall, and an LOH allocation forces a GC. It now measures thestring first and allocates exactly its length. Type initializers for the
Silk.NET and framework assemblies are also warmed on the host thread, so a
guest thread is never the first to run a
.cctor.Presenter
vkQueuePresentKHRis the only throttle on the window loop, so aRenderCorewith nothing to present spun the callback flat out, pegging acore and starving the guest threads it was waiting on. It now yields.