From: Daniel Vetter <daniel@ffwll.ch>
To: Xinliang Liu <xinliang.liu@linaro.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
DRI Development <dri-devel@lists.freedesktop.org>,
Daniel Vetter <daniel.vetter@intel.com>
Subject: Re: [PATCH 19/38] drm/hisilicon: Implement some semblance of vblank event handling
Date: Fri, 17 Jun 2016 09:23:58 +0200 [thread overview]
Message-ID: <20160617072358.GH23520@phenom.ffwll.local> (raw)
In-Reply-To: <CAGd==04a+HQgWN4gaJcvCzWXvU1UeXwf3guFPj7hm_y0QDFgzA@mail.gmail.com>
On Fri, Jun 17, 2016 at 10:09:50AM +0800, Xinliang Liu wrote:
> Hi Daniel,
>
> I have tested your David's drm-next branch[1] which including this patch.
> In most time it is ok. But when switching modes or disable/re-enable
> mode, it will encounter bellow error msg:
> --
> [ 357.940728] [drm:drm_atomic_helper_commit_cleanup_done] *ERROR*
> [CRTC:24:crtc-0] flip_done timed out
> [ 368.004962] [drm:drm_atomic_helper_commit_cleanup_done] *ERROR*
> [CRTC:24:crtc-0] flip_done timed out
> [ 396.064871] INFO: rcu_preempt detected stalls on CPUs/tasks:
> [ 396.070548] 0-...: (3 GPs behind) idle=f4f/1/0 softirq=4253/4253 fqs=19
> [ 396.077335] 7-...: (1 GPs behind) idle=71f/140000000000000/0
> softirq=2444/2451 fqs=19
> [ 396.085332] (detected by 1, t=6028 jiffies, g=3924, c=3923, q=246)
> [ 396.091600] Task dump for CPU 0:
> [ 396.094821] swapper/0 R running task 0 0 0 0x00000002
> [ 396.101872] Call trace:
> [ 396.104323] [<ffff000008085bec>] __switch_to+0xa4/0xd4
> [ 396.109460] [<ffff000008c85000>] __boot_cpu_mode+0x0/0x80
> [ 396.114852] Task dump for CPU 7:
> [ 396.118072] Xorg R running task 0 1658 1646 0x00000002
> [ 396.125121] Call trace:
> [ 396.127562] [<ffff000008085c10>] __switch_to+0xc8/0xd4
> [ 396.132695] [<ffff800035567110>] 0xffff800035567110
> [ 396.137569] rcu_preempt kthread starved for 1000 jiffies! g3924
> c3923 f0x0 RCU_GP_WAIT_FQS(3) ->state=0x1
> [ 396.147130] rcu_preempt S ffff000008085c10 0 7 2 0x00000000
> [ 396.154180] Call trace:
> [ 396.156620] [<ffff000008085c10>] __switch_to+0xc8/0xd4
> [ 396.161758] [<ffff000008810490>] __schedule+0x188/0x590
> [ 396.166978] [<ffff0000088108d4>] schedule+0x3c/0xa0
> [ 396.171851] [<ffff00000881368c>] schedule_timeout+0x104/0x1a4
> [ 396.177595] [<ffff00000810549c>] rcu_gp_kthread+0x54c/0x814
> [ 396.183164] [<ffff0000080d3e5c>] kthread+0xd4/0xe8
> [ 396.187951] [<ffff000008084e10>] ret_from_fork+0x10/0x40
> --
>
> Then the console stuck. Any tips for addressing this issue?
> I am running a debian system.
>
> [1] git://people.freedesktop.org/~airlied/linux drm-next
hisilicon doesn't handle crtc_state->event correctly. Most likely when
shutting down a CRTC if fails to send out that flip event, which means the
waiting for flip_done times out. My patch tried to fix that (it's not
correct, but it did work on other drivers).
From a quick look what's wrong with hisilicon vblank handling:
- You don't call drm_crtc_vblank_on/off, which means the core thinks
vblanks will keep working even when the CRTC is off. That throws off the
hack in my patch. You need to put a call to drm_crtc_vblank_off into
crtc->disable hook, and drm_crtc_vblank_on into crtc->enable.
- While at it please review that the event sending is placed correctly and
can't race with the new buffers showing up on the screen. The event
should be signalled at exactly the time the buffers start to get scanned
out. The important bit is to make sure that even if something races or
gets delayed that it still happens together.
Cheers, Daniel
>
> Thanks,
> -xinliang
>
> On 2 June 2016 at 06:06, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> > atomic_flush seems to be the right place, but I'm not entirely sure
> > whether this will catch them all. It could be that when disabling the
> > crtc we'll miss the vblank.
> >
> > While at it nuke the dummy functions.
> >
> > v2: Be more robust and either arm, when the CRTC is on, or just send
> > the event out right away.
> >
> > Cc: Xinliang Liu <xinliang.liu@linaro.org>
> > Cc: Xinwei Kong <kong.kongxinwei@hisilicon.com>
> > Cc: Archit Taneja <architt@codeaurora.org>
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
>
> Acked-by: Xinliang Liu <xinliang.liu@linaro.org>
>
> > ---
> > drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 20 ++++++++++++--------
> > 1 file changed, 12 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> > index fba6372d060e..ed76baad525f 100644
> > --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> > +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> > @@ -502,13 +502,6 @@ static void ade_crtc_disable(struct drm_crtc *crtc)
> > acrtc->enable = false;
> > }
> >
> > -static int ade_crtc_atomic_check(struct drm_crtc *crtc,
> > - struct drm_crtc_state *state)
> > -{
> > - /* do nothing */
> > - return 0;
> > -}
> > -
> > static void ade_crtc_mode_set_nofb(struct drm_crtc *crtc)
> > {
> > struct ade_crtc *acrtc = to_ade_crtc(crtc);
> > @@ -537,6 +530,7 @@ static void ade_crtc_atomic_flush(struct drm_crtc *crtc,
> > {
> > struct ade_crtc *acrtc = to_ade_crtc(crtc);
> > struct ade_hw_ctx *ctx = acrtc->ctx;
> > + struct drm_pending_vblank_event *event = crtc->state->event;
> > void __iomem *base = ctx->base;
> >
> > /* only crtc is enabled regs take effect */
> > @@ -545,12 +539,22 @@ static void ade_crtc_atomic_flush(struct drm_crtc *crtc,
> > /* flush ade registers */
> > writel(ADE_ENABLE, base + ADE_EN);
> > }
> > +
> > + if (event) {
> > + crtc->state->event = NULL;
> > +
> > + spin_lock_irq(&crtc->dev->event_lock);
> > + if (drm_crtc_vblank_get(crtc) == 0)
> > + drm_crtc_arm_vblank_event(crtc, event);
> > + else
> > + drm_crtc_send_vblank_event(crtc, event);
> > + spin_unlock_irq(&crtc->dev->event_lock);
> > + }
> > }
> >
> > static const struct drm_crtc_helper_funcs ade_crtc_helper_funcs = {
> > .enable = ade_crtc_enable,
> > .disable = ade_crtc_disable,
> > - .atomic_check = ade_crtc_atomic_check,
> > .mode_set_nofb = ade_crtc_mode_set_nofb,
> > .atomic_begin = ade_crtc_atomic_begin,
> > .atomic_flush = ade_crtc_atomic_flush,
> > --
> > 2.8.1
> >
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2016-06-17 7:23 UTC|newest]
Thread overview: 74+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-01 22:06 [PATCH 00/38] nonblocking atomic commits for everyone! Daniel Vetter
2016-06-01 22:06 ` [PATCH 01/38] drm/atomic-helper: use for_each_*_in_state more Daniel Vetter
2016-06-02 11:26 ` Maarten Lankhorst
2016-06-01 22:06 ` [PATCH 02/38] drm/i915: Use drm_atomic_get_existing_plane_state Daniel Vetter
2016-06-02 11:25 ` Maarten Lankhorst
2016-06-02 13:40 ` Daniel Vetter
2016-06-01 22:06 ` [PATCH 03/38] drm/msm: Use for_each_*_in_state Daniel Vetter
2016-06-02 13:13 ` Maarten Lankhorst
2016-06-01 22:06 ` [PATCH 04/38] drm/rcar-du: " Daniel Vetter
2016-06-02 13:14 ` Maarten Lankhorst
2016-06-02 13:48 ` Daniel Vetter
2016-06-02 21:08 ` Laurent Pinchart
2016-06-01 22:06 ` [PATCH 05/38] drm/vc4: Use for_each_plane_in_state Daniel Vetter
2016-06-02 13:15 ` Maarten Lankhorst
2016-06-01 22:06 ` [PATCH 06/38] drm/omap: " Daniel Vetter
2016-06-02 13:23 ` Maarten Lankhorst
2016-06-02 13:50 ` Daniel Vetter
2016-06-02 21:08 ` Laurent Pinchart
2016-06-01 22:06 ` [PATCH 07/38] drm/exynos: Use for_each_crtc_in_state Daniel Vetter
2016-06-02 13:23 ` Maarten Lankhorst
2016-06-01 22:06 ` [PATCH 08/38] drm/atomic: Add __drm_atomic_get_current_plane_state Daniel Vetter
2016-06-02 13:41 ` Maarten Lankhorst
2016-06-02 14:21 ` [PATCH] " Daniel Vetter
2016-06-02 14:43 ` Maarten Lankhorst
2016-06-02 14:59 ` Daniel Vetter
2016-06-02 14:47 ` Eric Engestrom
2016-06-01 22:06 ` [PATCH 09/38] drm: Consolidate connector arrays in drm_atomic_state Daniel Vetter
2016-06-01 22:06 ` [PATCH 10/38] drm: Consolidate plane " Daniel Vetter
2016-06-01 22:06 ` [PATCH 11/38] drm: Consolidate crtc " Daniel Vetter
2016-06-02 14:42 ` Maarten Lankhorst
2016-06-02 15:20 ` Daniel Vetter
2016-06-01 22:06 ` [PATCH 12/38] drm/fence: add fence to drm_pending_event Daniel Vetter
2016-06-02 18:49 ` Sean Paul
2016-06-02 20:15 ` Daniel Vetter
2016-06-01 22:06 ` [PATCH 13/38] drm/atomic-helper: Massage swap_state signature somewhat Daniel Vetter
2016-06-01 22:06 ` [PATCH 14/38] drm/arc: Nuke event_list Daniel Vetter
2016-06-01 22:06 ` [PATCH 15/38] drm/arc: Actually bother with handling atomic events Daniel Vetter
2016-06-01 22:06 ` [PATCH 16/38] drm/hdlcd: Clean up crtc hooks Daniel Vetter
2016-06-02 13:33 ` Daniel Vetter
2016-06-01 22:06 ` [PATCH 17/38] drm/hdlcd: Fix up crtc_state->event handling Daniel Vetter
2016-06-01 22:06 ` [PATCH 18/38] drm/fsl-du: Implement some semblance of vblank event handling Daniel Vetter
2016-06-03 17:43 ` Stefan Agner
2016-06-01 22:06 ` [PATCH 19/38] drm/hisilicon: " Daniel Vetter
2016-06-17 2:09 ` Xinliang Liu
2016-06-17 7:23 ` Daniel Vetter [this message]
2016-06-17 8:38 ` Xinliang Liu
2016-06-17 12:24 ` Daniel Vetter
2016-06-21 1:32 ` Xinliang Liu
2016-06-21 7:19 ` Daniel Vetter
2016-06-22 2:50 ` Xinliang Liu
2016-06-01 22:06 ` [PATCH 20/38] drm/sun4i: " Daniel Vetter
2016-06-01 22:06 ` [PATCH 21/38] drm/atomic: kerneldoc for drm_atomic_crtc_needs_modeset Daniel Vetter
2016-06-01 22:06 ` [PATCH 22/38] drm/atomic-helper: nonblocking commit support Daniel Vetter
2016-06-02 9:56 ` [PATCH 1/2] drm/atomic: Add struct drm_crtc_commit to track async updates Daniel Vetter
2016-06-02 9:56 ` [PATCH 2/2] drm/atomic-helper: nonblocking commit support Daniel Vetter
2016-06-01 22:06 ` [PATCH 23/38] drm/hdlcd: Use helper support for nonblocking commits Daniel Vetter
2016-06-01 22:06 ` [PATCH 24/38] drm/arc: Implement nonblocking commit correctly Daniel Vetter
2016-06-01 22:06 ` [PATCH 25/38] drm/i915: Signal drm events for atomic Daniel Vetter
2016-06-01 22:06 ` [PATCH 26/38] drm/i915: Roll out the helper nonblock tracking Daniel Vetter
2016-06-01 22:06 ` [PATCH 27/38] drm/i915: nonblocking commit Daniel Vetter
2016-06-01 22:06 ` [PATCH 28/38] drm/i915: Use atomic commits for legacy page_flips Daniel Vetter
2016-06-01 22:06 ` [PATCH 29/38] drm/i915: Move fb_bits updating later in atomic_commit Daniel Vetter
2016-06-01 22:06 ` [PATCH 30/38] drm/rockchip: Disarm vop->is_enabled Daniel Vetter
2016-06-01 22:06 ` [PATCH 31/38] drm/rockchip: Fix crtc_state->event signalling Daniel Vetter
2016-06-01 22:06 ` [PATCH 32/38] drm/rockchip: convert to helper nonblocking atomic commit Daniel Vetter
2016-06-01 22:06 ` [PATCH 33/38] drm/rockchip: Nuke pending event handling in preclose Daniel Vetter
2016-06-01 22:06 ` [PATCH 34/38] drm/virtio: Don't reinvent a flipping wheel Daniel Vetter
2016-06-01 22:06 ` [PATCH 35/38] drm: Replace fb_helper->atomic with mode_config->atomic_commit Daniel Vetter
2016-06-01 22:06 ` [PATCH 36/38] drm: Resurrect atomic rmfb code Daniel Vetter
2016-06-01 22:07 ` [PATCH 37/38] drm/sti: Don't call drm_helper_disable_unused_functions Daniel Vetter
2016-06-17 10:04 ` Benjamin Gaignard
2016-06-17 12:27 ` Daniel Vetter
2016-06-01 22:07 ` [PATCH 38/38] drm/crtc-helper: disable_unused_functions really isn't for atomic Daniel Vetter
2016-06-02 13:10 ` ✗ Ro.CI.BAT: failure for nonblocking atomic commits for everyone! Patchwork
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=20160617072358.GH23520@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=daniel.vetter@ffwll.ch \
--cc=daniel.vetter@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=xinliang.liu@linaro.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox