Bug 35733 - [Piketon bisected]2D performance downgraded about 40% on gnome-desktop
Summary: [Piketon bisected]2D performance downgraded about 40% on gnome-desktop
Status: CLOSED WONTFIX
Alias: None
Product: DRI
Classification: Unclassified
Component: DRM/Intel (show other bugs)
Version: unspecified
Hardware: All Linux (All)
: medium major
Assignee: Chris Wilson
QA Contact:
URL:
Whiteboard:
Keywords:
: 35761 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-03-28 02:06 UTC by meng
Modified: 2017-10-06 14:52 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
The perf.date for the bad commit f0c8602464 (862.21 KB, text/plain)
2011-03-29 00:22 UTC, meng
no flags Details
The perf.data for the good commit (857.87 KB, text/plain)
2011-03-29 00:28 UTC, meng
no flags Details
The perf.data.bad which head -1500 (88.50 KB, text/plain)
2011-03-29 01:02 UTC, meng
no flags Details
The perf.data.good which head -1500 (78.63 KB, text/plain)
2011-03-29 01:04 UTC, meng
no flags Details
Retire requests before disabling pagefaults (1.43 KB, patch)
2011-03-29 02:33 UTC, Chris Wilson
no flags Details | Splinter Review
An ugly hack (1.24 KB, patch)
2011-03-29 02:38 UTC, Chris Wilson
no flags Details | Splinter Review

Description meng 2011-03-28 02:06:42 UTC
System Environment:
--------------------------
Platform:        Piketon 
Libdrm:		(master)2.4.24-7-gfd3ed34a2070fca3804baf54ece40d0bc2666226
Mesa:		(master)8752824f27c979986ae855667337e89637b005fb
Xserver:		(master)xorg-server-1.10.0-125-g03f45df93469f6aef391e97007b9614e0770cc4c
Xf86_video_intel:		(master)2.14.901-22-g79e7f4ca3b5f035af6f473b5a53c3fe7d1361089
Cairo:		(master)90156f6ab7b94e9e576e34f6a2d8cb809242f8d0
Libva:		(master)b7ff2141aeb2adbf5743fed7910a62d971c15013
Kernel:	(drm-intel-next) f0c860246472248a534656d6cdbed5a36d1feb2e

Bug detailed description:
--------------------------------------
On gnome-desktop with compiz enabled, the 2D performance will drop about 40-50% on Piketon.Performance for x11perf:  
x11perf -aa10text:   979k    427k
x11perf -rgb10text:  699k    412k
Especially,
1.It only exist on Piketon.It works fine on Pineview and Hunronriver.
2.It's kernel regression.Bisect shows d4aeee776017b6da6dcd12f453cd82a3c951a0dc is the first bad commit.
ommit d4aeee776017b6da6dcd12f453cd82a3c951a0dc
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Mon Mar 14 15:11:24 2011 +0000

    drm/i915: Disable pagefaults along execbuffer relocation fast path

    Along the fast path for relocation handling, we attempt to copy directly
    from the user data structures whilst holding our mutex. This causes
    lockdep to warn about circular lock dependencies if we need to pagefault
    the user pages. [Since when handling a page fault on a mmapped bo, we
    need to acquire the struct mutex whilst already holding the mm
    semaphore, it is then verboten to acquire the mm semaphore when already
    holding the struct mutex. The likelihood of the user passing in the
    relocations contained in a GTT mmaped bo is low, but conceivable for
    extreme pathology.] In order to force the mm to return EFAULT rather
    than handle the pagefault, we therefore need to disable pagefaults
    across the relocation fast path.

    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
    Cc: stable@kernel.org
    Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>


Reproduce steps:
--------------------------------------
1. gnome-session(with compiz)
2. x11perf -aa10text
Comment 1 Chris Wilson 2011-03-28 02:57:30 UTC
Lacking a piketon, I can't investigate immediately.

In the meantime, can you please gather a couple of cpu profiles using:

$ sudo perf record -f -g -a x11perf -aa10text -d :0

for the bad commit and without.

As the fix is a correctness/stability issue we can't simply revert it, but must instead understand why it impacts performance so and thence take mitigating steps.
Comment 2 meng 2011-03-29 00:22:37 UTC
Created attachment 44980 [details]
The perf.date for the bad commit f0c8602464
Comment 3 meng 2011-03-29 00:28:44 UTC
Created attachment 44981 [details]
The perf.data for the good commit 

This good commit is that the bad commit f0c860 which git revert the first bad commit d4aeee
Comment 4 Chris Wilson 2011-03-29 00:32:37 UTC
*grin*

And now can you do "perf report -i perf.data.[good|bad] | head -150" :)

You will need the sources for each kernel build available (iirc).
Comment 5 Chris Wilson 2011-03-29 00:36:19 UTC
perf does report a big spike in kernel time, so it should provide some useful information once we marry it to some symbols.

head -150 might not be enough. Try head -1500 instead.
Comment 6 meng 2011-03-29 01:02:50 UTC
Created attachment 44983 [details]
The perf.data.bad which head -1500
Comment 7 meng 2011-03-29 01:04:11 UTC
Created attachment 44985 [details]
The perf.data.good which head -1500
Comment 8 Chris Wilson 2011-03-29 01:20:37 UTC
Bah, bad symbol data. But my interpretation is that it is indeed just due to hitting a page-fault and having to fallback to the relocation slow-path - note the appearance of vmalloc/rb_next in the profile.

I have curbed the number of relocations required by the ddx, but I know where I can find many more...
Comment 9 meng 2011-03-29 02:14:54 UTC
(In reply to comment #8)
> Bah, bad symbol data.
Do you mean you can't open my attachment(id=44983) or some other?
Comment 10 Chris Wilson 2011-03-29 02:19:22 UTC
Just that the symbols perf used for the i915.ko addresses are garbage. However, I can guess what they should have been judging by the delta elsewhere.
Comment 11 Chris Wilson 2011-03-29 02:33:42 UTC
Created attachment 44988 [details] [review]
Retire requests before disabling pagefaults

This is not the ultimate patch, but it may help reduce the number of unnecessary fallbacks.
Comment 12 Chris Wilson 2011-03-29 02:38:23 UTC
Created attachment 44989 [details] [review]
An ugly hack

These should recover the performance, but only as an absolute last resort.
Comment 13 Chris Wilson 2011-03-29 02:45:37 UTC
If it is not clear, please try the first patch first by itself. The second patch is just in case the first is not enough and to prove that the relocation on an active bo is the cause.
Comment 14 Chris Wilson 2011-03-29 03:16:31 UTC
*** Bug 35761 has been marked as a duplicate of this bug. ***
Comment 15 meng 2011-03-29 22:14:16 UTC
Sorry,but I think the bug still exists.Testing in commit f0c8602,performance for x11perf -aa10text,compare with good commit(979k):
no patch:          426k
patch(44988) only: 432k
both(44988,44988): 391k
Comment 16 Gordon Jin 2011-04-01 17:35:47 UTC
I just noticed this bisected patch is on -backport branch, so I'd put it into P1.
Comment 17 Chris Wilson 2011-04-01 23:16:52 UTC
No, it is not a P1 bug. The P1 bug is the OOPS that this fixes.
Comment 18 Chris Wilson 2011-04-04 09:03:55 UTC
Pushed what should be a couple of mitigating patches to xf86-video-intel. Please compare.
Comment 19 meng 2011-04-06 01:24:11 UTC
(In reply to comment #18)
> Pushed what should be a couple of mitigating patches to xf86-video-intel.
> Please compare.

Wiht the xf86 2.14.902-28-g47462f65e90e49e5ffd48c77c4f95255b9573f83, 
2D performance:
rgb10text:1060k
aa10text:1380k
Comment 20 meng 2011-04-06 01:40:15 UTC
(In reply to comment #18)
> Pushed what should be a couple of mitigating patches to xf86-video-intel.
> Please compare.
Compare commit 5f31025cce with the commit 47462f6 in xf86:
rgb10text:522k  1060k
aa10text: 552k  1380k
Comment 21 meng 2011-04-07 18:29:26 UTC
The 2D performance downgraded again after we git revert commit 59ed6b05db on xf86-video-intel.
Comment 22 Chris Wilson 2011-04-07 22:56:01 UTC
Not unexpected, but still :(
Comment 23 Chris Wilson 2011-07-10 05:46:21 UTC
We wait for sna.
Comment 24 Chris Wilson 2011-10-19 06:26:51 UTC
Fixed in SNA.
Comment 25 meng 2014-07-18 04:23:53 UTC
Verified it.
Comment 26 Elizabeth 2017-10-06 14:52:51 UTC
Closing old verified.


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.