public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: OMAP3: Warning: swp{b} use is deprecated for this architecture
Date: Thu, 16 Dec 2010 17:05:52 -0000	[thread overview]
Message-ID: <001b01cb9d43$7f6360a0$7e2a21e0$@deacon@arm.com> (raw)
In-Reply-To: <AANLkTink3TJonOC+cnpRUKKu9_+OBhJKDQ25yvrZZsrQ@mail.gmail.com>

Hi Jean,

> >>> Here is the offending code excerpt:
> >>>
> >>> wait_sem:
> >>>         mov     r0,#1
> >>>         ldr     r1, sdrc_scratchpad_sem
> >>> wait_loop:
> >>>         ldr     r2, [r1]        @ load the lock value
> >>>         cmp     r2, r0          @ is the lock free ?
> >>>         beq     wait_loop       @ not free...
> >>>         swp     r2, r0, [r1]    @ semaphore free so lock it and proceed
> >>>         cmp     r2, r0          @ did we succeed ?
> >>>         beq     wait_sem        @ no - try again
> >>
> >> (untested, as my LDP is useless because of OMAP regressions.)
> >>
> >> wait_sem:
> >>        mov     r0, #1
> >>        ldr     r1, sdrc_scratchpad_sem
> >> wait_loop:
> >>        ldrex   r2, [r1]        @ load lock value
> >>        teq     r2, r0          @ is lock free ( != 1)
> >>        beq     wait_loop       @ no, try again
> >>        strex   r2, r0, [r1]    @ try to lock
> >>        teq     r2, #0          @ did store succeed?
> >>        bne     wait_loop       @ no, try again
> >
> > I'm not familiar with the OMAP code but I recall they needed swp for
> > some synchronisation with external processor (DSP). Is this still the
> > case?
> This code is meant to be used by the new DVFS code which is not merged in yet.

I don't know what you do with this lock held or what the contention
is like, but you probably want a memory barrier immediately after you've
acquired it and another one before you release it.

Will

  reply	other threads:[~2010-12-16 17:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-16 11:49 OMAP3: Warning: swp{b} use is deprecated for this architecture Jean Pihet
2010-12-16 11:56 ` Russell King - ARM Linux
2010-12-16 12:47   ` Catalin Marinas
2010-12-16 14:39     ` Jean Pihet
2010-12-16 17:05       ` Will Deacon [this message]
     [not found]       ` <6188477658179778436@unknownmsgid>
2010-12-16 17:16         ` Jean Pihet
2010-12-16 20:04           ` Dave Martin
2010-12-16 20:10             ` Russell King - ARM Linux
2010-12-16 21:44               ` Jean Pihet
2010-12-17 13:20                 ` Dave Martin

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='001b01cb9d43$7f6360a0$7e2a21e0$@deacon@arm.com' \
    --to=will.deacon@arm.com \
    --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