All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mario Kleiner <mario.kleiner.de@gmail.com>
To: "Vlastimil Babka" <vbabka@suse.cz>,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: "Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	"Daniel Vetter" <daniel.vetter@ffwll.ch>,
	mgraesslin@kde.org, "David Airlie" <airlied@linux.ie>,
	dri-devel@lists.freedesktop.org,
	LKML <linux-kernel@vger.kernel.org>,
	kwin@kde.org
Subject: Re: linux-4.4 bisected: kwin5 stuck on kde5 loading screen with radeon
Date: Wed, 20 Jan 2016 21:32:30 +0100	[thread overview]
Message-ID: <569FEEDE.4060409@gmail.com> (raw)
In-Reply-To: <569CC357.8030302@suse.cz>

On 01/18/2016 11:49 AM, Vlastimil Babka wrote:
> On 01/16/2016 05:24 AM, Mario Kleiner wrote:
>>
>>
>> On 01/15/2016 01:26 PM, Ville Syrjälä wrote:
>>> On Fri, Jan 15, 2016 at 11:34:08AM +0100, Vlastimil Babka wrote:
>>
>> I'm currently running...
>>
>> while xinit /usr/bin/ksplashqml --test -- :1 ; do echo yay; done
>>
>> ... in an endless loop on Linux 4.4 SMP PREEMPT on HD-5770  and so far i
>> can't trigger a hang after hundreds of runs.
>>
>> Does this also hang for you?
>
> No, test mode seems to be fine.
>
>> I think a drm.debug=0x21 setting and grep'ping the syslog for "vblank"
>> should probably give useful info around the time of the hang.
>
> Attached. Captured by having kdm running, switching to console, running
> "dmesg -C ; dmesg -w > /tmp/dmesg", switch to kdm, enter password, see
> frozen splashscreen, switch back, terminate dmesg. So somewhere around
> the middle there should be where ksplashscreen starts...
>
>> Maybe also check XOrg.0.log for (WW) warnings related to flip.
>
> No such warnings there.
>
>> thanks,
>> -mario
>>
>>
>>>> Thanks,
>>>> Vlastimil
>>>
>

Thanks. So the problem is that AMDs hardware frame counters reset to 
zero during a modeset. The old DRM code dealt with drivers doing that by 
keeping vblank irqs enabled during modesets and incrementing vblank 
count by one during each vblank irq, i think that's what 
drm_vblank_pre_modeset() and drm_vblank_post_modeset() were meant for.

The new code in drm_update_vblank_count() breaks this. The reset of the 
counter to zero is treated as counter wraparound, so our software vblank 
counter jumps forward by up to 2^24 counts in response (in case of AMD's 
24 bit hw counters), and then the vblank event handling code in 
drm_handle_vblank_events() and other places detects the counter being 
more than 2^23 counts ahead of queued vblank events and as part of its 
own wraparound handling for the 32-Bit software counter doesn't deliver 
these queued events for a long time -> no vblank swap trigger event -> 
no swap -> client hangs waiting for swap completion.

I think i remember seeing the ksplash progress screen occasionally 
blanking half way through login, i guess that's when kwin triggers a 
modeset in parallel to ksplash doing its OpenGL animations. So depending 
on the hw vblank count at the time of login ksplash would or wouldn't 
hang, apparently i got "lucky" with my counts at login.

-mario

WARNING: multiple messages have this Message-ID (diff)
From: Mario Kleiner <mario.kleiner.de@gmail.com>
To: "Vlastimil Babka" <vbabka@suse.cz>,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: "Daniel Vetter" <daniel.vetter@ffwll.ch>,
	LKML <linux-kernel@vger.kernel.org>,
	dri-devel@lists.freedesktop.org, mgraesslin@kde.org,
	kwin@kde.org, "Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>
Subject: Re: linux-4.4 bisected: kwin5 stuck on kde5 loading screen with radeon
Date: Wed, 20 Jan 2016 21:32:30 +0100	[thread overview]
Message-ID: <569FEEDE.4060409@gmail.com> (raw)
In-Reply-To: <569CC357.8030302@suse.cz>

On 01/18/2016 11:49 AM, Vlastimil Babka wrote:
> On 01/16/2016 05:24 AM, Mario Kleiner wrote:
>>
>>
>> On 01/15/2016 01:26 PM, Ville Syrjälä wrote:
>>> On Fri, Jan 15, 2016 at 11:34:08AM +0100, Vlastimil Babka wrote:
>>
>> I'm currently running...
>>
>> while xinit /usr/bin/ksplashqml --test -- :1 ; do echo yay; done
>>
>> ... in an endless loop on Linux 4.4 SMP PREEMPT on HD-5770  and so far i
>> can't trigger a hang after hundreds of runs.
>>
>> Does this also hang for you?
>
> No, test mode seems to be fine.
>
>> I think a drm.debug=0x21 setting and grep'ping the syslog for "vblank"
>> should probably give useful info around the time of the hang.
>
> Attached. Captured by having kdm running, switching to console, running
> "dmesg -C ; dmesg -w > /tmp/dmesg", switch to kdm, enter password, see
> frozen splashscreen, switch back, terminate dmesg. So somewhere around
> the middle there should be where ksplashscreen starts...
>
>> Maybe also check XOrg.0.log for (WW) warnings related to flip.
>
> No such warnings there.
>
>> thanks,
>> -mario
>>
>>
>>>> Thanks,
>>>> Vlastimil
>>>
>

Thanks. So the problem is that AMDs hardware frame counters reset to 
zero during a modeset. The old DRM code dealt with drivers doing that by 
keeping vblank irqs enabled during modesets and incrementing vblank 
count by one during each vblank irq, i think that's what 
drm_vblank_pre_modeset() and drm_vblank_post_modeset() were meant for.

The new code in drm_update_vblank_count() breaks this. The reset of the 
counter to zero is treated as counter wraparound, so our software vblank 
counter jumps forward by up to 2^24 counts in response (in case of AMD's 
24 bit hw counters), and then the vblank event handling code in 
drm_handle_vblank_events() and other places detects the counter being 
more than 2^23 counts ahead of queued vblank events and as part of its 
own wraparound handling for the 32-Bit software counter doesn't deliver 
these queued events for a long time -> no vblank swap trigger event -> 
no swap -> client hangs waiting for swap completion.

I think i remember seeing the ksplash progress screen occasionally 
blanking half way through login, i guess that's when kwin triggers a 
modeset in parallel to ksplash doing its OpenGL animations. So depending 
on the hw vblank count at the time of login ksplash would or wouldn't 
hang, apparently i got "lucky" with my counts at login.

-mario
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2016-01-20 20:32 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-15 10:34 linux-4.4 bisected: kwin5 stuck on kde5 loading screen with radeon Vlastimil Babka
2016-01-15 12:26 ` Ville Syrjälä
2016-01-15 12:40   ` Vlastimil Babka
2016-01-16  4:24   ` Mario Kleiner
2016-01-16  4:24     ` Mario Kleiner
2016-01-18 10:49     ` Vlastimil Babka
2016-01-18 14:06       ` Vlastimil Babka
2016-01-18 14:14         ` Christian König
2016-01-18 14:14           ` Christian König
2016-01-20 20:25       ` Vlastimil Babka
2016-01-20 20:25         ` Vlastimil Babka
2016-01-20 20:32       ` Mario Kleiner [this message]
2016-01-20 20:32         ` Mario Kleiner
2016-01-21  3:43         ` Michel Dänzer
2016-01-21  3:43           ` Michel Dänzer
2016-01-21  5:31           ` Mario Kleiner
2016-01-21  5:31             ` Mario Kleiner
2016-01-21  6:38             ` Michel Dänzer
2016-01-21  6:38               ` Michel Dänzer
2016-01-21  6:41               ` Michel Dänzer
2016-01-21  6:41                 ` Michel Dänzer
2016-01-21  7:58                 ` Daniel Vetter
2016-01-21  7:58                   ` Daniel Vetter
2016-01-21  8:36                   ` Michel Dänzer
2016-01-21  8:36                     ` Michel Dänzer
2016-01-21 10:09                     ` Daniel Vetter
2016-01-21 10:09                       ` Daniel Vetter
2016-01-22  3:06                       ` Michel Dänzer
2016-01-22  3:06                         ` Michel Dänzer
2016-01-22 15:18                         ` Ville Syrjälä
2016-01-22 15:18                           ` Ville Syrjälä
2016-01-22 18:29                           ` Mario Kleiner
2016-01-22 18:29                             ` Mario Kleiner
2016-01-23 18:23                             ` Mario Kleiner
2016-01-23 18:23                               ` Mario Kleiner
2016-01-25  4:15                           ` Michel Dänzer
2016-01-25  4:15                             ` Michel Dänzer
2016-01-25 13:16                             ` Mario Kleiner
2016-01-25 13:16                               ` Mario Kleiner
2016-01-25 13:23                               ` Ville Syrjälä
2016-01-25 13:44                                 ` Mario Kleiner
2016-01-25 13:44                                   ` Mario Kleiner
2016-01-25 14:53                                   ` Ville Syrjälä
2016-01-25 14:53                                     ` Ville Syrjälä
2016-01-25 16:38                                     ` Mario Kleiner
2016-01-25 18:51                                       ` Daniel Vetter
2016-01-25 18:51                                         ` Daniel Vetter
2016-01-25 19:30                                         ` Mario Kleiner
2016-01-25 19:30                                           ` Mario Kleiner
2016-01-25 20:32                                           ` Daniel Vetter
2016-01-25 20:32                                             ` Daniel Vetter
2016-01-25 21:42                                             ` Mario Kleiner
2016-01-25 21:42                                               ` Mario Kleiner
2016-01-25 22:05                                               ` Daniel Vetter
2016-01-25 22:05                                                 ` Daniel Vetter
2016-01-21  8:28               ` Mario Kleiner
2016-01-21  8:28                 ` Mario Kleiner
2016-01-21  9:15                 ` Vlastimil Babka
2016-01-21  9:15                   ` Vlastimil Babka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=569FEEDE.4060409@gmail.com \
    --to=mario.kleiner.de@gmail.com \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kwin@kde.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgraesslin@kde.org \
    --cc=vbabka@suse.cz \
    --cc=ville.syrjala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.