[PATCH] ARM: Correct WFE() in asm/spinlock.h for Thumb-2
Dave Martin
dave.martin at linaro.org
Wed Feb 9 12:00:48 EST 2011
On Wed, Feb 9, 2011 at 4:38 PM, Nicolas Pitre <nicolas.pitre at linaro.org> wrote:
> On Tue, 8 Feb 2011, Dave Martin wrote:
>
>> The content for ALT_SMP() in the definition of WFE() expands to 6
>> bytes (IT cc ; WFEcc.W), which breaks the assumptions of the fixup
>> code, leading to lockups when the affected code gets run.
>>
>> This patch works around the problem by explicitly using an
>> IT + WFEcc.N pair.
>>
>> Signed-off-by: Dave Martin <dave.martin at linaro.org>
>> ---
>> arch/arm/include/asm/spinlock.h | 7 ++++++-
>> 1 files changed, 6 insertions(+), 1 deletions(-)
>>
>> diff --git a/arch/arm/include/asm/spinlock.h b/arch/arm/include/asm/spinlock.h
>> index da1af52..7cba79c 100644
>> --- a/arch/arm/include/asm/spinlock.h
>> +++ b/arch/arm/include/asm/spinlock.h
>> @@ -18,7 +18,12 @@
>>
>> #ifdef CONFIG_THUMB2_KERNEL
>> #define SEV ALT_SMP("sev.w", "nop.w")
>> -#define WFE(cond) ALT_SMP("wfe" cond ".w", "nop.w")
>> +#define WFE(cond) ALT_SMP( \
>> + "it " cond "\n\t" \
>> + "wfe" cond ".n", \
>> + \
>> + "nop.w" \
>> +)
>
> In addition to a comment inline for this as others have suggested
> already, I'd write it differently to save some realestate:
>
> #define WFE(cond) ALT_SMP("it " cond " ; wfe" cond ".n", "nop.w")
Because of the subtlety of this, I wanted it to be presented in as
clear a way as possible.
Russell, the patch is in your patch system--- if you prefer the
shortened form, fell free to reject the existing patch and I'll
repost.
Cheers
---Dave
More information about the linux-arm-kernel
mailing list