Bug 103362

Summary: X consume a lot of CPU during window resize
Product: xorg Reporter: razrfalcon
Component: Driver/nVidia (proprietary)Assignee: Aaron Plattner <aplattner>
Status: NEW --- QA Contact: Aaron Plattner <aplattner>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description razrfalcon 2017-10-19 17:39:18 UTC
During a window resize X consume a single CPU core completely leading to huge lags. GPU usage according to nvidia-smi is 20-30%.

There are no warnings/errors in /var/log/Xorg.0.log, dmesg, ~/.local/share/sddm/xorg-session.log.

The only custom option is
Option "metamodes" "nvidia-auto-select +0+0 { ForceFullCompositionPipeline = On }"
in xorg.conf

Lags doesn't depend on toolkit. gtk2/3 and qt4/5 behaves the same. ForceFullCompositionPipeline doesn't remove lags either.

From where can I start to investigate performance issues source?

Gentoo Linux stable x86_64, KDE 5.10.5, i5 3570k@3.4, nVidia GTX 960 4GB (driver 384.90), xorg-server 1.19.4.
Comment 1 razrfalcon 2017-10-20 15:37:51 UTC
I've tried a fresh Arch Linux installation today - same lags.
Comment 2 razrfalcon 2017-10-20 16:27:01 UTC
I've also tried to profile X with perf.

During resize:

   PerfTop:    2762 irqs/sec  kernel:91.6%  exact:  0.0% [4000Hz cycles],  (target_pid: 4685)
----------------------------------------------------------------------------------------------

    38.53%  [nvidia]          [k] _nv028452rm
    35.24%  [kernel]          [k] pci_conf1_read
     6.14%  [nvidia]          [k] _nv017381rm
     1.12%  [kernel]          [k] _raw_spin_lock_irqsave
     0.97%  [nvidia]          [k] _nv009414rm
     0.81%  [kernel]          [k] _raw_write_unlock_irqrestore
     0.62%  [kernel]          [k] preempt_count_sub
     0.41%  nvidia_drv.so     [.] 0x00000000000a0b70
     0.41%  [kernel]          [k] preempt_count_add
     0.35%  [vdso]            [.] 0x0000000000000909
     0.31%  [nvidia]          [k] _nv017360rm
     0.27%  [nvidia]          [k] _nv017552rm
     0.26%  nvidia_drv.so     [.] 0x00000000000d1d72
     0.25%  [vdso]            [.] __vdso_gettimeofday
     0.24%  nvidia_drv.so     [.] 0x00000000000d1ca1
     0.24%  nvidia_drv.so     [.] 0x00000000000d1c90
     0.20%  [nvidia]          [k] _nv019905rm
     0.20%  nvidia_drv.so     [.] 0x00000000000d1cad
     0.19%  nvidia_drv.so     [.] 0x00000000000cf022
     0.18%  [nvidia]          [k] _nv030640rm
     0.18%  nvidia_drv.so     [.] 0x00000000000d1c04
     0.17%  [nvidia]          [k] 0x0000000000341de2
     0.17%  [kernel]          [k] page_fault
     0.16%  nvidia_drv.so     [.] 0x00000000000d1c53
     0.16%  [nvidia]          [k] 0x00000000003cad5d
     0.16%  nvidia_drv.so     [.] 0x00000000000d1c69
     0.16%  [nvidia]          [k] _nv024815rm
     0.16%  [nvidia]          [k] _nv019581rm
     0.16%  nvidia_drv.so     [.] 0x00000000000d1d2d
     0.16%  nvidia_drv.so     [.] 0x00000000000d1d27


Usual work:

   PerfTop:     118 irqs/sec  kernel:13.6%  exact:  0.0% [4000Hz cycles],  (target_pid: 4685)
----------------------------------------------------------------------------------------------

    11.97%  [vdso]            [.] 0x0000000000000909
     8.92%  [vdso]            [.] __vdso_gettimeofday
     8.57%  [nvidia]          [k] _nv028452rm
     8.44%  [kernel]          [k] pci_conf1_read
     3.77%  nvidia_drv.so     [.] 0x00000000000cf022
     2.05%  nvidia_drv.so     [.] 0x000000000005e66e
     1.74%  nvidia_drv.so     [.] 0x00000000000b4c7e
     1.56%  [nvidia]          [k] _nv017381rm
     1.53%  [vdso]            [.] 0x0000000000000907
     1.49%  nvidia_drv.so     [.] 0x00000000000a0b70
     1.11%  nvidia_drv.so     [.] 0x00000000000d1c90
     1.09%  nvidia_drv.so     [.] 0x00000000000d1c50
     1.01%  nvidia_drv.so     [.] 0x00000000000d1c6a
     0.97%  nvidia_drv.so     [.] 0x00000000000d1d72
     0.96%  nvidia_drv.so     [.] 0x00000000000d1cad
     0.79%  nvidia_drv.so     [.] 0x00000000000d1c69
     0.78%  nvidia_drv.so     [.] 0x00000000000d1c04
     0.75%  nvidia_drv.so     [.] 0x00000000000d1ca1
     0.70%  nvidia_drv.so     [.] 0x00000000000d1d12
     0.63%  nvidia_drv.so     [.] 0x000000000005e654
     0.59%  nvidia_drv.so     [.] 0x00000000000d1d2d
     0.58%  nvidia_drv.so     [.] 0x00000000000d1c53
     0.57%  nvidia_drv.so     [.] 0x00000000000d1d27
     0.56%  nvidia_drv.so     [.] 0x00000000000d1d20
     0.56%  nvidia_drv.so     [.] 0x00000000000d1dd1
     0.52%  nvidia_drv.so     [.] 0x00000000000d1c59
     0.52%  [vdso]            [.] 0x000000000000091c
     0.52%  nvidia_drv.so     [.] 0x000000000005e667
     0.50%  nvidia_drv.so     [.] 0x00000000000d2493
     0.49%  [kernel]          [k] preempt_count_add
Comment 3 Michel Dänzer 2017-10-20 16:33:28 UTC
Looks like most of the CPU cycles are spent in the nvidia kernel driver.
Comment 4 razrfalcon 2017-10-20 16:43:59 UTC
I've updated nvidia driver from 384.90 to 387.12. Now X eats only ~20% (not 25%) of the CPU, which made lags a lot smaller, but they are still very visible.

I'm comparing to Win10, which is not fair, but it has zero lags.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.