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

SPU/LV2: Fix tiny race conditions #12678

Merged
merged 1 commit into from
Sep 21, 2022
Merged

SPU/LV2: Fix tiny race conditions #12678

merged 1 commit into from
Sep 21, 2022

Conversation

elad335
Copy link
Contributor

@elad335 elad335 commented Sep 18, 2022

Writing to VM memory while CPU wait flag is set is no laughing material, in this case, SPU reservation operations may eliminate these writes because they aren't tracked by the SPU in case they share a single byte or more of reservation data within the 128-byte cache line.

@@ -766,9 +765,9 @@ bool cpu_thread::check_state() noexcept
}
else
{
if (cpu_can_stop && !(flags & cpu_flag::wait))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block of code was not correct and could have set wait flag on emulation stopping even if we are inside of a function and need wait flag disabled (this can degrade savestates' accuracy for example). I've previously added wait flag after cpu_task() return which is the correct place for it.

Copy link
Contributor Author

@elad335 elad335 Sep 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It also used to set wait flag on function return (cpu_flag::ret) which is incorrect either.

@elad335 elad335 force-pushed the cpu-time branch 3 times, most recently from 2b1da86 to 92475ed Compare September 18, 2022 18:39
@Nekotekina Nekotekina merged commit 194f737 into RPCS3:master Sep 21, 2022
elad335 added a commit to elad335/rpcs3 that referenced this pull request Sep 21, 2022
Nekotekina pushed a commit that referenced this pull request Sep 21, 2022
* sys_ppu_thread: Fix surmixer hack

* Hotfix after #12678
@TheGuitarHeroNerd
Copy link

@elad335 for some reason something in this pull request has broken the caching/streamed files in GHL.

Here is a post with more information.

#12745

No idea if it's having issues to where it's like locking up something causing the game to lag, or issues with writing, or memory.

I'd be grateful if you could look into it again since i have plans to release my server for the game at some point this year but sadly this issue likely makes it so i can't release the server for the game.

Thanks.

@halvors
Copy link

halvors commented Oct 8, 2022

@elad335 Do you have any idea why this is breaking other games? They works on real PS3 hardware but after this patch not with RPCS3.

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.

4 participants