[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fd71c136-4c1c-5c4d-003f-20cb8c7cf17f@csgroup.eu>
Date: Thu, 25 Aug 2022 11:19:06 +0000
From: Christophe Leroy <christophe.leroy@...roup.eu>
To: "Naveen N. Rao" <naveen.n.rao@...ux.ibm.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Uros Bizjak <ubizjak@...il.com>,
"x86@...nel.org" <x86@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>
CC: "linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>,
"sv@...ux.ibm.com" <sv@...ux.ibm.com>
Subject: Re: [PATCH] compiler-gcc.h: Remove ancient workaround for gcc PR
58670
Le 25/08/2022 à 12:30, Naveen N. Rao a écrit :
> Uros Bizjak wrote:
>> The workaround for 'asm goto' miscompilation introduces a compiler
>> barrier quirk that inhibits many useful compiler optimizations. For
>> example, __try_cmpxchg_user compiles to:
>>
>> 11375: 41 8b 4d 00 mov 0x0(%r13),%ecx
>> 11379: 41 8b 02 mov (%r10),%eax
>> 1137c: f0 0f b1 0a lock cmpxchg %ecx,(%rdx)
>> 11380: 0f 94 c2 sete %dl
>> 11383: 84 d2 test %dl,%dl
>> 11385: 75 c4 jne 1134b <...>
>> 11387: 41 89 02 mov %eax,(%r10)
>>
>> where the barrier inhibits flags propagation from asm when
>> compiled with gcc-12.
>>
>> When the mentioned quirk is removed, the following code is generated:
>>
>> 11553: 41 8b 4d 00 mov 0x0(%r13),%ecx
>> 11557: 41 8b 02 mov (%r10),%eax
>> 1155a: f0 0f b1 0a lock cmpxchg %ecx,(%rdx)
>> 1155e: 74 c9 je 11529 <...>
>> 11560: 41 89 02 mov %eax,(%r10)
>>
>> The refered compiler bug:
>>
>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
>>
>> was fixed for gcc-4.8.2.
>>
>> Current minimum required version of GCC is version 5.1 which has
>> the above 'asm goto' miscompilation fixed, so remove the workaround.
>>
>> Signed-off-by: Uros Bizjak <ubizjak@...il.com>
>> Cc: Andrew Morton <akpm@...ux-foundation.org>
It's unlikely that asm goto bug was completely fixed in 4.8 because it's
been encountered with gcc 4.9.3 and 4.9.4, see commit 1344a232016d
("powerpc: Use asm_goto_volatile for put_user()")
Christophe
Powered by blists - more mailing lists