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

SignalDelegator: Refactor how thread local data is stored #3997

Merged

Conversation

Sonicadvance1
Copy link
Member

Two primary things here:

  • Remove the static GlobalDelegator
  • Move the thread_local SignalDelegator::ThreadState information directly in to ThreadStateObject

Having the ThreadStateObject and the SignalDelegator information disjoint was confusing but was required when we didn't have any object in the frontend that could have its own independent data. Since we fixed this with the ThreadStateObject type we can now move this over.

The GlobalDelegator object is now instead stored in ThreadStateObject instead.

Instead of using a thread_local variable, we now just consume 8-bytes of the signal alt-stack since the kernel gives us that information about where it lives. This then converts all the thread_local usage to use either the passed in CPU state if it exists, or fetching it from the alt-stack offset.

Very minor changes in behaviour here, will help when trying to improve FEX's behaviour around signals.

@Sonicadvance1 Sonicadvance1 force-pushed the refactor_signal_information branch 3 times, most recently from 4fb5c0c to 8214b8c Compare August 24, 2024 00:38
@alyssarosenzweig
Copy link
Collaborator

conflicts, needs a rebase

@Sonicadvance1 Sonicadvance1 force-pushed the refactor_signal_information branch from 8214b8c to a1ef6f4 Compare September 2, 2024 13:40
Two primary things here:
- Remove the static `GlobalDelegator`
- Move the thread_local SignalDelegator::ThreadState information
  directly in to ThreadStateObject

Having the ThreadStateObject and the SignalDelegator information
disjoint was confusing but was required when we didn't have any object
in the frontend that could have its own independent data. Since we fixed
this with the `ThreadStateObject` type we can now move this over.

The `GlobalDelegator` object is now instead stored in
`ThreadStateObject` instead.

Instead of using a thread_local variable, we now just consume 8-bytes of
the signal alt-stack since the kernel gives us that information about
where it lives. This then converts all the thread_local usage to use
either the passed in CPU state if it exists, or fetching it from the
alt-stack offset.

Very minor changes in behaviour here, will help when trying to improve
FEX's behaviour around signals.
@Sonicadvance1 Sonicadvance1 force-pushed the refactor_signal_information branch from a1ef6f4 to 9056d9b Compare September 2, 2024 13:46
@Sonicadvance1
Copy link
Member Author

rebossed, conflict resalved

@alyssarosenzweig alyssarosenzweig merged commit 114112a into FEX-Emu:main Sep 2, 2024
12 checks passed
@Sonicadvance1 Sonicadvance1 deleted the refactor_signal_information branch September 2, 2024 14:15
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 this pull request may close these issues.

2 participants