[GH-ISSUE #1704] Linux regression due to userfaultfd change #584

Closed
opened 2026-02-27 21:07:02 +03:00 by kerem · 11 comments
Owner

Originally created by @kalaposfos13 on GitHub (Dec 8, 2024).
Original GitHub issue: https://github.com/shadps4-emu/shadPS4/issues/1704

https://github.com/shadps4-emu/shadPS4/pull/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.

Originally created by @kalaposfos13 on GitHub (Dec 8, 2024). Original GitHub issue: https://github.com/shadps4-emu/shadPS4/issues/1704 https://github.com/shadps4-emu/shadPS4/pull/1640 has introduced enabling userfaultfd by default (and [this commit](https://github.com/shadps4-emu/shadPS4/commit/8ee672fe32702b232728ae193abf57d9468b5de1) 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]( https://github.com/shadps4-emu/shadPS4/blob/4fb2247196d4626bab8f2c28710b0c34cad053fe/CMakeLists.txt#L886) out to disable the change solves all related problems from happening.
kerem 2026-02-27 21:07:02 +03:00
  • closed this issue
  • added the
    linux
    label
Author
Owner

@setepenre commented on GitHub (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 https://github.com/shadps4-emu/shadPS4/issues/1704#issuecomment-2529377695:
My desktop manager uses X11, unset $DISPLAY disallow sdl to open a windows ending up in an exception

<!-- gh-comment-id:2526263846 --> @setepenre commented on GitHub (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 https://github.com/shadps4-emu/shadPS4/issues/1704#issuecomment-2529377695: My desktop manager uses X11, unset $DISPLAY disallow sdl to open a windows ending up in an exception
Author
Owner

@C0rn3j commented on GitHub (Dec 8, 2024):

@setepenre no such issues here with Arch + Nvidia with AUR/shadps4-git on github.com/shadps4-emu/shadPS4@4fb2247196, odd.

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

image

EDIT: Latest master works fine too (github.com/shadps4-emu/shadPS4@fea2593ab4)

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.

<!-- gh-comment-id:2526293154 --> @C0rn3j commented on GitHub (Dec 8, 2024): @setepenre ~~no such issues here with Arch + Nvidia with [AUR/shadps4-git](https://aur.archlinux.org/packages/shadps4-git) on https://github.com/shadps4-emu/shadPS4/commit/4fb2247196d4626bab8f2c28710b0c34cad053fe, odd.~~ Both GOTY and non-GOTY BB launches ~~fine~~ as long as $DISPLAY is unset. ![image](https://github.com/user-attachments/assets/5a163cfc-5709-437a-98f4-05c057de5729) ~~EDIT: Latest master works fine too (https://github.com/shadps4-emu/shadPS4/commit/fea2593ab4be8638426e4f608ebbe2314d83d9f6)~~ 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.
Author
Owner

@7oxicshadow commented on GitHub (Dec 8, 2024):

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

<!-- gh-comment-id:2526312989 --> @7oxicshadow commented on GitHub (Dec 8, 2024): Can confirm that this build flag breaks Bloodborne for me. ![image](https://github.com/user-attachments/assets/6b757478-e236-419e-9907-09456a5cd4c9)
Author
Owner

@ikmjssc commented on GitHub (Dec 9, 2024):

x11 having this issue too

<!-- gh-comment-id:2529377695 --> @ikmjssc commented on GitHub (Dec 9, 2024): x11 having this issue too
Author
Owner

@knewman23 commented on GitHub (Dec 9, 2024):

Following for updates, same issue on steam deck

<!-- gh-comment-id:2529463289 --> @knewman23 commented on GitHub (Dec 9, 2024): Following for updates, same issue on steam deck
Author
Owner

@Shoegzer commented on GitHub (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.

<!-- gh-comment-id:2542190389 --> @Shoegzer commented on GitHub (Dec 13, 2024): Confirmed here too, Linux Mint 22 and X11. Unfortunately, commenting out [this line](https://github.com/shadps4-emu/shadPS4/blob/4fb2247196d4626bab8f2c28710b0c34cad053fe/CMakeLists.txt#L886) as suggested above does not fix this issue. Update: Fully resolved with #1777.
Author
Owner

@zt64 commented on GitHub (Dec 13, 2024):

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

<!-- gh-comment-id:2542436228 --> @zt64 commented on GitHub (Dec 13, 2024): On Nvidia proprietary driver 565.77 on Wayland what worked for me was `env -u DISPLAY shadps4`
Author
Owner

@ikmjssc commented on GitHub (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

<!-- gh-comment-id:2543037541 --> @ikmjssc commented on GitHub (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
Author
Owner

@C0rn3j commented on GitHub (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.

<!-- gh-comment-id:2558285563 --> @C0rn3j commented on GitHub (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.
Author
Owner

@kavika13 commented on GitHub (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

<!-- gh-comment-id:2558303923 --> @kavika13 commented on GitHub (Dec 22, 2024): I am getting the freeze as well. It isn't Wayland specific. But I am also using KDE. ![image](https://github.com/user-attachments/assets/10517e28-e383-4b1c-af0b-566cbcb1bd2a) 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](https://github.com/user-attachments/files/18220759/gdb_log.txt)
Author
Owner

@kalaposfos13 commented on GitHub (Dec 22, 2024):

https://github.com/shadps4-emu/shadPS4/pull/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.

<!-- gh-comment-id:2558402686 --> @kalaposfos13 commented on GitHub (Dec 22, 2024): https://github.com/shadps4-emu/shadPS4/pull/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 in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/shadPS4#584
No description provided.