linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linus.walleij@linaro.org (Linus Walleij)
To: linux-arm-kernel@lists.infradead.org
Subject: cpu_relax in busy loops question
Date: Wed, 1 Feb 2012 21:17:12 +0100	[thread overview]
Message-ID: <CACRpkdZfdx9tDgp8HfVSdEFXdvpsPDiWdpg2iyFYesgpBjsqyw@mail.gmail.com> (raw)
In-Reply-To: <4F292345.8070800@linaro.org>

On Wed, Feb 1, 2012 at 12:34 PM, Daniel Lezcano
<daniel.lezcano@linaro.org> wrote:
>
> Hi Linus,
>
> While looking at the drivers/mfd/db8500-prcmu.c file I noticed:
>
>
> ?595 ? ? ? ? /* Grab the HW semaphore. */
> ?596 ? ? ? ? while ((readl(PRCM_SEM) & PRCM_SEM_PRCM_SEM) != 0)
> ?597 ? ? ? ? ? ? ? ? cpu_relax();
>
>
> I was wondering why is cpu_relax needed here as readl does a memory barrier
> ? I thought the cpu_relax function was related to the x86 to consume less
> power with an optimization of the "rep nop" loops or/and do a memory
> barrier.
>
> Should a busy-loop be always with cpu_relax ?

Last time we discussed it ar LAKML I think we came to the conclusion
that while cpu_relax() has very little semantic meaning on ARM, it
is still nice to have from a readability and maintenance point of view,
since it is pretty clear what we're trying to do.

But I will stand corrected...

Yours,
Linus Walleij

  reply	other threads:[~2012-02-01 20:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-01 11:34 cpu_relax in busy loops question Daniel Lezcano
2012-02-01 20:17 ` Linus Walleij [this message]
2012-02-02  8:47   ` Daniel Lezcano

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=CACRpkdZfdx9tDgp8HfVSdEFXdvpsPDiWdpg2iyFYesgpBjsqyw@mail.gmail.com \
    --to=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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).