https://bugs.kde.org/show_bug.cgi?id=529178

            Bug ID: 529178
           Summary: amdgpu: amdgpu_vamgr_find_va / amdgpu_vamgr_free_va
                    dominate CPU in long-running compositor doing frequent
                    dmabuf imports
    Classification: Plasma
           Product: kwin
      Version First 6.8.3
       Reported In:
          Platform: Fedora RPMs
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: wayland-generic
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

Created attachment 198702
  --> https://bugs.kde.org/attachment.cgi?id=198702&action=edit
call graph

## Summary

In kwin_wayland (KDE Plasma 6.8.3) running for ~35 hours, a client that keeps
submitting new dmabuf buffers (a JavaFX app under Xwayland) causes kwin's main
thread to spend ~96% of its time in the amdgpu VA manager, pegging one core at
100% and making the desktop and cursor lag.

## Environment

- libdrm 2.4.134 (Fedora 45), Mesa 26.2.7 radeonsi, kernel 7.3.4
- AMD Radeon RX 7900 XTX (navi31)

## Profile

perf, kwin main thread, 30 s:

```
77.84%  amdgpu_vamgr_find_va
        <- amdgpu_va_range_alloc2 <- amdgpu_bo_from_handle <-
si_texture_from_handle
        <- dri2_from_dma_bufs <- dri2_create_image_dma_buf <- eglCreateImage
(dmabuf import)

18.76%  amdgpu_vamgr_free_va
        <- amdgpu_va_range_free <- amdgpu_bo_destroy <- si_resource_destroy
        <- dri2_destroy_image <- eglDestroyImage
```

The import + destroy pattern itself is roughly one buffer per frame (~60/s).
The fact that each alloc/free costs milliseconds suggests the free-hole list
walked by find_va/free_va has grown very long or fragmented over the process
lifetime, turning a normally cheap operation into a linear scan of many
entries.

## Reproducer

See the KDE bug for a minimal JavaFX program (`Anim.java`) and measurements.
Software-rendered JavaFX (no dmabuf buffers) keeps the compositor at ~5%,
glxgears/vkcube at ~10%.

Anim.java: https://gist.github.com/wodoro/4c70652308f5f7884491c77f8c91e426

## SOFTWARE/OS VERSIONS

Operating System: Fedora Linux 45
KDE Plasma Version: 6.8.3
KDE Frameworks Version: 6.32.0
Qt Version: 6.11.2

## Additional information

Full call graph attached (kwin-perf-callgraph.txt).

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to