From: sashiko-bot@kernel.org
To: "Daniel Carter" <yass27106@gmail.com>
Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org,
robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v3 3/4] ASoC: qcom: lpass macro / soundwire: asynchronous probe with clock retry
Date: Fri, 13 Nov 2026 21:19:51 +0000 [thread overview]
Message-ID: <sashiko-outbox-213709@kernel.org> (raw)
In-Reply-To: <4aaa766cace2455ab6c75ab801df357f@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] soundwire: qcom: infinite recursion in clk_get_retry()
- [Medium] ASoC: qcom: 30s msleep() polling on -EPROBE_DEFER in
lpass_macro_clk_get_retry()
--
commit 6bd2e1b16c32b85c538fe58be015563a596b1d7d
Author: Daniel Carter <yass27106@gmail.com>
ASoC: qcom: lpass macro / soundwire: asynchronous probe with clock retry
This commit adds 30-second polling retry helpers around clock acquisition
and sets PROBE_PREFER_ASYNCHRONOUS in the Qualcomm SoundWire and LPASS
macro drivers.
> diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
> index c31d921f679f9..0bdeb076a2e0e 100644
> --- a/drivers/soundwire/qcom.c
> +++ b/drivers/soundwire/qcom.c
> @@ -21,6 +21,27 @@
> #include <sound/pcm_params.h>
> #include <sound/soc.h>
> #include "bus.h"
> +#include <linux/delay.h>
> +
> +/*
> + * Bounded retry for deferred clock providers. Clock-provider
> + * registration does not trigger deferred-probe retries, so a consumer
> + * that loses the probe-order race stays deferred forever. Wait up to
> + * 30 s for providers that are registered milliseconds later.
> + */
> +static struct clk *clk_get_retry(struct device *dev, const char *id)
> +{
> + struct clk *c;
> + int i;
> +
> + for (i = 0; i < 60; i++) {
> + c = clk_get_retry(dev, id);
> + if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
> + return c;
> + msleep(500);
> + }
> + return c;
> +}
[Severity: High]
Does clk_get_retry() call itself instead of devm_clk_get(dev, id) here?
When qcom_swrm_probe() calls clk_get_retry(dev, "iface"), this recurses
infinitely and overflows the kernel stack. Also, the commit message says
the retry helpers are shared through lpass-macro-common.h, whereas a
separate copy is defined here.
> diff --git a/sound/soc/codecs/lpass-macro-common.h b/sound/soc/codecs/lpass-macro-common.h
> index 10ad682019fa7..83bc7075a281c 100644
> --- a/sound/soc/codecs/lpass-macro-common.h
> +++ b/sound/soc/codecs/lpass-macro-common.h
[ ... ]
> @@ -74,4 +77,41 @@ static inline const char *lpass_macro_get_codec_version_string(int version)
> return "NA";
> }
>
> +
> +/*
> + * Bounded retry for deferred clock providers. Clock-provider
> + * registration does not trigger deferred-probe retries, so a consumer
> + * that loses the probe-order race stays deferred forever. Wait up to
> + * 30 s for providers that are registered milliseconds later.
> + */
> +static inline struct clk *
> +lpass_macro_clk_get_retry(struct device *dev, const char *id)
> +{
> + struct clk *c;
> + int i;
> +
> + for (i = 0; i < 60; i++) {
> + c = devm_clk_get(dev, id);
> + if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
> + return c;
> + msleep(500);
> + }
> + return c;
> +}
> +
> +static inline struct clk *
> +lpass_macro_clk_get_retry_optional(struct device *dev, const char *id)
> +{
> + struct clk *c;
> + int i;
> +
> + for (i = 0; i < 60; i++) {
> + c = devm_clk_get_optional(dev, id);
> + if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
> + return c;
> + msleep(500);
> + }
> + return c;
> +}
> +
> #endif /* __LPASS_MACRO_COMMON_H__ */
[Severity: Medium]
Why poll with msleep(500) for up to 30 seconds on -EPROBE_DEFER instead of
returning -EPROBE_DEFER to the driver core?
Both suppliers mentioned in the commit message (q6dsp_clock_dev_probe() and
va_macro_register_fsgen_output()) register their clock providers inside
platform_driver probe callbacks, which trigger driver_deferred_probe_trigger()
through really_probe() -> driver_bound() once bound. Even with
PROBE_PREFER_ASYNCHRONOUS, sleeping for 30 seconds inside probe while holding
device_lock(dev) stalls async_synchronize_full() and wait_for_device_probe()
callers (such as do_init_module() and kernel_init()) whenever a clock supplier
is delayed, missing firmware, or disabled in DT, and repeats the 30-second
stall on subsequent deferred-probe passes.
--
Sashiko AI review · https://sashiko.dev/#/patchset/1ce6d7664e48413d9a5a8b11a986f746@gmail.com?part=3
next prev parent reply other threads:[~2026-11-13 21:19 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 13:24 [PATCH 0/2] qcom: add Asus Vivobook 16 X1607QA DT + LPASS audio clock retry yass27106
2026-11-13 13:24 ` [PATCH 1/2] arm64: dts: qcom: add device tree for Asus Vivobook 16 X1607QA yass27106
2026-11-13 13:24 ` [PATCH 2/2] ASoC: qcom: lpass macro / soundwire: retry deferred clock acquisition yass27106
2026-11-13 13:43 ` sashiko-bot
2026-11-13 15:04 ` Mark Brown
2026-11-13 13:39 ` [PATCH 1/2] arm64: dts: qcom: add device tree for Asus Vivobook 16 X1607QA sashiko-bot
2026-11-13 15:44 ` Krzysztof Kozlowski
2026-11-13 20:33 ` [PATCH 1/2] arm64: dts: qcom: add device tree for Asus Vivobook 16 X1607QA — v2 series Daniel Carter
2026-11-13 20:33 ` [PATCH v2 1/3] dt-bindings: qcom: document Asus Vivobook 16 X1607QA Daniel Carter
2026-11-13 20:33 ` [PATCH v2 2/3] arm64: dts: qcom: add device tree for " Daniel Carter
2026-11-13 20:33 ` [PATCH v2 3/3] ASoC: qcom: lpass macro / soundwire: retry deferred clock acquisition Daniel Carter
2026-11-13 20:47 ` sashiko-bot
2026-11-13 20:51 ` [PATCH v2 2/3] arm64: dts: qcom: add device tree for Asus Vivobook 16 X1607QA sashiko-bot
2026-11-13 20:39 ` [PATCH v2 1/3] dt-bindings: qcom: document " sashiko-bot
2026-11-13 21:02 ` [PATCH v2 1/3] arm64: dts: qcom: add device tree for Asus Vivobook 16 X1607QA - v3 series Daniel Carter
2026-11-13 21:02 ` [PATCH v3 1/4] dt-bindings: qcom: document Asus Vivobook 16 X1607QA Daniel Carter
2026-11-13 21:02 ` [PATCH v3 2/4] arm64: dts: qcom: add device tree for " Daniel Carter
2026-11-13 21:02 ` [PATCH v3 3/4] ASoC: qcom: lpass macro / soundwire: asynchronous probe with clock retry Daniel Carter
2026-11-13 21:02 ` [PATCH v3 4/4] soundwire: qcom: check clk_prepare_enable() return values Daniel Carter
2026-11-13 21:19 ` sashiko-bot
2026-11-13 21:19 ` sashiko-bot [this message]
2026-11-13 21:06 ` [PATCH v3 1/4] dt-bindings: qcom: document Asus Vivobook 16 X1607QA 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=sashiko-outbox-213709@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=yass27106@gmail.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