linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Anvin <hpa@zytor.com>, Ingo Molnar <mingo@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	the arch/x86 maintainers <x86@kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [RFC] de-asmify the x86-64 system call slowpath
Date: Mon, 27 Jan 2014 00:22:55 +0000	[thread overview]
Message-ID: <20140127002255.GA10323@ZenIV.linux.org.uk> (raw)
In-Reply-To: <CA+55aFzNxTtvNX7zqBELHs489e5mEx1sM=i=red=aQAGviXrNw@mail.gmail.com>

On Sun, Jan 26, 2014 at 02:28:15PM -0800, Linus Torvalds wrote:
> The x86-64 (and 32-bit, for that matter) system call slowpaths are all
> in C, but the *selection* of which slow-path to take is a mixture of
> complicated assembler ("sysret_check -> sysret_careful ->
> sysret_signal ->sysret_audit -> int_check_syscall_exit_work" etc), and
> oddly named and placed C code ("schedule_user" vs
> "__audit_syscall_exit" vs "do_notify_resume").
> 
> This attached patch tries to take the "do_notify_resume()" approach,
> and renaming it to something sane ("syscall_exit_slowpath") and call
> out to *all* the different slow cases from that one place, instead of
> having some cases hardcoded in asm, and some in C. And instead of
> hardcoding which cases result in a "iretq" and which cases result in a
> faster sysret case, it's now simply a return value from that
> syscall_exit_slowpath() function, so it's very natural and easy to say
> "taking a signal will force us to do the slow iretq case, but we can
> do the task exit work and still do the sysret".
> 
> I've marked this as an RFC, because I didn't bother trying to clean up
> the 32-bit code similarly (no test-cases, and trust me, if you get
> this wrong, it will fail spectacularly but in very subtle and
> hard-to-debug ways), and I also didn't bother with the slow cases in
> the "iretq" path, so that path still has the odd asm cases and calls
> the old (now legacy) do_notify_resume() path.

Umm...  Can't uprobe_notify_resume() modify regs as well?  While we
are at it, when we start using the same thing on 32bit kernels, we'll
need to watch out for execve() - the reason why start_thread() sets
TIF_NOTIFY_RESUME is to force us away from sysexit path.  IIRC, vm86
is another thing to watch out for (same reasons).

  reply	other threads:[~2014-01-27  0:24 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-26 22:28 [RFC] de-asmify the x86-64 system call slowpath Linus Torvalds
2014-01-27  0:22 ` Al Viro [this message]
2014-01-27  4:32   ` Linus Torvalds
2014-01-27  4:48     ` H. Peter Anvin
2014-01-27  7:42     ` Al Viro
2014-01-27 22:06       ` Andy Lutomirski
2014-01-27 22:17         ` Linus Torvalds
2014-01-27 22:32           ` Al Viro
2014-01-27 22:43             ` Linus Torvalds
2014-01-27 22:46               ` Andy Lutomirski
2014-01-28  0:22                 ` H. Peter Anvin
2014-01-28  0:44                   ` Andy Lutomirski
2014-01-27 23:07               ` Al Viro
2014-01-27 10:27 ` Peter Zijlstra
2014-01-27 11:36   ` Al Viro
2014-01-27 17:39     ` Oleg Nesterov
2014-01-28  1:18       ` Al Viro
2014-01-28 16:38         ` Oleg Nesterov
2014-01-28 16:48           ` Al Viro
2014-01-28 17:19             ` Oleg Nesterov
2014-02-06  0:32 ` Linus Torvalds
2014-02-06  0:55   ` Kirill A. Shutemov
2014-02-06  2:32     ` Linus Torvalds
2014-02-06  4:33       ` Linus Torvalds
2014-02-06 21:29         ` Linus Torvalds
2014-02-06 22:24           ` Kirill A. Shutemov
2014-02-07  1:31             ` Linus Torvalds
2014-02-07 15:42               ` [RFC, PATCH] mm: map few pages around fault address if they are in page cache Kirill A. Shutemov
2014-02-07 17:32                 ` Andi Kleen
2014-02-07 17:56                   ` Kirill A. Shutemov
2014-02-07 18:11                     ` Andi Kleen
2014-02-06  5:42       ` [RFC] de-asmify the x86-64 system call slowpath Ingo Molnar

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=20140127002255.GA10323@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --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 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).