public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] arch-specific cond_syscall usage issues
@ 2004-01-10  3:29 Matt Mackall
  2004-01-10  3:37 ` Andrew Morton
  0 siblings, 1 reply; 11+ messages in thread
From: Matt Mackall @ 2004-01-10  3:29 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton; +Cc: Pete Zaitcev

Experimenting with trying to use cond_syscall for a few arch-specific
syscalls, I discovered that it can't actually be used outside the file
in which sys_ni_syscall is declared because the assembler doesn't feel
obliged to output the symbol in that case:

weak.c:

#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall");
cond_syscall(sys_foo);

$ nm weak.o
         U sys_ni_syscall

One arch (PPC) is apparently trying to use cond_syscall this way
anyway, though it's probably never been actually tested as the above
test was done on a PPC.

After trying a bunch of tricks to get it to work nicely, I decided
there are basically two alternatives: make weak versions of
sys_ni_syscall wherever they're wanted or put the arch-specific
cond_syscalls in kernel/sys.c where sys_ni_syscall is defined.

The former approach is a bit crufty and doesn't actually do the right
thing in practice as you'll get multiple copies of sys_ni_syscall in
your final image.

The latter introduces some slight arch-pollution in sys.c, but as
arch-specific cond_syscalls aren't all that frequent, it should be
pretty minor. So here's a patch to move the current offender to sys.c:

 tiny-mpm/arch/ppc/kernel/syscalls.c |    2 --
 tiny-mpm/kernel/sys.c               |    3 +++
 2 files changed, 3 insertions(+), 2 deletions(-)

diff -puN arch/ppc/kernel/syscalls.c~ppc_cond_syscall arch/ppc/kernel/syscalls.c
--- tiny/arch/ppc/kernel/syscalls.c~ppc_cond_syscall	2004-01-09 21:15:02.000000000 -0600
+++ tiny-mpm/arch/ppc/kernel/syscalls.c	2004-01-09 21:15:08.000000000 -0600
@@ -271,5 +271,3 @@ long ppc_fadvise64_64(int fd, int advice
 {
 	return sys_fadvise64_64(fd, offset, len, advice);
 }
-
-cond_syscall(sys_pciconfig_iobase);
diff -puN kernel/sys.c~ppc_cond_syscall kernel/sys.c
--- tiny/kernel/sys.c~ppc_cond_syscall	2004-01-09 21:15:02.000000000 -0600
+++ tiny-mpm/kernel/sys.c	2004-01-09 21:15:02.000000000 -0600
@@ -252,6 +252,9 @@ cond_syscall(sys_epoll_wait)
 cond_syscall(sys_pciconfig_read)
 cond_syscall(sys_pciconfig_write)
 
+/* arch-specific weak syscall entries */
+cond_syscall(sys_pciconfig_iobase)
+
 static int set_one_prio(struct task_struct *p, int niceval, int error)
 {
 	int no_nice;

_

-- 
Matt Mackall : http://www.selenic.com : Linux development and consulting

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2004-04-23 23:50 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-10  3:29 [patch] arch-specific cond_syscall usage issues Matt Mackall
2004-01-10  3:37 ` Andrew Morton
2004-01-10  3:53   ` Matt Mackall
2004-01-10  5:21   ` Pete Zaitcev
2004-01-10  6:03     ` Matt Mackall
2004-01-14 16:13   ` Tom Rini
2004-01-14 19:31     ` Andrew Morton
2004-01-14 19:47       ` Matt Mackall
2004-01-14 19:49       ` Tom Rini
2004-04-23 19:14     ` [PATCH 2.6] include/asm-ppc/dma-mapping.h: dma_unmap_page() Arthur Othieno
2004-04-23 23:50       ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox