public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tobias Burnus <burnus@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc/devel/omp/gcc-12] libgomp/nvptx: Prepare for reverse-offload callback handling, resolve spurious SIGSEGVs
Date: Mon, 24 Oct 2022 20:00:11 +0000 (GMT)	[thread overview]
Message-ID: <20221024200011.EBECD38582B4@sourceware.org> (raw)

https://gcc.gnu.org/g:e0322c67969405001d39cf5bb40ddf545b630779

commit e0322c67969405001d39cf5bb40ddf545b630779
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Mon Oct 24 21:59:37 2022 +0200

    libgomp/nvptx: Prepare for reverse-offload callback handling, resolve spurious SIGSEGVs
    
    Per commit r13-3460-g131d18e928a3ea1ab2d3bf61aa92d68a8a254609
    "libgomp/nvptx: Prepare for reverse-offload callback handling",
    I'm seeing a lot of libgomp execution test regressions.  Random
    example, 'libgomp.c-c++-common/error-1.c':
    
        [...]
          GOMP_OFFLOAD_run: kernel main$_omp_fn$0: launch [(teams: 1), 1, 1] [(lanes: 32), (threads: 8), 1]
    
        Thread 1 "a.out" received signal SIGSEGV, Segmentation fault.
        0x00007ffff793b87d in GOMP_OFFLOAD_run (ord=<optimized out>, tgt_fn=<optimized out>, tgt_vars=<optimized out>, args=<optimized out>) at [...]/source-gcc/libgomp/plugin/plugin-nvptx.c:2127
        2127            if (__atomic_load_n (&ptx_dev->rev_data->fn, __ATOMIC_ACQUIRE) != 0)
        (gdb) print ptx_dev
        $1 = (struct ptx_device *) 0x6a55a0
        (gdb) print ptx_dev->rev_data
        $2 = (struct rev_offload *) 0xffffffff00000000
        (gdb) print ptx_dev->rev_data->fn
        Cannot access memory at address 0xffffffff00000000
    
            libgomp/
            * plugin/plugin-nvptx.c (nvptx_open_device): Initialize
            'ptx_dev->rev_data'.
    
    (cherry picked from commit 205538832b7033699047900cf25928f5920d8b93)

Diff:
---
 libgomp/ChangeLog.omp         | 8 ++++++++
 libgomp/plugin/plugin-nvptx.c | 2 ++
 2 files changed, 10 insertions(+)

diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp
index ab340385c83..ee0f09ead13 100644
--- a/libgomp/ChangeLog.omp
+++ b/libgomp/ChangeLog.omp
@@ -1,3 +1,11 @@
+2022-10-24  Tobias Burnus  <tobias@codesourcery.com>
+
+	Backport from mainline:
+	2022-10-24  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* plugin/plugin-nvptx.c (nvptx_open_device): Initialize
+	'ptx_dev->rev_data'.
+
 2022-10-24  Tobias Burnus  <tobias@codesourcery.com>
 
 	Backport from mainline:
diff --git a/libgomp/plugin/plugin-nvptx.c b/libgomp/plugin/plugin-nvptx.c
index 1bf22bc17a0..be3af6cea2a 100644
--- a/libgomp/plugin/plugin-nvptx.c
+++ b/libgomp/plugin/plugin-nvptx.c
@@ -560,6 +560,8 @@ nvptx_open_device (int n)
   ptx_dev->omp_stacks.size = 0;
   pthread_mutex_init (&ptx_dev->omp_stacks.lock, NULL);
 
+  ptx_dev->rev_data = NULL;
+
   return ptx_dev;
 }

                 reply	other threads:[~2022-10-24 20:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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-all 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=20221024200011.EBECD38582B4@sourceware.org \
    --to=burnus@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).