From: Ingo Molnar <mingo@kernel.org>
To: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: linux-kernel@vger.kernel.org, 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, Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [PATCH 0/8] use struct pt_regs based syscall calling for x86-64
Date: Fri, 6 Apr 2018 14:34:20 +0200 [thread overview]
Message-ID: <20180406123420.kf74tgiahaugl35x@gmail.com> (raw)
In-Reply-To: <20180406093424.GA908@isilmar-4.linta.de>
* Dominik Brodowski <linux@dominikbrodowski.net> wrote:
> > > __sys_mprotect as prefix won't work by the way, as the double-underscore __sys_
> > > variant is already used in net/* for internal syscall helpers.
> >
> > Ok - then triple underscore - but overall I think it's more confusing.
> >
> > Btw., what was the problem with calling the x86 ptregs wrapper sys_mprotect?
> >
> > The only reason I suggested the __sys_x86_ prefix was because you originally
> > suggested that there's symbol name overlap, but I don't think that's the case
> > within the same kernel build, as the regular non-ptregs prototype:
>
> Indeed, there's no symbol name overlap within the same kernel build, but
> technically different stubs named the same. If that's fine, just drop patch
> 8/8 (including the UML fixup) and things should be fine, with the stub and
> the entry in the syscall table both named sys_mprotect.
Ok, I've dropped patch #8.
> For IA32_EMULATION, we have __sys_ia32_mprotect as stub for the same
> syscall, including this name as entry in syscall_32.tbl.
>
> More problematic is the naming for the compat stubs for IA32_EMAULATION and
> X32, where we have
>
> __compat_sys_ia32_waitid
> __compat_sys_x32_waitid
>
> for example. We *could* rename one of those to compat_sys_waitid() and levae
> the other as-is, but actually I prefer it now how it is.
yeah, this is more symmetric I think.
So right now we have these symbols:
triton:~/tip> grep waitid System.map
ffffffff8105f1e0 t kernel_waitid # common C function (64-bit kargs)
ffffffff8105f2b0 t SYSC_waitid # 64-bit uaddr args C function 352 bytes
ffffffff8105f410 T sys_waitid # 64-bit-ptregs -> C stub, 32 bytes
ffffffff8105f430 T __sys_ia32_waitid # 32-bit-ptregs -> C stub, 32 bytes
ffffffff8105f450 t C_SYSC_waitid # 32-bit uaddr args C function, 400 bytes
ffffffff8105f5e0 T __compat_sys_ia32_waitid # 32-bit-ptregs -> C stub, 32 bytes
ffffffff8105f600 T __compat_sys_x32_waitid # 64-bit-ptregs -> C stub, 32 bytes
BTW., what is the role of generating __sys_ia32_waitid()? It seems unused when a
syscall has a compat variant otherwise - like here.
Naming wise the odd thumb out is sys_waitid :-/
I'd argue that we should at minimum name it __sys_waitid:
ffffffff8105f1e0 t kernel_waitid # common C function (64-bit kargs)
ffffffff8105f2b0 t SYSC_waitid # 64-bit uaddr args C function
ffffffff8105f410 T __sys_waitid # 64-bit-ptregs -> C stub
ffffffff8105f430 T __sys_ia32_waitid # 32-bit-ptregs -> C stub
ffffffff8105f450 t C_SYSC_waitid # 32-bit uaddr args C function
ffffffff8105f5e0 T __compat_sys_ia32_waitid # 32-bit-ptregs -> C stub
ffffffff8105f600 T __compat_sys_x32_waitid # 64-bit-ptregs -> C stub
because that makes it all organized based on the same principle:
{__compat|_}_sys{_ia32|_x32|}_waittid
But arguably there are a whole lot more naming weirdnesses we could fix:
- I find it somewhat confusing that that 'C' in C_SYSC stands not for a C callign
convention, but for 'COMPAT' - i.e. COMPAT_SYSC would be better.
- Another detail is that why is it called 'SYSC', if the other functions use the
'sys' prefix? Wouldn't 'SYS' be more consistent?
- If we introduced a prefix for the regular 64-bit system call format as well,
we could have: x64, x32 and ia32.
- And finally, I think the argument format modifiers should be consistently
prefixes - right now they are a mixture of pre- and post-fixes.
I.e. I'd generate the names like this:
__{x64,x32,ia32}[_compat]_sys_waittid()
The fully consistent nomenclature would be someting like this:
ffffffff8105f1e0 t kernel_waitid # common C function (64-bit kargs)
ffffffff8105f2b0 t SYS_waitid # 64-bit uaddr args C function
ffffffff8105f410 T __x64_sys_waitid # 64-bit-ptregs -> C stub
ffffffff8105f430 T __ia32_sys_waitid # 32-bit-ptregs -> C stub
ffffffff8105f450 t COMPAT_SYS_waitid # 32-bit uaddr args C function
ffffffff8105f5e0 T __ia32_compat_sys_waitid # 32-bit-ptregs -> C stub
ffffffff8105f600 T __x32_compat_sys_waitid # 64-bit-ptregs -> C stub
Looks a lot tidier and a lot more logical, doesn't it?
Makes grepping easier as well, because (case-insensitive) patterns like
'sys_waittid' would identify all the variants.
Personally I'd also do a s/ia32/i32 rename:
ffffffff8105f1e0 t kernel_waitid # common C function (64-bit kargs)
ffffffff8105f2b0 t SYS_waitid # 64-bit uaddr args C function
ffffffff8105f410 T __x64_sys_waitid # 64-bit-ptregs -> C stub
ffffffff8105f430 T __i32_sys_waitid # 32-bit-ptregs -> C stub
ffffffff8105f450 t COMPAT_SYS_waitid # 32-bit uaddr args C function
ffffffff8105f5e0 T __i32_compat_sys_waitid # 32-bit-ptregs -> C stub
ffffffff8105f600 T __x32_compat_sys_waitid # 64-bit-ptregs -> C stub
... but maybe that's too much ;-)
Thanks,
Ingo
next prev parent reply other threads:[~2018-04-06 12:34 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-05 9:52 [PATCH 0/8] use struct pt_regs based syscall calling for x86-64 Dominik Brodowski
2018-04-05 9:53 ` [PATCH 1/8] x86: don't pointlessly reload the system call number Dominik Brodowski
2018-04-06 17:09 ` [tip:x86/asm] x86/syscalls: Don't " tip-bot for Linus Torvalds
2018-04-05 9:53 ` [PATCH 2/8] syscalls: introduce CONFIG_ARCH_HAS_SYSCALL_WRAPPER Dominik Brodowski
2018-04-06 17:10 ` [tip:x86/asm] syscalls/core: Introduce CONFIG_ARCH_HAS_SYSCALL_WRAPPER=y tip-bot for Dominik Brodowski
2018-04-05 9:53 ` [PATCH 3/8] syscalls/x86: use struct pt_regs based syscall calling for 64-bit syscalls Dominik Brodowski
2018-04-06 17:11 ` [tip:x86/asm] syscalls/x86: Use 'struct pt_regs' based syscall calling convention " tip-bot for Dominik Brodowski
2018-04-05 9:53 ` [PATCH 4/8] syscalls: prepare ARCH_HAS_SYSCALL_WRAPPER for compat syscalls Dominik Brodowski
2018-04-06 17:11 ` [tip:x86/asm] syscalls/core: Prepare CONFIG_ARCH_HAS_SYSCALL_WRAPPER=y " tip-bot for Dominik Brodowski
2018-04-05 9:53 ` [PATCH 5/8] syscalls/x86: use struct pt_regs based syscall calling for IA32_EMULATION and x32 Dominik Brodowski
2018-04-06 17:12 ` [tip:x86/asm] syscalls/x86: Use 'struct pt_regs' " tip-bot for Dominik Brodowski
2018-04-05 9:53 ` [PATCH 6/8] syscalls/x86: unconditionally enable struct pt_regs based syscalls on x86_64 Dominik Brodowski
2018-04-06 17:12 ` [tip:x86/asm] syscalls/x86: Unconditionally enable 'struct pt_regs' " tip-bot for Dominik Brodowski
2018-04-05 9:53 ` [PATCH 7/8] x86/entry/64: extend register clearing on syscall entry to lower registers Dominik Brodowski
2018-04-06 17:13 ` [tip:x86/asm] syscalls/x86: Extend " tip-bot for Dominik Brodowski
2018-04-05 9:53 ` [PATCH 8/8] syscalls/x86: rename struct pt_regs-based sys_*() to __sys_x86_*() Dominik Brodowski
2018-04-05 18:35 ` kbuild test robot
2018-04-05 15:19 ` [PATCH 0/8] use struct pt_regs based syscall calling for x86-64 Ingo Molnar
2018-04-05 20:31 ` Dominik Brodowski
2018-04-06 8:23 ` Ingo Molnar
2018-04-06 8:31 ` Dominik Brodowski
2018-04-06 8:34 ` Dominik Brodowski
2018-04-06 9:20 ` Ingo Molnar
2018-04-06 9:34 ` Dominik Brodowski
2018-04-06 12:34 ` Ingo Molnar [this message]
2018-04-06 13:07 ` Dominik Brodowski
2018-04-06 17:03 ` 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=20180406123420.kf74tgiahaugl35x@gmail.com \
--to=mingo@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=ak@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=brgerst@gmail.com \
--cc=dvlasenk@redhat.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@dominikbrodowski.net \
--cc=luto@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 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.