Skip to content

Commit

Permalink
ARM: 8135/1: Fix in-correct barrier usage in SWP{B} emulation
Browse files Browse the repository at this point in the history
According to the ARM ARMv7, explicit barriers are necessary when using
synchronisation primitives such as SWP{B}. The use of these
instructions does not automatically imply a barrier and any ordering
requirements by the software must be explicitly expressed with the use
of suitable barriers.

Based on this, remove the barriers from SWP{B} emulation.

Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Punit Agrawal <punit.agrawal@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
  • Loading branch information
Punit Agrawal authored and Russell King committed Sep 12, 2014
1 parent a040803 commit e918a62
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions arch/arm/kernel/swp_emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,6 @@ static int emulate_swpX(unsigned int address, unsigned int *data,
while (1) {
unsigned long temp;

/*
* Barrier required between accessing protected resource and
* releasing a lock for it. Legacy code might not have done
* this, and we cannot determine that this is not the case
* being emulated, so insert always.
*/
smp_mb();

if (type == TYPE_SWPB)
__user_swpb_asm(*data, address, res, temp);
else
Expand All @@ -162,13 +154,6 @@ static int emulate_swpX(unsigned int address, unsigned int *data,
}

if (res == 0) {
/*
* Barrier also required between acquiring a lock for a
* protected resource and accessing the resource. Inserted for
* same reason as above.
*/
smp_mb();

if (type == TYPE_SWPB)
swpbcounter++;
else
Expand Down

0 comments on commit e918a62

Please sign in to comment.