From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Jiada Wang <jiada_wang@mentor.com>,
Kevin Hilman <khilman@kernel.org>,
Len Brown <len.brown@intel.com>, Pavel Machek <pavel@ucw.cz>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Linux PM <linux-pm@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Morimoto <kuninori.morimoto.gx@renesas.com>,
Geert Uytterhoeven <geert@linux-m68k.org>
Subject: Re: [PATCH 1/1] PM / Domains: Avoid a potential deadlock
Date: Fri, 22 Mar 2019 00:27:33 +0100 [thread overview]
Message-ID: <14940273.hSlFUEJerr@aspire.rjw.lan> (raw)
In-Reply-To: <CAPDyKFodmgkpLkJDiMqh3vm+Ynuo852biZkY7uB5sm9UeAJ63A@mail.gmail.com>
On Wednesday, March 13, 2019 8:35:02 AM CET Ulf Hansson wrote:
> On Tue, 12 Mar 2019 at 07:51, Jiada Wang <jiada_wang@mentor.com> wrote:
> >
> > Lockdep warns that prepare_lock and genpd->mlock can cause a deadlock
> > the deadlock scenario is like following:
> > First thread is probing cs2000
> > cs2000_probe()
> > clk_register()
> > __clk_core_init()
> > clk_prepare_lock() ----> acquires prepare_lock
> > cs2000_recalc_rate()
> > i2c_smbus_read_byte_data()
> > rcar_i2c_master_xfer()
> > dma_request_chan()
> > rcar_dmac_of_xlate()
> > rcar_dmac_alloc_chan_resources()
> > pm_runtime_get_sync()
> > __pm_runtime_resume()
> > rpm_resume()
> > rpm_callback()
> > genpd_runtime_resume() ----> acquires genpd->mlock
> >
> > Second thread is attaching any device to the same PM domain
> > genpd_add_device()
> > genpd_lock() ----> acquires genpd->mlock
> > cpg_mssr_attach_dev()
> > of_clk_get_from_provider()
> > __of_clk_get_from_provider()
> > __clk_create_clk()
> > clk_prepare_lock() ----> acquires prepare_lock
> >
> > Since currently no PM provider access genpd's critical section
> > in .attach_dev, and .detach_dev callbacks, so there is no need to protect
> > these two callbacks with genpd->mlock.
> > This patch avoids a potential deadlock by moving out .attach_dev and .detach_dev
> > from genpd->mlock, so that genpd->mlock won't be held when prepare_lock is acquired
> > in .attach_dev and .detach_dev
>
> Thanks for the detailed description, this seems like a reasonable change to me!
>
> >
> > Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
>
> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Patch applied, thanks!
next prev parent reply other threads:[~2019-03-21 23:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-12 6:51 [PATCH 1/1] PM / Domains: Avoid a potential deadlock Jiada Wang
2019-03-13 7:35 ` Ulf Hansson
2019-03-21 23:27 ` Rafael J. Wysocki [this message]
2019-03-13 14:45 ` Geert Uytterhoeven
2019-03-13 19:52 ` Ulf Hansson
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=14940273.hSlFUEJerr@aspire.rjw.lan \
--to=rjw@rjwysocki.net \
--cc=geert@linux-m68k.org \
--cc=gregkh@linuxfoundation.org \
--cc=jiada_wang@mentor.com \
--cc=khilman@kernel.org \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=ulf.hansson@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