linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Geert Uytterhoeven" <geert+renesas@glider.be>,
	"Stephen Boyd" <sboyd@kernel.org>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski@linaro.org>,
	"Tomasz Figa" <tomasz.figa@gmail.com>,
	"Sylwester Nawrocki" <s.nawrocki@samsung.com>,
	"Will Deacon" <will@kernel.org>,
	"Wolfram Sang" <wsa+renesas@sang-engineering.com>,
	"Dejin Zheng" <zhengdejin5@gmail.com>,
	"Kai-Heng Feng" <kai.heng.feng@canonical.com>,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Heiko Carstens" <hca@linux.ibm.com>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Russell King" <linux@armlinux.org.uk>
Cc: linux-arm-kernel@lists.infradead.org,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
	Linux-Arch <linux-arch@vger.kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH resend] iopoll: Call cpu_relax() in busy loops
Date: Thu, 26 Jan 2023 13:07:29 +0100	[thread overview]
Message-ID: <38a9a8f8-6bc7-42aa-b5e2-0148371e29c8@app.fastmail.com> (raw)
In-Reply-To: <8d492ee4a391bd089a01c218b0b4e05cf8ea593c.1674729407.git.geert+renesas@glider.be>

On Thu, Jan 26, 2023, at 11:45, Geert Uytterhoeven wrote:
> It is considered good practice to call cpu_relax() in busy loops, see
> Documentation/process/volatile-considered-harmful.rst.  This can not
> only lower CPU power consumption or yield to a hyperthreaded twin
> processor, but also allows an architecture to mitigate hardware issues
> (e.g. ARM Erratum 754327 for Cortex-A9 prior to r2p0) in the
> architecture-specific cpu_relax() implementation.
>
> As the iopoll helpers lack calls to cpu_relax(), people are sometimes
> reluctant to use them, and may fall back to open-coded polling loops
> (including cpu_relax() calls) instead.
>
> Fix this by adding calls to cpu_relax() to the iopoll helpers:
>   - For the non-atomic case, it is sufficient to call cpu_relax() in
>     case of a zero sleep-between-reads value, as a call to
>     usleep_range() is a safe barrier otherwise.
>   - For the atomic case, cpu_relax() must be called regardless of the
>     sleep-between-reads value, as there is no guarantee all
>     architecture-specific implementations of udelay() handle this.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Acked-by: Arnd Bergmann <arnd@arndb.de>

      parent reply	other threads:[~2023-01-26 12:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-26 10:45 [PATCH resend] iopoll: Call cpu_relax() in busy loops Geert Uytterhoeven
2023-01-26 12:03 ` Peter Zijlstra
2023-01-26 12:07 ` Arnd Bergmann [this message]

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=38a9a8f8-6bc7-42aa-b5e2-0148371e29c8@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=geert+renesas@glider.be \
    --cc=hca@linux.ibm.com \
    --cc=kai.heng.feng@canonical.com \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=npiggin@gmail.com \
    --cc=peterz@infradead.org \
    --cc=s.nawrocki@samsung.com \
    --cc=sboyd@kernel.org \
    --cc=tomasz.figa@gmail.com \
    --cc=will@kernel.org \
    --cc=wsa+renesas@sang-engineering.com \
    --cc=zhengdejin5@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;
as well as URLs for NNTP newsgroup(s).