Skip to content

Commit e918a62

Browse files
punitagrawalRussell King
authored andcommitted
ARM: 8135/1: Fix in-correct barrier usage in SWP{B} emulation
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 <[email protected]> Signed-off-by: Punit Agrawal <[email protected]> Signed-off-by: Russell King <[email protected]>
1 parent a040803 commit e918a62

File tree

1 file changed

+0
-15
lines changed

1 file changed

+0
-15
lines changed

arch/arm/kernel/swp_emulate.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,6 @@ static int emulate_swpX(unsigned int address, unsigned int *data,
142142
while (1) {
143143
unsigned long temp;
144144

145-
/*
146-
* Barrier required between accessing protected resource and
147-
* releasing a lock for it. Legacy code might not have done
148-
* this, and we cannot determine that this is not the case
149-
* being emulated, so insert always.
150-
*/
151-
smp_mb();
152-
153145
if (type == TYPE_SWPB)
154146
__user_swpb_asm(*data, address, res, temp);
155147
else
@@ -162,13 +154,6 @@ static int emulate_swpX(unsigned int address, unsigned int *data,
162154
}
163155

164156
if (res == 0) {
165-
/*
166-
* Barrier also required between acquiring a lock for a
167-
* protected resource and accessing the resource. Inserted for
168-
* same reason as above.
169-
*/
170-
smp_mb();
171-
172157
if (type == TYPE_SWPB)
173158
swpbcounter++;
174159
else

0 commit comments

Comments
 (0)