wwmm / fastgame

Optimize system performance for games
GNU General Public License v3.0
76 stars 5 forks source link

Crash when trying to access hwmon kernel sysfs interface with Intel Haswell graphics (i5-4300U) #1

Closed ObscureScience closed 3 years ago

ObscureScience commented 3 years ago

When trying to launch fastgame it fails with:

** (fastgame:120735): ERROR **: 15:10:31.292:
unhandled exception (type std::exception) in signal handler:
what: filesystem error: directory iterator cannot open directory: No such file or directory [/sys/class/drm/card0/device/hwmon/]

Trace/breakpoint trap (core dumped)

I'm running Archlinux, and there is no "hwmon" file.

$ uname -a Linux archlinux 5.9.6-zen1-1-zen #1 ZEN SMP PREEMPT Thu, 05 Nov 2020 21:00:51 +0000 x86_64 GNU/Linux

I'm using a Lenovo Thinkpad x240

# find /sys -name "*hwmon*"
/sys/kernel/tracing/events/hwmon
/sys/kernel/tracing/events/hwmon/hwmon_attr_show
/sys/kernel/tracing/events/hwmon/hwmon_attr_store
/sys/kernel/tracing/events/hwmon/hwmon_attr_show_string
/sys/kernel/debug/tracing/events/hwmon
/sys/kernel/debug/tracing/events/hwmon/hwmon_attr_show
/sys/kernel/debug/tracing/events/hwmon/hwmon_attr_store
/sys/kernel/debug/tracing/events/hwmon/hwmon_attr_show_string
/sys/class/hwmon
/sys/class/hwmon/hwmon4
/sys/class/hwmon/hwmon2
/sys/class/hwmon/hwmon0
/sys/class/hwmon/hwmon5
/sys/class/hwmon/hwmon3
/sys/class/hwmon/hwmon1
/sys/devices/platform/thinkpad_hwmon
/sys/devices/platform/thinkpad_hwmon/hwmon
/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon4
/sys/devices/platform/coretemp.0/hwmon
/sys/devices/platform/coretemp.0/hwmon/hwmon5
/sys/devices/virtual/thermal/thermal_zone0/hwmon0
/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:08/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/hwmon1
/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:08/PNP0C09:00/ACPI0003:00/power_supply/AC/hwmon2
/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:08/PNP0C09:00/PNP0C0A:01/power_supply/BAT1/hwmon3
/sys/bus/platform/devices/thinkpad_hwmon
/sys/bus/platform/drivers/thinkpad_hwmon
/sys/bus/platform/drivers/thinkpad_hwmon/thinkpad_hwmon
/sys/module/thinkpad_acpi/drivers/platform:thinkpad_hwmon
$ ls /sys/class/drm/card0/device/
ari_enabled               consumer:0000:00:03.0  driver_override  i2c-1  link           numa_node  resource0     subsystem
boot_vga                  d3cold_allowed         drm              i2c-2  local_cpulist  power      resource2     subsystem_device
broken_parity_status      device                 enable           i2c-3  local_cpus     remove     resource2_wc  subsystem_vendor
class                     devspec                firmware_node    i2c-4  modalias       rescan     resource4     uevent
config                    dma_mask_bits          graphics         i2c-5  msi_bus        reset      revision      vendor
consistent_dma_mask_bits  driver                 i2c-0            irq    msi_irqs       resource   rom
wwmm commented 3 years ago

I totally overlooked the fact I have to detect if an AMD GPU is present. If it isn't we should not try to apply settings to it. I will see how I can find out if the drm card is Intel or AMD

wwmm commented 3 years ago

I have updated the master branch with a new code that should avoid amdgpu settings being applied when an AMD card is not installed. When I have time I will try it on my intel laptop.

ObscureScience commented 3 years ago

Thanks for the fast response! It's not crashing now. I can't give you any more feedback at the moment, but I assume this issue can be closed.

wwmm commented 3 years ago

I did a few tests on my laptop and there was no crash indeed. Let me know if there is any setting you think it would be useful. At this moment I am still exploring which system settings may be beneficial for games.