Skip to content

Linux regression due to userfaultfd change #1704

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

Closed
kalaposfos13 opened this issue Dec 8, 2024 · 11 comments
Closed

Linux regression due to userfaultfd change #1704

kalaposfos13 opened this issue Dec 8, 2024 · 11 comments
Labels

Comments

@kalaposfos13
Copy link
Member

#1640 has introduced enabling userfaultfd by default (and this commit added the ability to run it in user mode), which breaks basically my entire library of games on Linux Mint (games I tested that were previously working: Bloodborne, Minecraft, Gravity Rush Remastered, NieR: Automata and TLG (from splash screen to nothing)) , causing them to hang either indefinitely or just "only" so much that I didn't have the patience to wait it out (meaning more than 1 minute). Bloodborne sometimes also crashes here: [Debug] <Critical> signals.cpp:SignalHandler:85: Unreachable code! Unhandled access violation in thread 'FMOD mixer thre' at code address 0x7f14c952725d: Read from address 0x0
Commenting this line out to disable the change solves all related problems from happening.

@setepenre
Copy link
Contributor

setepenre commented Dec 8, 2024

Can confirm, have to comment out said line before compiling to load in game bloodborne ; am running arch linux on intel cpu + nvidia gpu desktop.
I guess it would be great if userfaultfd could be enabled or disable with a flag when first calling cmake.
EDIT:
something like

if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND ENABLE_USERFAULTFD)
    target_compile_definitions(shadps4 PRIVATE ENABLE_USERFAULTFD)
endif()

with cmake ... -DENABLE_USERFAULTFS=ON/OFF ... seems to work on my end

EDIT after #1704 (comment):
My desktop manager uses X11, unset $DISPLAY disallow sdl to open a windows ending up in an exception

@C0rn3j
Copy link
Contributor

C0rn3j commented Dec 8, 2024

@setepenre no such issues here with Arch + Nvidia with AUR/shadps4-git on 4fb2247, odd.

Both GOTY and non-GOTY BB launches fine as long as $DISPLAY is unset.

image

EDIT: Latest master works fine too (fea2593)

EDIT2: While the game LAUNCHES, it freezes in character creator

EDIT3: This seems to make an existing freezing issue more prominent but is not necessarily the cause of it.

@7oxicshadow
Copy link

Can confirm that this build flag breaks Bloodborne for me.
image

@ikmjssc
Copy link

ikmjssc commented Dec 9, 2024

x11 having this issue too

@knewman23
Copy link

Following for updates, same issue on steam deck

@Shoegzer
Copy link

Shoegzer commented Dec 13, 2024

Confirmed here too, Linux Mint 22 and X11.

Unfortunately, commenting out this line as suggested above does not fix this issue.

Update: Fully resolved with #1777.

@zt64
Copy link

zt64 commented Dec 13, 2024

On Nvidia proprietary driver 565.77 on Wayland what worked for me was env -u DISPLAY shadps4

@ikmjssc
Copy link

ikmjssc commented Dec 14, 2024

commenting out that line worked for me on X11, but wayland still need to unset the DISPLAY variable.
btw beware if (kde)screen scale is larger than 1.00x every fullscreen app will be smaller than the actual screen size by default

@C0rn3j
Copy link
Contributor

C0rn3j commented Dec 22, 2024

The PR that makes userfaultfd opt-in has been merged, but for those that userfaultfd was causing crashes and not freezes, it would be nice if you posted a stack trace in here.

One can enable userfaultfd support during compile time via -DENABLE_USERFAULTFD=ON now.

@kavika13
Copy link

kavika13 commented Dec 22, 2024

I am getting the freeze as well. It isn't Wayland specific. But I am also using KDE.

image

nVidia driver is 565.77.

If I CTRL + Z on the console to put the process in the background, then fg to activate the process again, it gets unstuck.

This seems like a pretty useful thing to solve. I am getting MUCH better performance in the beginning of the Bloodborne DLC with userfaultfd enabled (notably the area with the worst performance in the game, as far as I've seen).

Edit: Here's a dump of the current threads, mixed with the GDB session log, and the emulator log (gdb shadps4 -> run -> load my saved game that usually hangs, and it hangs this time -> wait for a bit to see if it unhangs, which it doesn't -> see some [Thread 0x7fffa1ffb6c0 (LWP 254988) exited] type messages -> hit CTRL + C, type thread apply all bt):

gdb_log.txt

@kalaposfos13
Copy link
Member Author

#1777 disabled this, so this problem is now temporarily solved, but ideally the devs will figure out the issue with the implementation and userfaultfd will be reintruduced without the current problem.

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

No branches or pull requests

10 participants