linux-openrisc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stafford Horne <shorne@gmail.com>
To: Michael Jeanson <mjeanson@efficios.com>
Cc: Linux OpenRISC <linux-openrisc@vger.kernel.org>,
	GLIBC patches <libc-alpha@sourceware.org>
Subject: Re: [PATCH] nptl: Add <thread_pointer.h> for or1k
Date: Tue, 24 Dec 2024 20:20:00 +0000	[thread overview]
Message-ID: <Z2sXcENuw--JWlx6@antec> (raw)
In-Reply-To: <Z11l_-7RV07JRwCo@antec>

On Sat, Dec 14, 2024 at 11:03:27AM +0000, Stafford Horne wrote:
> +CC Lists,
> 
> They should have been included for all of these.
> 
> On Fri, Dec 13, 2024 at 11:22:32AM -0500, Michael Jeanson wrote:
> > On 2024-12-12 07:41, Stafford Horne wrote:
> > > On Tue, Dec 10, 2024 at 03:30:05PM -0500, Michael Jeanson wrote:
> > >> On 2024-12-10 13:56, Michael Jeanson wrote:
> > >>>> I started adding rseq support to OpenRISC, but it seems I need to do a bit more
> > >>>> for me than just call rseq_signal_deliver().  OpenRISC does not implement
> > >>>> HAVE_REGS_AND_STACK_ACCESS_API yet, so I will need to do that first.  Also I
> > >>>> need to think of an instruction to use for RSEQ_SIG, but that should not be too
> > >>>> hard.
> > >>>
> > >>> Do you have a WIP tree somewhere I can have a look at? Assuming you add
> > >>> HAVE_REGS_AND_STACK_ACCESS_API, the rest should be pretty simple.
> > >>
> > >> I had a quick look at the kernel code and it looks pretty straightforward,
> > >> I hacked this together just to see if it would build :
> > >>
> > >>   https://github.com/mjeanson/linux/commits/openrisc-rseq/
> > >>
> > >> This is thoroughly untested and only cross-compiled.
> > > 
> > > Thanks, while you were doing this I did something similar but took a much
> > > shorter route, I only implemented the APIs used by rseq.
> > > 
> > > I have pushed branches for linux and glibc here:
> > > 
> > >  - https://github.com/stffrdhrn/or1k-glibc/commits/or1k-rseq/
> > >  - https://github.com/stffrdhrn/linux/commits/or1k-rseq/
> > 
> > You might also want to add a call to 'rseq_syscall' in arch/openrisc/kernel/entry.S
> > on return to userspace when CONFIG_DEBUG_RSEQ is enabled.
> 
> Yes, I am aware of that one, but I think I discovered an issue with the return to
> userspace code that needs some cleanup before I can add that in.

I think this ended up being ok.

I have added the call to rseq_syscall and implemented self tests on my branch
now.

 - https://github.com/stffrdhrn/linux/commits/or1k-rseq/
 - commit 1fa73dd6c2d3 ("rseq/selftests: Add support for OpenRISC")

I haven't got the tests to complete fully yet though.  Do you have a recommended
approach for building, testing and debugging them?  I am using my glibc
toolchain, but I assume the original implementations didnt have glibc support
available when they were testing.

My stack now:

  - QEMU virt
  - Linux virt_defconfig (or1k-rseq branch)
    - rseq selftests - built with gcc/glibc toolchain (or1k-rseq branch)
  - rootfs - Buildroot with my glibc (or1k-rseq branch)
    - gdb
    - strace

In general I am using the latest git HEADs for qemu, gcc, binutils etc.

Once, everything is working on QEMU I will test again on the FPGA hardware.

Currently tests are failing with SIGSEGV:

    TAP version 13
    1..10
    # timeout set to 0
    # selftests: rseq: basic_test
    # testing current cpu
    ok 1 selftests: rseq: basic_test
    # timeout set to 0
    # selftests: rseq: basic_percpu_ops_test
    # spinlock
    # ./kselftest/runner.sh: line 37:   772 Segmentation fault      /usr/bin/timeout  --foreground "$kselftest_timeout" /usr/bin/timeout "$kselftest_timeout" $1
    not ok 2 selftests: rseq: basic_percpu_ops_test # exit=139

In gdb it looks to be happening in in an mprotect syscall in glibc and at that
point the stack seems to be corrupt already.  So its taking me a bit of time to
untangle.

-Stafford

  reply	other threads:[~2024-12-24 20:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20241101192339.123141-1-mjeanson@efficios.com>
     [not found] ` <20241101192339.123141-5-mjeanson@efficios.com>
     [not found]   ` <ZzJ-T-5VFZ8gZEf7@antec>
     [not found]     ` <94aee33f-c9d2-428b-9b03-7e4fb1c97472@efficios.com>
     [not found]       ` <Z1g2UxaMlKH5o5nc@antec>
     [not found]         ` <Z1h5hzWpD8Fu77AL@antec>
     [not found]           ` <8dcf9b95-b7fb-4b5e-8708-b4428b58ecd1@efficios.com>
     [not found]             ` <8afa2c34-9416-412d-9920-ab15b44c6d4b@efficios.com>
     [not found]               ` <Z1rZ6APG2ViLdLmy@antec>
     [not found]                 ` <e249789e-0cfa-4d66-805b-e3cd1aef957a@efficios.com>
2024-12-14 11:03                   ` [PATCH] nptl: Add <thread_pointer.h> for or1k Stafford Horne
2024-12-24 20:20                     ` Stafford Horne [this message]
2025-01-02  1:08                       ` Stafford Horne
2025-01-05  6:48                         ` Stafford Horne
2025-01-06 15:44                           ` Michael Jeanson
2025-01-06 18:26                       ` Michael Jeanson
2025-01-06 20:18                         ` Stafford Horne
2025-01-06 20:32                           ` Michael Jeanson

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=Z2sXcENuw--JWlx6@antec \
    --to=shorne@gmail.com \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-openrisc@vger.kernel.org \
    --cc=mjeanson@efficios.com \
    /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 NNTP newsgroup(s).