Bug 217249

Summary: Micro lags with AMD Ryzen 7 5700G
Product: Platform Specific/Hardware Reporter: Balazs Vinarz (vinibali1)
Component: x86-64Assignee: platform_x86_64 (platform_x86_64)
Status: NEW ---    
Severity: normal CC: regressions
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 6.1.20-1-lts Subsystem:
Regression: No Bisected commit-id:

Description Balazs Vinarz 2023-03-26 06:16:42 UTC
Hello there!
I was somewhat involved in
Kernels after 6.1 experience AMD Ryzen fTPM stutter (https://bugzilla.kernel.org/show_bug.cgi?id=216989) and 
stutter with kernel 6.2 (https://bugzilla.kernel.org/show_bug.cgi?id=217158), but it seems my problems are somewhat different.
I'm on the latest LTS kernel, latest linux-firmware package and latest BIOS version but I still experience shutters.
It mostly breaks the system sound too, when I close windows on Firefox.
I put back my old 2400G to the system I currently use (Asus Pro B550-C/CSM with 32GBs of DDR4) and all the lags are gone.
Comment 1 Balazs Vinarz 2023-03-26 06:39:05 UTC
Wow this one seems to be much easier than I thought.
So I was using the latest FW version for sure with completely default settings, this time I reverted the SVM mode in the CPU setting too-> no difference.
As a last idea, I removed all the custom kernel parameters I was using for years and it seems the shutter has gone.
Just some sidenote, I can see if the system will shutter even while the console prints all the systemd related logs.
```
amdgpu.noretry=0 audit=0 iomem=relaxed nopat mitigations=no sysrq_always_enabled systemd.unified_cgroup_hierarchy=0
```
I'll try to use them one by one to figure out what was wrong with 5700G and what was working flawlessly with 2400G.
Comment 2 Balazs Vinarz 2023-03-26 06:46:39 UTC
And the winner is:
nopat - [X86] Disable PAT (page attribute table extension of pagetables) support.
Why is nopat create shutters on the 5700G?
Comment 3 The Linux kernel's regression tracker (Thorsten Leemhuis) 2023-03-27 09:24:14 UTC
(In reply to Balazs Vinarz from comment #2)
> Why is nopat create shutters on the 5700G?

Well, it's not my area of expertise, but PAT allows "to specify different caching modes in page table entries" – so it seems quite possible that some cache without PAT is not working as it should which results in the problem you see. Maybe that's how it is these days with such CPUs, maybe that's a symptom of a problem due to a recent regression that only surfaces when PAT is disabled. Which leads to the question: Did it work fine with earlier kernels? Which one?
Comment 4 Balazs Vinarz 2023-03-28 19:20:29 UTC
As I mentioned in one of the previous bug reports, nopat with 5.15 had the shutter too.
I assume if it's working fine on 2400G, than it should be some untested scenario I the 5th gen Ryzens or some exception with the chip design.
I'll read some architecture reviews, but it's possible that somebody from AMD understands it better.