From: Sylwester Nawrocki <s.nawrocki@samsung.com>
To: Stephen Boyd <sboyd@kernel.org>, Tomasz Figa <tomasz.figa@gmail.com>
Cc: COMMON CLK FRAMEWORK <linux-clk@vger.kernel.org>,
Chanwoo Choi <cw00.choi@samsung.com>,
Mike Turquette <mturquette@baylibre.com>,
SAMSUNG SOC CLOCK DRIVERS <linux-samsung-soc@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
Marek Szyprowski <m.szyprowski@samsung.com>
Subject: Re: [PATCH] clk: samsung: Prevent potential endless loop in the PLL set_rate ops
Date: Mon, 10 Aug 2020 18:19:14 +0200 [thread overview]
Message-ID: <6736f3d1-31de-6be4-2b1b-50c776025b72@samsung.com> (raw)
In-Reply-To: <159683164115.1360974.9195158180168134577@swboyd.mtv.corp.google.com>
On 07.08.2020 22:20, Stephen Boyd wrote:
> Quoting Sylwester Nawrocki (2020-08-07 10:06:08)
>> On 8/6/20 18:11, Tomasz Figa wrote:
>>>> --- a/drivers/clk/samsung/clk-pll.c
>>>> +++ b/drivers/clk/samsung/clk-pll.c
>>>> @@ -63,6 +63,27 @@ static long samsung_pll_round_rate(struct clk_hw *hw,
>>>> return rate_table[i - 1].rate;
>>>> }
>>>>
>>>> +static int samsung_pll_lock_wait(struct samsung_clk_pll *pll,
>>>> + unsigned int reg_mask)
>>>> +{
>>>> + ktime_t timeout;
>>>> +
>>>> + /* Wait until the PLL is in steady locked state */
>>>> + timeout = ktime_add_ms(ktime_get(), PLL_TIMEOUT_MS);
>>>> +
>>>> + while (!(readl_relaxed(pll->con_reg) & reg_mask)) {
>>>> + if (ktime_after(ktime_get(), timeout)) {
>>>> + pr_err("%s: Could not lock PLL %s\n",
>>>> + __func__, clk_hw_get_name(&pll->hw));
>>>> + return -EFAULT;
>>>> + }
>>>> +
>>>> + cpu_relax();
>>>> + }
>>
>>> Thanks for the patch! Good to have this consolidated. How about going
>>> one step further and using the generic
>>> readl_relaxed_poll_timeout_atomic() helper?
>>
>> Might be a good suggestion, I was considering those helpers but ended
>> up not using them in the patch. The cpu_relax() call might also not be
>> really needed now, when there is the ktime code within the loop.
>> Having multiple occurrences of readl_relaxed_poll_timeout_atomic() could
>> increase the code size due to inlining. How about keeping the
>> samsung_pll_lock_wait() function and just changing its implementation?
>
> None of these concerns are mentioned in the commit text. And they seem
> like problems that should be addressed if they're actually problems vs.
> avoiding a common macro and not mentioning them.
Sure, I will improve the commit text, I just didn't investigate in detail
how the common macro could or could not be used before Tomasz's review.
next prev parent reply other threads:[~2020-08-10 16:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20200806160653eucas1p2b7fd860f5d89589cf9df0ad0f8d3981f@eucas1p2.samsung.com>
2020-08-06 16:06 ` Sylwester Nawrocki
2020-08-06 16:11 ` Tomasz Figa
2020-08-07 17:06 ` Sylwester Nawrocki
2020-08-08 17:13 ` Tomasz Figa
[not found] ` <159683164115.1360974.9195158180168134577@swboyd.mtv.corp.google.com>
2020-08-10 16:19 ` Sylwester Nawrocki [this message]
2020-08-07 1:32 ` Chanwoo Choi
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=6736f3d1-31de-6be4-2b1b-50c776025b72@samsung.com \
--to=s.nawrocki@samsung.com \
--cc=b.zolnierkie@samsung.com \
--cc=cw00.choi@samsung.com \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=mturquette@baylibre.com \
--cc=sboyd@kernel.org \
--cc=tomasz.figa@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
all inboxes | Powered by JetHome®