linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dominik Brodowski <linux@dominikbrodowski.net>
To: linux-kernel@vger.kernel.org, mingo@kernel.org
Cc: Dominik Brodowski <linux@dominikbrodowski.net>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Andi Kleen <ak@linux.intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Andy Lutomirski <luto@kernel.org>,
	Brian Gerst <brgerst@gmail.com>,
	Denys Vlasenko <dvlasenk@redhat.com>,
	"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@redhat.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	x86@kernel.org, Maninder Singh <maninder1.s@samsung.com>,
	Arnd Bergmann <arnd@arndb.de>,
	linux-arch <linux-arch@vger.kernel.org>
Subject: [PATCH 0/3] syscalls: clean up stub naming convention
Date: Sat,  7 Apr 2018 09:46:48 +0200	[thread overview]
Message-ID: <20180407074651.29014-1-linux@dominikbrodowski.net> (raw)

Ingo,

as discussed yesterday, here is a mini-series (mostly) implementing your
suggestion on how to tidy up the naming convention for syscall stubs.

For the generic case, we now will have:

t	        kernel_waitid	# common C function (see kernel/exit.c)

i	      __in_sys_waitid	# inlined helper doing the actual work
				# (takes parameters as declared)

T	      __do_sys_waitid	# C function calling inlined helper
				# (takes parameters of type long; casts
				#  them to the declared type)

i	__in_compat_sys_waitid	# inlined helper doing the actual work
				  (takes parameters as declared)

T	__do_compat_sys_waitid	# compat C function calling inlined helper
				# (takes parameters of type long, casts
				#  them to unsigned long and then to the
				#  declared type)

T	            sys_waitid	# alias to __do_sys_waitid() (taking
				# parameters as declared), to be included
				# in syscall table

T	     compat_sys_waitid	# alias to __do_compat_sys_waitid()
				# (taking parameters as declared), to
				# be included in syscall table


For 64-bit x86, kernel_waitid, __do_sys_waitid and __in_sys_waitid are the
same. But instead of sys_waitid and compat_sys_waitid, there are:

T	      __x64_sys_waitid	# x86 64-bit-ptregs -> C stub, calls
				# __do_sys_waitid(); to be included in
				# syscall table

T	     __ia32_sys_waitid	# IA32_EMULATION 32-bit-ptregs -> C stub,
				# calls __do_sys_waitid(); to be included
				# in syscall table unless there is a
				# compat syscall stub [in that case, it is
				# unused]

T     __ia32_compat_sys_waitid	# IA32_EMULATION 32-bit-ptregs -> C stub,
				# calls __do_compat_sys_waitid(); to be
				# included in syscall table

T      __x32_compat_sys_waitid	# x32 64-bit-ptregs -> C stub, calls
				# __do_compat_sys_waitid(); to be included
				# in syscall table

In short (0xffffffff prefix removed, re-ordered):

810f0af0 t            kernel_waitid	# common (32/64) kernel helper

<inline>            __in_sys_waitid	# inlined helper doing actual work
810f0be0 t          __do_sys_waitid	# C func calling inlined helper

<inline>     __in_compat_sys_waitid	# inlined helper doing actual work
810f0d80 t   __do_compat_sys_waitid	# compat C func calling inlined helper

810f2080 T         __x64_sys_waitid	# x64 64-bit-ptregs -> C stub
810f20b0 T        __ia32_sys_waitid	# ia32 32-bit-ptregs -> C stub [unused]
810f2470 T __ia32_compat_sys_waitid	# ia32 32-bit-ptregs -> compat C stub
810f2490 T  __x32_compat_sys_waitid	# x32 64-bit-ptregs -> compat C stub

The kbuild test robot barked at an alleged +20038 bytes kernel size regression
for i386-tinyconfig due to the first patch of this series. That seems to be a
false positive, as it likely doesn't take into account the change to
scripts/bloat-o-meter. Moreover, I could not reproduce such a size regression
on local i386 builds.

Thanks,
	Dominik

Dominik Brodowski (3):
  syscalls: clean up syscall stub naming convention
  syscalls: clean up compat syscall stub naming convention
  syscalls: rename struct pt_regs-based sys_*() to __x64_sys_*()

 Documentation/process/adding-syscalls.rst |   4 +-
 arch/x86/entry/syscalls/syscall_32.tbl    | 720 +++++++++++-----------
 arch/x86/entry/syscalls/syscall_64.tbl    | 710 ++++++++++-----------
 arch/x86/entry/syscalls/syscalltbl.sh     |  14 +-
 arch/x86/entry/vsyscall/vsyscall_64.c     |   6 +-
 arch/x86/include/asm/syscall_wrapper.h    | 142 +++--
 arch/x86/include/asm/syscalls.h           |   2 +-
 include/linux/compat.h                    |  24 +-
 include/linux/syscalls.h                  |  12 +-
 scripts/bloat-o-meter                     |   4 +-
 10 files changed, 841 insertions(+), 797 deletions(-)

-- 
2.17.0

             reply	other threads:[~2018-04-07  7:47 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-07  7:46 Dominik Brodowski [this message]
2018-04-07  7:46 ` [PATCH 1/3] syscalls: clean up syscall stub naming convention Dominik Brodowski
2018-04-07  7:46 ` [PATCH 2/3] syscalls: clean up compat " Dominik Brodowski
2018-04-07  7:46 ` [PATCH 3/3] syscalls: rename struct pt_regs-based sys_*() to __x64_sys_*() Dominik Brodowski
2018-04-08  8:35 ` [PATCH 0/3] syscalls: clean up stub naming convention Ingo Molnar
2018-04-08  9:15   ` Dominik Brodowski
2018-04-08 19:59     ` Dominik Brodowski
2018-04-08 20:06       ` [PATCH 4/3] syscalls/x86: adapt syscall_wrapper.h to the new syscall " Dominik Brodowski
2018-04-09  6:49       ` [PATCH 0/3] syscalls: clean up " Ingo Molnar
2018-04-09  6:54         ` Dominik Brodowski
2018-04-09  6:39     ` Ingo Molnar
2018-04-09 19:13       ` Linus Torvalds
2018-04-09  6:45     ` Ingo Molnar
2018-04-09  6:53       ` Dominik Brodowski
2018-04-09  7:06       ` Ingo Molnar
2018-04-09  7:08         ` Dominik Brodowski
2018-04-09  7:34           ` 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=20180407074651.29014-1-linux@dominikbrodowski.net \
    --to=linux@dominikbrodowski.net \
    --cc=ak@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=brgerst@gmail.com \
    --cc=dvlasenk@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=maninder1.s@samsung.com \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    --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).