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

More crash fixes #17399

Merged
merged 11 commits into from
May 4, 2023
Merged

More crash fixes #17399

merged 11 commits into from
May 4, 2023

Conversation

hrydgard
Copy link
Owner

@hrydgard hrydgard commented May 3, 2023

Fix issues found looking at 1.15.1 reports, documented in #17364

@hrydgard hrydgard added this to the v1.15.2 milestone May 3, 2023
@hrydgard hrydgard force-pushed the more-crash-fixes branch from 117adef to 1d053d2 Compare May 3, 2023 21:49
@@ -819,6 +820,7 @@ void GPUCommonHW::FastRunLoop(DisplayList &list) {
if (flags & (FLAG_EXECUTE | FLAG_EXECUTEONCHANGE)) {
downcount = dc;
(this->*info.func)(op, diff);
// TODO: Check pc here, and break if invalid, as the func can change it. Might have a performance impact though.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd rather check it when modifying the PC, rather than after every func (which only a small % of them can change the PC.)

-[Unknown]

Copy link
Owner Author

Choose a reason for hiding this comment

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

Right, we're currently not even using the return value of the func, which would be cheap to check. So we could do the check inside where needed and return an error, which we could branch on here. Changing the todo.

@@ -365,7 +365,7 @@ class GameInfoWorkItem : public Task {
}

// In case of a remote file, check if it actually exists before locking.
if (!info_->GetFileLoader()->Exists()) {
if (!info_->GetFileLoader() || !info_->GetFileLoader()->Exists()) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hm. I think we now schedule these on multiple threads. There might be a race condition now where DisposeFileLoader() could be run by one thread while another is starting up for the very same file (i.e. with additional want flags.)

-[Unknown]

Copy link
Owner Author

Choose a reason for hiding this comment

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

Ah, that's a good catch, very likely what happens..

@hrydgard hrydgard merged commit 75521c3 into master May 4, 2023
@hrydgard hrydgard deleted the more-crash-fixes branch May 4, 2023 07:48
@@ -272,7 +272,9 @@ class PopupMultiChoiceDynamic : public PopupMultiChoice {

protected:
void PostChoiceCallback(int num) override {
*valueStr_ = choices_[num];
if (valueStr_) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hm, if anything I'd be worried about a lifetime issue, i.e. the std::string passed to PopupMultiChoiceDynamic could be dead and this could be a use-after-free if the callback somehow happens late.

-[Unknown]

@@ -62,6 +62,7 @@ class GPUCommonHW : public GPUCommon {

void Execute_TexFlush(u32 op, u32 diff);

// TODO: Have these return an error code if they jump to a bad address. If bad, stop the FastRunLoop.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Or just set gpuState = GPU_ERROR; and set downcount = 0; to force a recheck.

-[Unknown]

Copy link
Owner Author

Choose a reason for hiding this comment

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

Oh yeah, that's probably the slickest solution.

Copy link
Owner Author

@hrydgard hrydgard May 5, 2023

Choose a reason for hiding this comment

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

Actually it seems we already effectively do that in many cases through UpdateState. But not in fast memory mode.

I am going to remove Execute_JumpFast and Execute_CallFast. I don't believe they are worth it.

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