public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: jeffy <jeffy.chen@rock-chips.com>
To: Heiko Stuebner <heiko@sntech.de>, Shawn Lin <shawn.lin@rock-chips.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	Marc Zyngier <marc.zyngier@arm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-pci@vger.kernel.org, linux-rockchip@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Douglas Anderson <dianders@chromium.org>,
	Brian Norris <briannorris@chromium.org>
Subject: Re: [RFC PATCH] PCI: rockchip: fix system hang up if activate CONFIG_DEBUG_SHIRQ
Date: Thu, 10 Aug 2017 17:40:35 +0800	[thread overview]
Message-ID: <598C2A13.8060504@rock-chips.com> (raw)
In-Reply-To: <5781211.7fcSyQo7bC@phil>

Hi Heiko,

On 08/10/2017 05:27 PM, Heiko Stuebner wrote:
> Hi Shawn,
>
> Am Donnerstag, 10. August 2017, 16:21:13 CEST schrieb Shawn Lin:
>> >With CONFIG_DEBUG_SHIRQ enabled, the irq tear down routine
>> >would still access the irq handler registed as a shard irq.
>> >Per the comment within the function of __free_irq, it says
>> >"It's a shared IRQ -- the driver ought to be prepared for
>> >an IRQ event to happen even now it's being freed". However
>> >when failing to probe the driver, it may disable the clock
>> >for accessing the register and the following check for shared
>> >irq state would call the irq handler which accesses the register
>> >w/o the clk enabled. That will hang the system forever.
> The key point would be to fix the ordering. So you could also just use
> devm_add_action to move the clock-disabling into a callback that
> gets run at the appropriate time, as devm does the shutdown in the
> exact opposite order this should fix your problem.
>
> So until all clocks could be enabled, you would disable them manually
> and after that rely on the devm_action to fire at the appropriate time.
>
> ret = clk_prepare_enable(clk1);
> if (ret < 0 )
> 	return ret;
>
> ret = clk_prepare_enable(clk2);
> if (ret < 0) {
> 	clk_disable_unprepare(clk1);
> 	return ret;
> }
>
> devm_add_action_or_reset(dev, rk_pcie_disable_clocks);

right, and we should also move request irq after this, so the devres 
core can release them in reverse.

and we should double check would those clks be the only thing that irq 
handler required...
>
> The rockchip crypto driver [0] shows how this could be done.
>
>
> Heiko
>
> [0]http://elixir.free-electrons.com/linux/latest/source/drivers/crypto/rockchip/rk3288_crypto.c#L307
>

  reply	other threads:[~2017-08-10  9:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-10  8:21 [RFC PATCH] PCI: rockchip: fix system hang up if activate CONFIG_DEBUG_SHIRQ Shawn Lin
2017-08-10  8:39 ` jeffy
2017-08-10  9:14   ` Shawn Lin
2017-08-10  9:25     ` jeffy
2017-08-10  9:27 ` Heiko Stuebner
2017-08-10  9:40   ` jeffy [this message]
2017-08-10 11:04   ` Shawn Lin

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=598C2A13.8060504@rock-chips.com \
    --to=jeffy.chen@rock-chips.com \
    --cc=bhelgaas@google.com \
    --cc=briannorris@chromium.org \
    --cc=dianders@chromium.org \
    --cc=heiko@sntech.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=marc.zyngier@arm.com \
    --cc=shawn.lin@rock-chips.com \
    --cc=tglx@linutronix.de \
    /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