From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id BE7863858006 for ; Tue, 12 Oct 2021 09:23:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BE7863858006 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-48-DtaemqgYNR-vmVaqbyf3XA-1; Tue, 12 Oct 2021 05:23:27 -0400 X-MC-Unique: DtaemqgYNR-vmVaqbyf3XA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3EB7A112A6A0; Tue, 12 Oct 2021 09:23:26 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.193.109]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CE2EC60854; Tue, 12 Oct 2021 09:23:25 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.16.1/8.16.1) with ESMTPS id 19C9NMvT1082031 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 12 Oct 2021 11:23:23 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.16.1/8.16.1/Submit) id 19C9NMmD1082030; Tue, 12 Oct 2021 11:23:22 +0200 Date: Tue, 12 Oct 2021 11:23:22 +0200 From: Jakub Jelinek To: Julian Brown Cc: gcc-patches@gcc.gnu.org, Thomas Schwinge Subject: Re: [PATCH 01/11] libgomp: Release device lock on cbuf error path Message-ID: <20211012092322.GD304296@tucnak> Reply-To: Jakub Jelinek References: MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Oct 2021 09:23:29 -0000 On Fri, Oct 01, 2021 at 10:07:48AM -0700, Julian Brown wrote: > This patch releases the device lock on a sanity-checking error path in > transfer combining (cbuf) handling in libgomp:target.c. This shouldn't > happen when handling well-formed mapping clauses, but erroneous clauses > can currently cause a hang if the condition triggers. > > Tested with offloading to NVPTX. OK? > > 2021-09-29 Julian Brown > > libgomp/ > * target.c (gomp_copy_host2dev): Release device lock on cbuf > error path. Ok, thanks. This doesn't seem to depend on anything else, so can be committed separately right away. > diff --git a/libgomp/target.c b/libgomp/target.c > index 65bb40100e5..84c6fdf2c47 100644 > --- a/libgomp/target.c > +++ b/libgomp/target.c > @@ -385,7 +385,10 @@ gomp_copy_host2dev (struct gomp_device_descr *devicep, > else if (cbuf->chunks[middle].start <= doff) > { > if (doff + sz > cbuf->chunks[middle].end) > - gomp_fatal ("internal libgomp cbuf error"); > + { > + gomp_mutex_unlock (&devicep->lock); > + gomp_fatal ("internal libgomp cbuf error"); > + } > memcpy ((char *) cbuf->buf + (doff - cbuf->chunks[0].start), > h, sz); > return; > -- > 2.29.2 Jakub