This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 1/2] x86,s390: add compiler memory barriers when expanding atomic_thread_fence (PR 80640)
- From: Jeff Law <law at redhat dot com>
- To: Alexander Monakov <amonakov at ispras dot ru>
- Cc: gcc-patches at gcc dot gnu dot org, Richard Henderson <rth at redhat dot com>, Uros Bizjak <ubizjak at gmail dot com>
- Date: Mon, 31 Jul 2017 09:50:11 -0600
- Subject: Re: [PATCH 1/2] x86,s390: add compiler memory barriers when expanding atomic_thread_fence (PR 80640)
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=law at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A303568FEE
- References: <alpine.LNX.2.20.13.1705101620050.11444@monopod.intra.ispras.ru> <alpine.LNX.2.20.13.1705171248330.32526@monopod.intra.ispras.ru> <alpine.LNX.2.20.13.1705261358000.13474@monopod.intra.ispras.ru> <793d0ecb-7fbf-6670-c45b-9b1d436fc2fb@redhat.com> <alpine.LNX.2.20.13.1707262011470.12525@monopod.intra.ispras.ru> <499f27d4-7abc-a0a1-34af-2de2710058dc@redhat.com> <alpine.LNX.2.20.13.1707262040150.12525@monopod.intra.ispras.ru>
On 07/26/2017 12:13 PM, Alexander Monakov wrote:
> On Wed, 26 Jul 2017, Jeff Law wrote:
>> I'm not sure what you mean by extraneous compiler barriers -- isn't the
>> worst case scenario here that the target emits them as well? So there
>> would be an extraneous one in that case, but that ought to be a "don't
>> care".
>
> Yes, exactly this.
>
>> In the middle end patch, do we need a barrier before the fence as well?
>> The post-fence barrier prevents reordering the fence with anything which
>> follows the fence. But do we have to also prevent reordering the fence
>> with prior instructions with any of the memory models? This isn't my
>> area of expertise, so if it's dumb question, don't hesitate to let me
>> know :-)
>
> That depends on how pessimistic we want to be with respect to backend
> getting it wrong. My expectation here is that if a backend emits non-empty
> RTL, the produced sequence for the fence itself acts as a compiler memory
> barrier.
Perhaps. But do we really want to rely on that? EMitting a scheduling
barrier prior to these atomics is virtually free.
Jeff