Received: by 10.223.185.116 with SMTP id b49csp165529wrg; Thu, 8 Mar 2018 14:58:40 -0800 (PST) X-Google-Smtp-Source: AG47ELseYE4bbltU3U6KkrGVMWiCr/3gtGEIFVpI4rJqNm722igm180FU6iH2alc/oH6mPOx+vuZ X-Received: by 10.98.205.140 with SMTP id o134mr27911917pfg.34.1520549920083; Thu, 08 Mar 2018 14:58:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520549920; cv=none; d=google.com; s=arc-20160816; b=mn5RETooWYVctAhBZ+TkhFcwdqXbP8jJRKfBE2r/Yae+RXsLNaf8OGjYXRgHw30byN truTBhQQKdCgNLE1sxvO8eBEPoEKDWKHPF29YClA+defKMspxJ5LwpvzBfPuNpp32MC7 jK1lpwUK1qKNPvXaHpQG4PKQ0rgU709zhaoncT/ULTpsScGuZVZbw4XgYWyy0Aoz4nt5 3a53Lvhve7uJlViSRTQ7kF+UDc6zoQDk5Syu04eJ6BMXBzR1MjdQBvudVLCtegFrsBdl riy3Xt02JdF8eEgkvJ5hOj40j4NOfqMedJqPfUnl0m9GS2md+ftqtVh8ScGnsjBQrIgS LnWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:mail-followup-to:message-id:subject:cc:to :from:date:dkim-signature:arc-authentication-results; bh=cEdxVgdeYtnnLHMTVG/y8KIoeGTk3glxeX6f2MQTFQE=; b=SyPNN5LA+XX3YkvFp8JAGMLc+pSJOdBOgVdpgnur9J/iVcgIeYbN+GselzkbgM8ayR d09ZtUkjXzT657l66WTS+E//sxSexlPsmcydszWZ9/XNAZ76/k9IXxApXRWrVRA6GrpQ DavXA7tObyl/j2OmTJHlKOdxV/sB4YymaEMatiHNXncPYLoufaUZh5RDilli0MygV2NM mmNqJyuExdZ2DiaCe1Onf9QeMQLioyA9zk3OOwxkdGuTrQnJk7YtxlE02n4k1G91r5tl 9CsPKn8SgswbWNOsrY/hfGt3TLww1YrgjEV4XFI2bHUiRUxDXnQZE+w7lm7mfKFR+aBY 3meQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xff.cz header.s=mail header.b=uMbDawSg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=xff.cz Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l13si13610064pgn.346.2018.03.08.14.58.25; Thu, 08 Mar 2018 14:58:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@xff.cz header.s=mail header.b=uMbDawSg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=xff.cz Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751067AbeCHW5P (ORCPT + 99 others); Thu, 8 Mar 2018 17:57:15 -0500 Received: from vps.xff.cz ([195.181.215.36]:55956 "EHLO vps.xff.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750783AbeCHW5N (ORCPT ); Thu, 8 Mar 2018 17:57:13 -0500 X-Greylist: delayed 593 seconds by postgrey-1.27 at vger.kernel.org; Thu, 08 Mar 2018 17:57:12 EST DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xff.cz; s=mail; t=1520549237; bh=ns8MdA35x07GjFPNwnPpvcnHhJeTi45LjhUKIHN+ks0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=uMbDawSgNwlBMH85AwnG4QRL5m1HD3kpHYYPdfwp2KVBCcNAfsqAiCN4XB+EVXXVJ RrdrSZS/ZL5CAU2rn+EJowPoLZToblfbt+51nZ9IQirKSbW2qAilDB5pGIGUSYsdbm rF4iDv1ys9XW3bgc1G+fs1HjrsSN7D1bl7c/Cv7I= Date: Thu, 8 Mar 2018 23:47:17 +0100 From: =?utf-8?Q?Ond=C5=99ej?= Jirman To: Jernej Skrabec Cc: maxime.ripard@free-electrons.com, wens@csie.org, airlied@linux.ie, robh+dt@kernel.org, mark.rutland@arm.com, mturquette@baylibre.com, sboyd@kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-sunxi@googlegroups.com Subject: Re: [linux-sunxi] [PATCH v3 06/16] drm/sun4i: Release exclusive clock lock when disabling TCON Message-ID: <20180308224717.a6ieadihwh7u5rbu@core.my.home> Mail-Followup-To: Jernej Skrabec , maxime.ripard@free-electrons.com, wens@csie.org, airlied@linux.ie, robh+dt@kernel.org, mark.rutland@arm.com, mturquette@baylibre.com, sboyd@kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-sunxi@googlegroups.com References: <20180301213442.16677-1-jernej.skrabec@siol.net> <20180301213442.16677-7-jernej.skrabec@siol.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180301213442.16677-7-jernej.skrabec@siol.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Thu, Mar 01, 2018 at 10:34:32PM +0100, Jernej Skrabec wrote: > Currently exclusive TCON clock lock is never released, which, for > example, prevents changing resolution on HDMI. > > In order to fix that, release clock when disabling TCON. TCON is always > disabled first before new mode is set. > > Signed-off-by: Jernej Skrabec > --- > drivers/gpu/drm/sun4i/sun4i_tcon.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c > index 1d714c06ec9d..7f6c4125c89f 100644 > --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c > +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c > @@ -102,10 +102,12 @@ static void sun4i_tcon_channel_set_status(struct sun4i_tcon *tcon, int channel, > return; > } > > - if (enabled) > + if (enabled) { > clk_prepare_enable(clk); > - else > + } else { > + clk_rate_exclusive_put(clk); > clk_disable_unprepare(clk); > + } > } At least in the linux-next/master I can't see clk_rate_exclusive_get call: $ git grep 'exclusive' linux-next/master -- drivers/gpu/drm/sun4i linux-next/master:sun4i_hdmi.h: * On sun5i the threshold is exclusive, i.e. does not include, linux-next/master:sun4i_tcon.c: clk_rate_exclusive_put(clk); linux-next/master:sun4i_tcon.c: clk_set_rate_exclusive(tcon->dclk, mode->crtc_clock * 1000); linux-next/master:sun4i_tcon.c: clk_set_rate_exclusive(tcon->sclk1, mode->crtc_clock * 1000); and the kernel complains too: [ 841.915161] ------------[ cut here ]------------ [ 841.915187] WARNING: CPU: 0 PID: 273 at /workspace/megous.com/orangepi-pc/linux-4.16/drivers/clk/clk.c:608 clk_rate_exclusive_put+0x48/0x4c [ 841.915194] CPU: 0 PID: 273 Comm: Xorg Not tainted 4.16.0-rc4-00268-gbac2ecf73ed0 #13 [ 841.915196] Hardware name: Allwinner sun8i Family [ 841.915217] [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [ 841.915228] [] (show_stack) from [] (dump_stack+0x88/0x9c) [ 841.915237] [] (dump_stack) from [] (__warn+0xd4/0xf0) [ 841.915244] [] (__warn) from [] (warn_slowpath_null+0x40/0x48) [ 841.915250] [] (warn_slowpath_null) from [] (clk_rate_exclusive_put+0x48/0x4c) [ 841.915261] [] (clk_rate_exclusive_put) from [] (sun4i_tcon_set_status+0x178/0x2f0) [ 841.915269] [] (sun4i_tcon_set_status) from [] (sun4i_crtc_atomic_disable+0x7c/0xe4) [ 841.915279] [] (sun4i_crtc_atomic_disable) from [] (drm_atomic_helper_commit_modeset_disables+0x390/0x46c) [ 841.915288] [] (drm_atomic_helper_commit_modeset_disables) from [] (drm_atomic_helper_commit_tail_rpm+0x18/0x64) [ 841.915295] [] (drm_atomic_helper_commit_tail_rpm) from [] (commit_tail+0x40/0x6c) [ 841.915302] [] (commit_tail) from [] (drm_atomic_helper_commit+0xbc/0x128) [ 841.915311] [] (drm_atomic_helper_commit) from [] (restore_fbdev_mode_atomic+0x100/0x1fc) [ 841.915319] [] (restore_fbdev_mode_atomic) from [] (drm_fb_helper_dpms+0x50/0x130) [ 841.915328] [] (drm_fb_helper_dpms) from [] (drm_fb_helper_blank+0x54/0x90) [ 841.915337] [] (drm_fb_helper_blank) from [] (fb_blank+0x54/0xa8) [ 841.915343] [] (fb_blank) from [] (do_fb_ioctl+0x360/0x62c) [ 841.915351] [] (do_fb_ioctl) from [] (do_vfs_ioctl+0x9c/0x774) [ 841.915358] [] (do_vfs_ioctl) from [] (SyS_ioctl+0x34/0x58) [ 841.915364] [] (SyS_ioctl) from [] (ret_fast_syscall+0x0/0x4c) [ 841.915368] Exception stack(0xe5fc5fa8 to 0xe5fc5ff0) [ 841.915373] 5fa0: 00674f10 00675460 0000000b 00004611 00000001 00000000 [ 841.915379] 5fc0: 00674f10 00675460 00000001 00000036 00650474 00000000 006504a4 00675df8 [ 841.915382] 5fe0: b61a502c be8acb2c b6192c38 b6b152ec [ 841.915386] ---[ end trace fa81b956197707f8 ]--- It looks like clk_rate_exclusive_put inside sun4i_tcon_channel_set_status is called without first calling some function that would call clk_set_rate_exclusive, leading to unbalanced get/put calls. regards, o. > static void sun4i_tcon_lvds_set_status(struct sun4i_tcon *tcon, > -- > 2.16.2 > > -- > You received this message because you are subscribed to the Google Groups "linux-sunxi" group. > To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe@googlegroups.com. > For more options, visit https://groups.google.com/d/optout.