From mboxrd@z Thu Jan 1 00:00:00 1970 From: Al Viro Subject: [RFC] making HAVE_SYSCALL_WRAPPERS universal (Re: Issues with "x86, um: switch to generic fork/vfork/clone" commit) Date: Mon, 21 Jan 2013 22:55:17 +0000 Message-ID: <20130121225517.GV4939@ZenIV.linux.org.uk> References: <50F3D2F2.3080200@6wind.com> <20130119063808.GN4939@ZenIV.linux.org.uk> <20130120031253.GO4939@ZenIV.linux.org.uk> <20130121012217.GQ4939@ZenIV.linux.org.uk> <20130121023010.GR4939@ZenIV.linux.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from zeniv.linux.org.uk ([195.92.253.2]:37444 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752241Ab3AUWzW (ORCPT ); Mon, 21 Jan 2013 17:55:22 -0500 Content-Disposition: inline In-Reply-To: <20130121023010.GR4939@ZenIV.linux.org.uk> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Linus Torvalds Cc: Nicolas Dichtel , Linux Kernel Mailing List , linux-arch@vger.kernel.org, Arnd Bergmann , Tony Luck [linux-arch Cc'd] On Mon, Jan 21, 2013 at 02:30:11AM +0000, Al Viro wrote: > Neither do I, to be honest. It might be saving us a few cycles on > some architectures, but I'd like to see examples of that. amd64 > doesn't seem to be one, at least... *grumble* OK, there is one problem - SYSCALL_ALIAS() is as arch-dependent as cond_syscall(). As far as I can tell, with cond_syscall() we have the following variants: 1) alpha, mips .weak foo foo = sys_ni_syscall 2) itanic, ppc asmlinkage long x (void) __attribute__((weak,alias("sys_ni_syscall"))) 3) very common - most of the architectures .weak foo .set foo sys_ni_syscall 3a) blackfin, h8300 - same as (3), except that asm symbols get underscore prepended. .weak _foo .set _foo _sys_ni_syscall For SYSCALL_ALIAS(foo,bar): 1) alpha, mips foo = bar .globl foo 2) ppc64 .globl foo .set foo bar .globl .foo .set .foo .bar [note that ppc64 cond_syscall ends up generating similar pair, only with .globl replaced with .weak] 3) s390, sparc, tile .globl foo .set foo bar I suspect that (3) here should cover the same things as (3,3a) for cond_syscalls(), with the same "prepend _" variation on blackfin/h8300. I really wonder what's going on with ppc64, though - as far as I can tell, .foo is the real function there, while foo is a OPD entry refering to it. Do we have anything similar on other architectures? And what about itanic? After looking at the assembler generated by cond_syscall there, I suspect that foo# = bar# .globl foo# would be the right answer there, but I'd really like somebody familiar with ia64 to confirm that... Another question: what's the following comment from spu_callbacks.c about? * 4. They are optional and we can't rely on them being * linked into the kernel. Unfortunately, the cond_syscall * helper does not work here as it does not add the necessary * opd symbols: * mbind, mq_open, ipc, ... What isn't added? sys_ni_syscall is an OPD entry and weak aliases for it *are* created. That comment predates the conversion of cond_syscall() definition to the current one; it used to be .weak .foo .set .foo .sys_ni_syscall and that wouldn't have created the second alias; is it simply obsolete? Note that mbind and friends still are not available to SPU; should that be changed now that we can do that? I've tried to sanitize cond_syscall/SYSCALL_ALIAS situation; the tree is in git.kernel.org/pub/scm/linux/kernel/git/viro/signal experimental-syscalls NOTE: this is absolutely untested and might very well blow up on any number of architectures. Review and comments would be very welcome.