linux-rockchip.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Yakir Yang <ykk@rock-chips.com>
To: Doug Anderson <dianders@chromium.org>
Cc: "Mark Yao" <yzq@rock-chips.com>,
	"Inki Dae" <inki.dae@samsung.com>,
	"Jingoo Han" <jingoohan1@gmail.com>,
	"Heiko Stuebner" <heiko@sntech.de>,
	"Javier Martinez Canillas" <javier@osg.samsung.com>,
	"Stéphane Marchesin" <marcheu@chromium.org>,
	"Sean Paul" <seanpaul@chromium.org>,
	"Tomasz Figa" <tfiga@chromium.org>,
	"David Airlie" <airlied@linux.ie>,
	"Daniel Vetter" <daniel.vetter@ffwll.ch>,
	"Thierry Reding" <treding@nvidia.com>,
	"Krzysztof Kozlowski" <k.kozlowski@samsung.com>,
	"Emil Velikov" <emil.l.velikov@gmail.com>,
	"Dan Carpenter" <dan.carpenter@oracle.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	linux-samsung-soc <linux-samsung-soc@vger.kernel.org>,
	"open list:ARM/Rockchip SoC..."
	<linux-rockchip@lists.infradead.org>
Subject: Re: [PATCH v4 2/4] drm/rockchip: add an common abstracted PSR driver
Date: Sun, 24 Jul 2016 15:08:50 +0800	[thread overview]
Message-ID: <57946982.7050209@rock-chips.com> (raw)
In-Reply-To: <CAD=FV=U-9WoyZTyj0weDxVkZjQ7ESc+pwJXX=19JuGrOCrsKcQ@mail.gmail.com>

Doug,

On 07/23/2016 12:04 PM, Doug Anderson wrote:
> Yakir,
>
> On Wed, Jul 13, 2016 at 9:15 PM, Yakir Yang <ykk@rock-chips.com> wrote:
>> +static void psr_set_state(struct psr_drv *psr, enum psr_state state)
>> +{
>> +       mutex_lock(&psr->state_mutex);
>> +
>> +       if (psr->state == state) {
>> +               mutex_unlock(&psr->state_mutex);
>> +               return;
>> +       }
>> +
>> +       psr->state = state;
>> +       switch (state) {
>> +       case PSR_ENABLE:
>> +               psr->set(psr->encoder, true);
>> +               break;
>> +
>> +       case PSR_DISABLE:
>> +       case PSR_FLUSH:
>> +               psr->set(psr->encoder, false);
>> +               break;
>> +       };
>> +
>> +       mutex_unlock(&psr->state_mutex);
>> +}
>> +
>> +static void psr_flush_handler(unsigned long data)
>> +{
>> +       struct psr_drv *psr = (struct psr_drv *)data;
>> +
>> +       if (!psr || psr->state != PSR_FLUSH)
>> +               return;
>> +
>> +       psr_set_state(psr, PSR_ENABLE);
> As mentioned in a separate thread, this is probably not OK.
> psr_set_state() grabs a mutex and that might sleep.  ...but
> psr_flush_handler() is a timer.  I'm nearly certain that timers can't
> sleep.
>
> I believe this is the source of "sleeping function called from invalid
> context" that I've seen at times.

Thanks for your reported, i have wrote a patch[0] to fix this problem in 
my v5. If you're happy to review, that would be great ;)

[0]: https://patchwork.kernel.org/patch/9244805/

- Yakir

>
> -Doug
>
>
>

  reply	other threads:[~2016-07-24  7:08 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-14  4:15 [PATCH v4 0/4] Add PSR function support for Analogix/Rockchip DP Yakir Yang
2016-07-14  4:15 ` [PATCH v4 1/4] drm/rockchip: vop: export line flag function Yakir Yang
2016-07-14 14:46   ` Sean Paul
2016-07-15  1:43     ` Yakir Yang
2016-07-14  4:15 ` [PATCH v4 2/4] drm/rockchip: add an common abstracted PSR driver Yakir Yang
2016-07-14 15:14   ` Sean Paul
2016-07-15  1:43     ` Yakir Yang
2016-07-24  7:14     ` Yakir Yang
2016-07-23  4:04   ` Doug Anderson
2016-07-24  7:08     ` Yakir Yang [this message]
2016-07-14  4:15 ` [PATCH v4 3/4] drm/bridge: analogix_dp: add the PSR function support Yakir Yang
2016-07-14 15:23   ` Sean Paul
2016-07-15  9:32     ` Yakir Yang
2016-07-15 10:47       ` Yakir Yang
2016-07-14  4:15 ` [PATCH v4 4/4] drm/rockchip: analogix_dp: implement PSR function Yakir Yang
2016-07-14 15:26   ` Sean Paul
2016-07-15  5:45     ` Yakir Yang
2016-07-15 10:55 ` [PATCH v4.1 1/4] drm/rockchip: vop: export line flag function Yakir Yang
2016-07-15 13:04   ` Sean Paul
2016-07-16  2:30     ` Yakir Yang
2016-07-15 10:55 ` [PATCH v4.1 3/4] drm/bridge: analogix_dp: add the PSR function support Yakir Yang
2016-07-15 13:13   ` Sean Paul
2016-07-16  2:31     ` Yakir Yang

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=57946982.7050209@rock-chips.com \
    --to=ykk@rock-chips.com \
    --cc=airlied@linux.ie \
    --cc=dan.carpenter@oracle.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dianders@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emil.l.velikov@gmail.com \
    --cc=heiko@sntech.de \
    --cc=inki.dae@samsung.com \
    --cc=javier@osg.samsung.com \
    --cc=jingoohan1@gmail.com \
    --cc=k.kozlowski@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=marcheu@chromium.org \
    --cc=seanpaul@chromium.org \
    --cc=tfiga@chromium.org \
    --cc=treding@nvidia.com \
    --cc=yzq@rock-chips.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).