From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.81]) by mx.groups.io with SMTP id smtpd.web10.20875.1590177964010513444 for ; Fri, 22 May 2020 13:06:04 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=H76faGs6; spf=pass (domain: redhat.com, ip: 207.211.31.81, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590177963; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xERhbflcXSFSy1ieg2hpfvqy2kp+HlpManqXHBmwnpE=; b=H76faGs6cDX2RjTkj1tVN59Bm23Vc0NssnXaQJl6T39ejO+AQP4RORA1mzTv37XD5WHBHW sBKGm3fxdSG6vZ0LrFzf8fuzHGtZBr/8symj4ovXL0NIVy1UkT6sl/CWPza0wKsJVzvARe U7xc4uFnhvoMxJKFKTH1uzPoSA2Z4Uw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-169-qnHnHhOYPASXmxNj2tjixA-1; Fri, 22 May 2020 16:06:01 -0400 X-MC-Unique: qnHnHhOYPASXmxNj2tjixA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1FF0980183C; Fri, 22 May 2020 20:06:00 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-112-40.ams2.redhat.com [10.36.112.40]) by smtp.corp.redhat.com (Postfix) with ESMTP id C69839CB9; Fri, 22 May 2020 20:05:58 +0000 (UTC) Subject: Re: [PATCH] MdePkg/Include: AARCH64: disable outline atomics on GCC 10.2+ From: "Laszlo Ersek" To: Ard Biesheuvel , devel@edk2.groups.io Cc: liming.gao@intel.com, leif@nuviainc.com, philmd@redhat.com, mliska@suse.cz References: <20200522101202.15016-1-ard.biesheuvel@arm.com> <36effdcd-91a7-da00-855d-570e64d650b8@redhat.com> Message-ID: Date: Fri, 22 May 2020 22:05:57 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <36effdcd-91a7-da00-855d-570e64d650b8@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 05/22/20 22:01, Laszlo Ersek wrote: > On 05/22/20 12:12, 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 >> --- >> 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. >> >> 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) >> +#pragma GCC target "no-outline-atomics" >> +#endif >> +#endif >> + >> #if defined(_MSC_EXTENSIONS) >> >> // >> > > Reviewed-by: Laszlo Ersek > > But I think it should be merged later, after GCC 10.2 is out. > > (Obviously I don't "insist" that we follow this approach, I'm just OK > with it.) Oh and I think both this patch and the assembly language implementation for the atomics should be delayed after the stable tag. gcc-10 is a new toolchain; so even if we don't introduce a new toolchain tag such as GCC10 for it, whatever we do in order to make it work, that's feature enablement in my book. Thanks, Laszlo