Ubuntu 26.04 System randomly hangs after hours of inactivity

Ubuntu Version:
Ubuntu 26.04 LTS

Desktop Environment:
GNOME

Problem Description:
I recently had my Ubuntu 26.04 system freeze on my nvidia laptop (Thinkpad p16 gen 2), it was in sleep mode twice today, then when i got home i plugged it as usual, used it for an hour then left it for like 2 hours. The displays were off, not sleeping. It was attached to an external monitor through HDMI cable. I pressed on the keyboard, both my laptop screen and external woke up and i typed my password in login screen, probably got it wrong but when i pressed enter it hanged and froze completely. Even changing tty didn’t work, i removed the hdmi cable and closed the laptop lid so it would go to sleep but it couldn’t do that, it just stayed frozen at login screen. I have no idea if this should be asked here instead of nvidia forum so please let me know if i should delete the topic ! Here are the logs after a hard shutdown, i checked with journalctl -b -1 -e

Relevant System Information:
Here are the specs of my laptop :
Hardware Model : Lenovo Thinkpad P16 Gen 2

CPU : i7-14700HX

GPU : NVIDIA RTX 2000 ADA Generation Laptop GPU

Memory : 32GiB

I’m afraid this might be something that will become frequent. Is there a way to mitigate it ? AFAIK it might be related to GSP firmware hang. According to the log it seems like the driver panicked which caused all the input to stop working.

Update :

I found a solution!
The next day, i got this same issue 3 times and had to do a hard shutdown each time to be able to use my machine again. Since it only happened when laptop goes sleeping or displays are off i figured it might be an nvidia power save issue.

The Solution :
Well all i had to do was change PRIME profile in nvidia x settings app to performance mode. For 2 days i haven’t gotten this issue again.