public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ard Biesheuvel" <ard.biesheuvel@arm.com>
To: Leif Lindholm <leif@nuviainc.com>
Cc: devel@edk2.groups.io, liming.gao@intel.com, lersek@redhat.com,
	philmd@redhat.com, mliska@suse.cz
Subject: Re: [PATCH] MdePkg/Include: AARCH64: disable outline atomics on GCC 10.2+
Date: Fri, 22 May 2020 14:05:02 +0200	[thread overview]
Message-ID: <628c2f09-207c-3146-df98-30ee2426899b@arm.com> (raw)
In-Reply-To: <20200522114101.GA1923@vanye>

On 5/22/20 1:41 PM, Leif Lindholm wrote:
> On Fri, May 22, 2020 at 12:12:02 +0200, Ard Biesheuvel wrote:
>> GCC 10 enabled a feature by default that was introduced in GCC 9,
>> which results in atomic operations to be emitted as function calls
>> to intrinsics provided by a runtime library.
>>
>> Atomics are hardly used in EDK2, which runs on a single CPU anyway,
>> and any benefit that would result from reusing library code that
>> implements these operations is defeated by the fact that every EDK2
>> module will need to have its own copy anyway.
>>
>> So let's disable this feature on GCC versions that support the
>> pragma to do so (GCC 10.2 and up)
>>
>> Link: https://bugzilla.tianocore.org/show_bug.cgi?id=2723
>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
>>
>> ---
>> The GCC support for this pragma has already been pulled into the 10.2
>> release branch. I think we should consider adding this to the stable
>> tag, so that the issue can easily be resolved by upgrading the compiler.
>> Whether we add the intrinsics too is a separate matter, but we can
>> revisit that later.
> 
> Hmm. I am just slightly concerned over referencing GCC 10.2 before GCC
> 10.2 is released.
> Presumably, there will be no ill effects if that pragma is enabled also
> on 10.2, we just won't need it? If so ...
> 

No the pragma is only enabled on 10.2 and later. Older GCCs will choke 
on it.

>>   MdePkg/Include/AArch64/ProcessorBind.h | 11 +++++++++++
>>   1 file changed, 11 insertions(+)
>>
>> diff --git a/MdePkg/Include/AArch64/ProcessorBind.h b/MdePkg/Include/AArch64/ProcessorBind.h
>> index 896bf273ac7a..a3ca8f09e51c 100644
>> --- a/MdePkg/Include/AArch64/ProcessorBind.h
>> +++ b/MdePkg/Include/AArch64/ProcessorBind.h
>> @@ -24,6 +24,17 @@
>>   #pragma pack()
>>   #endif
>>   
>> +#if defined(__GNUC__) && !defined(__clang__)
>> +
>> +//
>> +// Disable GCC outline atomics
>> +// Link: https://bugzilla.tianocore.org/show_bug.cgi?id=2723
>> +//
>> +#if __GNUC__ > 10 || (__GNUC__ == 10 && __GNUC_MINOR__ >= 2)
> 
> Could we do >= 10 here for now, and update to this conditional once
> we've verified that the change does really make it into 10.2?
> 

That would break all GCC 10, even if no users of the outline atomics are 
part of the build.

> If so, I support including it in the stable tag.
> 
> /
>      Leif
> 
>> +#pragma GCC target "no-outline-atomics"
>> +#endif
>> +#endif
>> +
>>   #if defined(_MSC_EXTENSIONS)
>>   
>>   //
>> -- 
>> 2.17.1
>>


  reply	other threads:[~2020-05-22 12:05 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-22 10:12 [PATCH] MdePkg/Include: AARCH64: disable outline atomics on GCC 10.2+ Ard Biesheuvel
2020-05-22 11:41 ` Leif Lindholm
2020-05-22 12:05   ` Ard Biesheuvel [this message]
2020-05-22 12:14     ` Leif Lindholm
2020-05-22 12:42       ` Ard Biesheuvel
2020-05-22 13:01         ` Leif Lindholm
2020-05-22 20:01 ` Laszlo Ersek
2020-05-22 20:05   ` Laszlo Ersek
2020-05-22 22:09     ` [edk2-devel] " Ard Biesheuvel
2020-05-26 14:37       ` Leif Lindholm
2020-05-27  9:12         ` Laszlo Ersek
2020-05-27  9:30           ` Gary Lin
2020-05-28 10:05           ` Leif Lindholm
2020-05-28 20:03             ` Laszlo Ersek
2020-05-29  3:18               ` Liming Gao
2020-05-29  5:46                 ` Ard Biesheuvel
2020-05-29 14:29                   ` Liming Gao
2020-05-29 16:51                     ` Ard Biesheuvel
2020-05-30 15:10                       ` Liming Gao
2020-05-30 15:22                         ` Leif Lindholm
2020-05-30 15:32                           ` Liming Gao
2020-05-30 16:18                             ` Leif Lindholm
2020-06-01 10:31                         ` Ard Biesheuvel
2020-06-01 14:35                           ` Liming Gao

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-list 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=628c2f09-207c-3146-df98-30ee2426899b@arm.com \
    --to=devel@edk2.groups.io \
    /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