All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vasily Gorbik <gor@linux.ibm.com>
To: Andy Lutomirski <luto@kernel.org>
Cc: Sven Schnelle <svens@linux.ibm.com>, X86 ML <x86@kernel.org>,
	linux-arch <linux-arch@vger.kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Heiko Carstens <hca@linux.ibm.com>,
	Christian Borntraeger <borntraeger@de.ibm.com>
Subject: Re: Is s390's new generic-using syscall code actually correct?
Date: Wed, 24 Mar 2021 18:38:50 +0100	[thread overview]
Message-ID: <your-ad-here.call-01616607308-ext-0852@work.hours> (raw)
In-Reply-To: <CALCETrUx10uHeD7bckVjL9x7S3LEdH3ZfzUbCMWj9j-=nYp8Wg@mail.gmail.com>

Hi Andy,

On Sat, Mar 20, 2021 at 08:48:34PM -0700, Andy Lutomirski wrote:
> Hi all-
> 
> I'm working on my kentry patchset, and I encountered:
> 
> commit 56e62a73702836017564eaacd5212e4d0fa1c01d
> Author: Sven Schnelle <svens@linux.ibm.com>
> Date:   Sat Nov 21 11:14:56 2020 +0100
> 
>     s390: convert to generic entry
> 
> As part of this work, I was cleaning up the generic syscall helpers,
> and I encountered the goodies in do_syscall() and __do_syscall().
> 
> I'm trying to wrap my head around the current code, and I'm rather confused.
> 
> 1. syscall_exit_to_user_mode_work() does *all* the exit work, not just
> the syscall exit work.  So a do_syscall() that gets called twice will
> do the loopy part of the exit work (e.g. signal handling) twice.  Is
> this intentional?  If so, why?
> 
> 2. I don't understand how this PIF_SYSCALL_RESTART thing is supposed
> to work.  Looking at the code in Linus' tree, if a signal is pending
> and a syscall returns -ERESTARTSYS, the syscall will return back to
> do_syscall().  The work (as in (1)) gets run, calling do_signal(),
> which will notice -ERESTARTSYS and set PIF_SYSCALL_RESTART.
> Presumably it will also push the signal frame onto the stack and aim
> the return address at the svc instruction mentioned in the commit
> message from "s390: convert to generic entry".  Then __do_syscall()
> will turn interrupts back on and loop right back into do_syscall().
> That seems incorrect.
> 
> Can you enlighten me?  My WIP tree is here:
> https://git.kernel.org/pub/scm/linux/kernel/git/luto/linux.git/log/?h=x86/kentry
> 

For all the details to that change we'd have to wait for Sven, who is back
next week.

> Here are my changes to s390, and I don't think they're really correct:
> 
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/luto/linux.git/diff/arch/s390/kernel/syscall.c?h=x86/kentry&id=58a459922be0fb8e0f17aeaebcb0ac8d0575a62c

Couple of things: syscall_exit_to_user_mode_prepare is static,
and there is another code path in arch/s390/kernel/traps.c using
enter_from_user_mode/exit_to_user_mode.

Anyhow I gave your branch a spin and got few new failures on strace test
suite, in particular on restart_syscall test. I'll try to find time to
look into details.

  reply	other threads:[~2021-03-24 17:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-21  3:48 Is s390's new generic-using syscall code actually correct? Andy Lutomirski
2021-03-24 17:38 ` Vasily Gorbik [this message]
2021-03-24 18:06   ` Andy Lutomirski
2021-03-30  8:13     ` Sven Schnelle
2021-03-30  8:37       ` Sven Schnelle
2021-03-29 11:49 ` Sven Schnelle

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=your-ad-here.call-01616607308-ext-0852@work.hours \
    --to=gor@linux.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=svens@linux.ibm.com \
    --cc=x86@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.