From: Krzysztof Kozlowski <krzk@kernel.org>
To: Tomasz Figa <tomasz.figa@gmail.com>
Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>,
"open list:COMMON CLK FRAMEWORK" <linux-clk@vger.kernel.org>,
Chanwoo Choi <cw00.choi@samsung.com>,
Stephen Boyd <sboyd@kernel.org>,
Mike Turquette <mturquette@baylibre.com>,
"moderated list: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 v2] clk: samsung: Prevent potential endless loop in the PLL set_rate ops
Date: Tue, 11 Aug 2020 18:46:28 +0200 [thread overview]
Message-ID: <20200811164628.GA7958@kozik-lap> (raw)
In-Reply-To: <CA+Ln22FdFBPU5f0agknRN5xnUtJWOuGARfnsYh3ru_xdjoGC=A@mail.gmail.com>
On Tue, Aug 11, 2020 at 06:41:20PM +0200, Tomasz Figa wrote:
> 2020年8月11日(火) 18:34 Krzysztof Kozlowski <krzk@kernel.org>:
> >
> > On Tue, Aug 11, 2020 at 06:28:18PM +0200, Tomasz Figa wrote:
> > > 2020年8月11日(火) 18:24 Krzysztof Kozlowski <krzk@kernel.org>:
> > > >
> > > > On Tue, Aug 11, 2020 at 02:59:07PM +0200, Tomasz Figa wrote:
> > > > > Hi Sylwester,
> > > > >
> > > > > 2020年8月11日(火) 13:25 Sylwester Nawrocki <s.nawrocki@samsung.com>:
> > > > > >
> > > > > > In the .set_rate callback for some PLLs there is a loop polling state
> > > > > > of the PLL lock bit and it may become an endless loop when something
> > > > > > goes wrong with the PLL. For some PLLs there is already (a duplicated)
> > > > > > code for polling with timeout. This patch replaces that code with
> > > > > > the readl_relaxed_poll_timeout_atomic() macro and moves it to a common
> > > > > > helper function, which is then used for all the PLLs. The downside
> > > > > > of switching to the common macro is that we drop the cpu_relax() call.
> > > > >
> > > > > Tbh. I'm not sure what effect was exactly expected from cpu_relax() in
> > > > > the functions which already had timeout handling. Could someone shed
> > > > > some light on this?
> > > >
> > > > For us, it should not matter much, except:
> > > > 1. when on A9 with ARM_ERRATA_754327, but we do not enable it on our
> > > > platforms,
> > > > 2. it is a generic pattern for busy loops.
> > > >
> > > > On other architectures it could mean something (e.g. yield to other
> > > > hyper-threading CPU).
> > >
> > > Okay, thanks for confirming that it doesn't matter for us.
> > >
> > > Now, I wonder if the readx_poll_*() helpers are supposed to take all
> > > of those into account or on systems which would benefit from such
> > > operations, it would be the caller's responsibility.
> >
> > That's a very good point. In case of ARM_ERRATA_754327, busy waiting
> > should have a barrier thus cpu_relax() is desired. I guess the generic
> > macro for busy waiting therefore should use them.
>
> Is there yet another macro available somewhere or you mean
> read_poll_timeout_atomic()? The latter doesn't include cpu_relax().
Yes, I meant the generic read_poll_timeout_atomic().
> Given that udelay() likely already does this kind of an idle call,
> perhaps it could be as simple as this?
>
> if (__delay_us) \
> udelay(__delay_us); \
> + else \
> + cpu_relax(); \
>
I think udelay does not have it. Delaying by some simple operations
(e.g. multiplication) does not require IO barriers.
> On the other hand, I wonder if there are cases where a call to
> cpu_relax() is not desirable.
Hmmm, it is really a generic pattern all over the kernel, so I doubt
that generic macros should target such case.
Best regards,
Krzysztof
next prev parent reply other threads:[~2020-08-11 16:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20200811112518eucas1p2a751f664a907ac7cd8e1dd235dc2fa54@eucas1p2.samsung.com>
2020-08-11 11:25 ` [PATCH v2] clk: samsung: Prevent potential endless loop in the PLL set_rate ops Sylwester Nawrocki
2020-08-11 12:59 ` Tomasz Figa
2020-08-11 16:23 ` Krzysztof Kozlowski
2020-08-11 16:28 ` Tomasz Figa
2020-08-11 16:34 ` Krzysztof Kozlowski
2020-08-11 16:41 ` Tomasz Figa
2020-08-11 16:46 ` Krzysztof Kozlowski [this message]
2020-08-11 16:45 ` Sylwester Nawrocki
2020-08-11 16:53 ` Tomasz Figa
2020-08-11 17:26 ` Sylwester Nawrocki
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=20200811164628.GA7958@kozik-lap \
--to=krzk@kernel.org \
--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=s.nawrocki@samsung.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.