From: "Andreas Färber" <afaerber@suse.de>
To: Mark Brown <broonie@kernel.org>
Cc: Ben Whitten <ben.whitten@gmail.com>,
devicetree <devicetree@vger.kernel.org>,
"David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@codeaurora.org>,
"linux-lpwan@lists.infradead.org"
<linux-lpwan@lists.infradead.org>,
linux-kernel@vger.kernel.org, starnight@g.ncu.edu.tw,
linux-clk <linux-clk@vger.kernel.org>,
"linux-spi@vger.kernel.org" <linux-spi@vger.kernel.org>,
Maxime Ripard <maxime.ripard@bootlin.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
Russell King <linux@armlinux.org.uk>
Subject: Re: [PATCH v3 lora-next 5/5] net: lora: sx125x sx1301: allow radio to register as a clk provider
Date: Mon, 31 Dec 2018 23:56:40 +0100 [thread overview]
Message-ID: <ae7dd20c-777e-e043-127c-819fa0ae4792@suse.de> (raw)
In-Reply-To: <20181231175034.GI1846@sirena.org.uk>
Am 31.12.18 um 18:50 schrieb Mark Brown:
> On Sun, Dec 30, 2018 at 11:55:46AM +0100, Andreas Färber wrote:
>> Given that observed symptoms were CPU stalls, workqueue hangs and RCU
>> problems, requiring a power-cycle to recover, I wonder whether we are
>> running into some atomic/locking issue with clk_enable()? Is it valid at
>> all to use SPI/regmap for clk_enable()? If it is, is there a known issue
>> specific to spi-sun6i (A64) in 4.20.0?
>> I already tried setting .disable_locking = true in both regmap_configs.
>> Any suggestions how to further debug?
>
> You can't use SPI for clk_enable(), clk_enable() needs to be doable in
> atomic context since we need to wait for the bus operations to complete
> (you can start SPI transfers in atomic context but you still need to
> wait for them to complete). Any clocks that are only accessible via a
> slow bus like I2C or SPI need to do the enable/disable in the
> prepare/unprepare operations which aren't done in atomic context.
>
> regmap can be used in atomic contexts, though you need to configure it
> to use spinlocks instead of mutexes and ensure that no register cache
> allocations happen during I/O (eg, by providing defaults for all
> registers or by not using a cache).
We have .cache_type = REGCACHE_NONE on both bus and spi regmap_configs.
I moved the regmap_field_write() from .enable to .prepare and set
.fast_io = true on both regmap_configs to force using spinlocks, but
same hang as in .enable before...
And same if I set .disable_locking = true on both.
Given that it works with one SPI driver and not with the other,
independent of the locking options applied, I assume my symptoms are not
a regmap-layer issue.
Is it allowed during a .prepare operation to call the mentioned
clk_get_rate(), which ends up calling clk_prepare_lock()?
According to my debug output in spi-sun6i.c our hanging
regmap_field_write() ends up calling sun6i_transfer_one() three times,
the first two look okay, but the third one doesn't make it past the
clk_get_rate() or following if block. [But for now some fireworks...]
Regards,
Andreas
--
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
next prev parent reply other threads:[~2018-12-31 22:56 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1539361567-3602-1-git-send-email-ben.whitten@lairdtech.com>
2018-10-12 16:26 ` [PATCH v3 lora-next 1/5] regmap: Add regmap_noinc_write API Ben Whitten
2018-10-18 16:59 ` Andreas Färber
2018-10-18 17:18 ` Mark Brown
2018-10-12 16:26 ` [PATCH v3 lora-next 2/5] net: lora: sx1301: replace burst spi functions with regmap_noinc Ben Whitten
2018-10-12 16:26 ` [PATCH v3 lora-next 3/5] net: lora: sx1301: convert to using regmap fields for bit ops Ben Whitten
2018-10-12 16:26 ` [PATCH v3 lora-next 4/5] net: lora: sx125x: convert to regmap fields Ben Whitten
2018-10-12 16:26 ` [PATCH v3 lora-next 5/5] net: lora: sx125x sx1301: allow radio to register as a clk provider Ben Whitten
2018-12-29 19:25 ` Andreas Färber
2018-12-29 20:16 ` Andreas Färber
2018-12-30 10:55 ` Andreas Färber
2018-12-30 19:40 ` [PATCH lora-next] net: lora: sx125x: Add error handling for clock-output-names Andreas Färber
2018-12-30 19:44 ` [PATCH lora-next] net: lora: sx1301: Fix clk32m handling Andreas Färber
2018-12-30 19:47 ` [PATCH lora-next] net: lora: sx125x: Clean up clock provider Andreas Färber
2018-12-31 13:27 ` [PATCH v3 lora-next 5/5] net: lora: sx125x sx1301: allow radio to register as a clk provider Andreas Färber
2018-12-31 17:50 ` Mark Brown
2018-12-31 22:56 ` Andreas Färber [this message]
2019-01-02 0:44 ` Andreas Färber
2019-01-03 12:37 ` Mark Brown
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=ae7dd20c-777e-e043-127c-819fa0ae4792@suse.de \
--to=afaerber@suse.de \
--cc=ben.whitten@gmail.com \
--cc=broonie@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-lpwan@lists.infradead.org \
--cc=linux-spi@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=maxime.ripard@bootlin.com \
--cc=mturquette@baylibre.com \
--cc=netdev@vger.kernel.org \
--cc=sboyd@codeaurora.org \
--cc=starnight@g.ncu.edu.tw \
/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).