* [PATCH] Wire up sys_sync_file_range() on powerpc
@ 2007-06-16 11:18 David Woodhouse
2007-06-16 18:20 ` David Woodhouse
0 siblings, 1 reply; 5+ messages in thread
From: David Woodhouse @ 2007-06-16 11:18 UTC (permalink / raw)
To: paulus, akpm; +Cc: linuxppc-dev
Every time I build a ppc kernel it bitches at me that
sys_sync_file_range is unimplemented. Shut it up...
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
---
The compat bit is untested although the assembly looks right, when
compared with 32-bit calls to sys_sync_file_range(). Test kernel
building now, although I leave for the airport within 24 hours and may
not get round to actually testing it.
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
index 047246a..14a2654 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -810,3 +810,13 @@ asmlinkage long compat_sys_request_key(const char __user *_type,
return sys_request_key(_type, _description, _callout_info, destringid);
}
+asmlinkage long compat_sys_sync_file_range(int fd, int dummy,
+ unsigned offset_hi, unsigned offset_lo,
+ unsigned nbytes_hi, unsigned nbytes_lo,
+ int flags)
+{
+ loff_t offset = ((loff_t)offset_hi << 32) | offset_lo;
+ loff_t nbytes = ((loff_t)nbytes_hi << 32) | nbytes_lo;
+
+ return sys_sync_file_range(fd, offset, nbytes, flags);
+}
diff --git a/include/asm-powerpc/systbl.h b/include/asm-powerpc/systbl.h
index 700ca59..b75ce1c 100644
--- a/include/asm-powerpc/systbl.h
+++ b/include/asm-powerpc/systbl.h
@@ -311,3 +311,4 @@ COMPAT_SYS_SPU(utimensat)
COMPAT_SYS_SPU(signalfd)
COMPAT_SYS_SPU(timerfd)
SYSCALL_SPU(eventfd)
+COMPAT_SYS_SPU(sync_file_range)
diff --git a/include/asm-powerpc/unistd.h b/include/asm-powerpc/unistd.h
index e3c28dc..a4f8e7f 100644
--- a/include/asm-powerpc/unistd.h
+++ b/include/asm-powerpc/unistd.h
@@ -330,10 +330,11 @@
#define __NR_signalfd 305
#define __NR_timerfd 306
#define __NR_eventfd 307
+#define __NR_sync_file_range 308
#ifdef __KERNEL__
-#define __NR_syscalls 308
+#define __NR_syscalls 309
#define __NR__exit __NR_exit
#define NR_syscalls __NR_syscalls
--
dwmw2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Wire up sys_sync_file_range() on powerpc
2007-06-16 11:18 [PATCH] Wire up sys_sync_file_range() on powerpc David Woodhouse
@ 2007-06-16 18:20 ` David Woodhouse
2007-06-18 5:37 ` Paul Mackerras
0 siblings, 1 reply; 5+ messages in thread
From: David Woodhouse @ 2007-06-16 18:20 UTC (permalink / raw)
To: paulus; +Cc: akpm, linuxppc-dev, torvalds, rmk, linux-arch
On Sat, 2007-06-16 at 12:18 +0100, David Woodhouse wrote:
> Every time I build a ppc kernel it bitches at me that
> sys_sync_file_range is unimplemented. Shut it up...
>
> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
>
> ---
> The compat bit is untested although the assembly looks right, when
> compared with 32-bit calls to sys_sync_file_range(). Test kernel
> building now, although I leave for the airport within 24 hours and may
> not get round to actually testing it.
+asmlinkage long compat_sys_sync_file_range(int fd, int dummy,
+ unsigned offset_hi, unsigned offset_lo,
+ unsigned nbytes_hi, unsigned nbytes_lo,
+ int flags)
Pants. It doesn't work because the 'flags' argument ends up in r9, and
we can only use r3-r8 for syscall arguments. We'll need to do it the
same way as ARM does, with the flags as the second argument.
I _wish_ people would remember that not all the world's an i386 when
they add new syscalls.
And I wish Linus would refuse to merge anything which just says "I wired
it up on i386" without even thinking about 32-on-64 compatibility.
Once we've merged it, it's too late to change the ABI to be sane.
Or is it? Can we ditch sys_sync_file_range now and implement a new
sys_sync_file_range2 with the two 32-bit arguments first?
--
dwmw2
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Wire up sys_sync_file_range() on powerpc
2007-06-16 18:20 ` David Woodhouse
@ 2007-06-18 5:37 ` Paul Mackerras
2007-06-18 9:25 ` David Woodhouse
0 siblings, 1 reply; 5+ messages in thread
From: Paul Mackerras @ 2007-06-18 5:37 UTC (permalink / raw)
To: David Woodhouse; +Cc: akpm, linuxppc-dev, torvalds, rmk, linux-arch
David Woodhouse writes:
> Pants.
Ah. Is that a naughty word in the UK? If so I'll have to remember
that when I go to kernel summit. :)
> It doesn't work because the 'flags' argument ends up in r9, and
> we can only use r3-r8 for syscall arguments. We'll need to do it the
> same way as ARM does, with the flags as the second argument.
Yes. We'll need a wrapper for both 32-bit and for 32-on-64.
> Or is it? Can we ditch sys_sync_file_range now and implement a new
> sys_sync_file_range2 with the two 32-bit arguments first?
Would be nice...
Paul.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Wire up sys_sync_file_range() on powerpc
2007-06-18 5:37 ` Paul Mackerras
@ 2007-06-18 9:25 ` David Woodhouse
2007-06-18 9:41 ` Russell King
0 siblings, 1 reply; 5+ messages in thread
From: David Woodhouse @ 2007-06-18 9:25 UTC (permalink / raw)
To: Paul Mackerras; +Cc: akpm, linux-arch, linuxppc-dev, torvalds, drepper, rmk
On Mon, 2007-06-18 at 15:37 +1000, Paul Mackerras wrote:
> David Woodhouse writes:
>
> > Pants.
>
> Ah. Is that a naughty word in the UK? If so I'll have to remember
> that when I go to kernel summit. :)
I think the most important thing you have to remember about 'pants'
while in the UK is that you don't wear them on the outside.
> > It doesn't work because the 'flags' argument ends up in r9, and
> > we can only use r3-r8 for syscall arguments. We'll need to do it the
> > same way as ARM does, with the flags as the second argument.
>
> Yes. We'll need a wrapper for both 32-bit and for 32-on-64.
>
> > Or is it? Can we ditch sys_sync_file_range now and implement a new
> > sys_sync_file_range2 with the two 32-bit arguments first?
>
> Would be nice...
It might look something like this... I can't test it sensibly till I get
home next week; anyone else want to poke at it?
(Note that glibc's syscall() doesn't get 64-bit arguments like this
right; you'll want to implement do_sync_file_range() in assembly if
you're using Andrew's original test program.)
.section ".text"
.globl do_sync_file_range
.type do_sync_file_range, @function
do_sync_file_range:
stwu 1,-16(1)
mflr 0
stw 31,12(1)
stw 0,20(1)
li 0,308
sc
mfcr 0
andis. 9,0,4096
mr 31,3
beq 0,.L6
bl __errno_location
li 0,-1
stw 31,0(3)
.L6:
mr 3,0
lwz 0,20(1)
lwz 31,12(1)
addi 1,1,16
mtlr 0
blr
.size do_sync_file_range,.-do_sync_file_range
---
[PATCH] Add sys_sync_file_range2() system call
... with more sensible ABI, for those architectures which hated
sys_sync_file_range() for wasting argument slots by misaligning 64-bit
values. Convert ARM to use it, wire it up on PowerPC, and prevent the
missing syscall checker from bitching about sync_file_range if you have
sync_file_range2 instead.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S
index 19326d7..a98d0c9 100644
--- a/arch/arm/kernel/calls.S
+++ b/arch/arm/kernel/calls.S
@@ -350,7 +350,7 @@
CALL(sys_set_robust_list)
CALL(sys_get_robust_list)
/* 340 */ CALL(sys_splice)
- CALL(sys_arm_sync_file_range)
+ CALL(sys_sync_file_range2)
CALL(sys_tee)
CALL(sys_vmsplice)
CALL(sys_move_pages)
diff --git a/arch/arm/kernel/sys_arm.c b/arch/arm/kernel/sys_arm.c
index 1ca2d51..4d25e49 100644
--- a/arch/arm/kernel/sys_arm.c
+++ b/arch/arm/kernel/sys_arm.c
@@ -328,16 +328,3 @@ asmlinkage long sys_arm_fadvise64_64(int fd, int advice,
{
return sys_fadvise64_64(fd, offset, len, advice);
}
-
-/*
- * Yet more syscall fsckage - we can't fit sys_sync_file_range's
- * arguments into the available registers with EABI. So, let's
- * create an ARM specific syscall for this which has _sane_
- * arguments. (This incidentally also has an ABI-independent
- * argument layout.)
- */
-asmlinkage long sys_arm_sync_file_range(int fd, unsigned int flags,
- loff_t offset, loff_t nbytes)
-{
- return sys_sync_file_range(fd, offset, nbytes, flags);
-}
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
index 047246a..b42cbf1 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -810,3 +810,12 @@ asmlinkage long compat_sys_request_key(const char __user *_type,
return sys_request_key(_type, _description, _callout_info, destringid);
}
+asmlinkage long compat_sys_sync_file_range2(int fd, unsigned int flags,
+ unsigned offset_hi, unsigned offset_lo,
+ unsigned nbytes_hi, unsigned nbytes_lo)
+{
+ loff_t offset = ((loff_t)offset_hi << 32) | offset_lo;
+ loff_t nbytes = ((loff_t)nbytes_hi << 32) | nbytes_lo;
+
+ return sys_sync_file_range(fd, offset, nbytes, flags);
+}
diff --git a/fs/sync.c b/fs/sync.c
index 2f97576..7cd005e 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -236,6 +236,14 @@ out:
return ret;
}
+/* It would be nice if people remember that not all the world's an i386
+ when they introduce new system calls */
+asmlinkage long sys_sync_file_range2(int fd, unsigned int flags,
+ loff_t offset, loff_t nbytes)
+{
+ return sys_sync_file_range(fd, offset, nbytes, flags);
+}
+
/*
* `endbyte' is inclusive
*/
diff --git a/include/asm-arm/unistd.h b/include/asm-arm/unistd.h
index 250d7f1..bfdbebe 100644
--- a/include/asm-arm/unistd.h
+++ b/include/asm-arm/unistd.h
@@ -367,6 +367,7 @@
#define __NR_get_robust_list (__NR_SYSCALL_BASE+339)
#define __NR_splice (__NR_SYSCALL_BASE+340)
#define __NR_arm_sync_file_range (__NR_SYSCALL_BASE+341)
+#define __NR_sync_file_range2 __NR_arm_sync_file_range
#define __NR_tee (__NR_SYSCALL_BASE+342)
#define __NR_vmsplice (__NR_SYSCALL_BASE+343)
#define __NR_move_pages (__NR_SYSCALL_BASE+344)
diff --git a/include/asm-powerpc/systbl.h b/include/asm-powerpc/systbl.h
index 700ca59..1cc3f9c 100644
--- a/include/asm-powerpc/systbl.h
+++ b/include/asm-powerpc/systbl.h
@@ -311,3 +311,4 @@ COMPAT_SYS_SPU(utimensat)
COMPAT_SYS_SPU(signalfd)
COMPAT_SYS_SPU(timerfd)
SYSCALL_SPU(eventfd)
+COMPAT_SYS_SPU(sync_file_range2)
diff --git a/include/asm-powerpc/unistd.h b/include/asm-powerpc/unistd.h
index e3c28dc..f71c606 100644
--- a/include/asm-powerpc/unistd.h
+++ b/include/asm-powerpc/unistd.h
@@ -330,10 +330,11 @@
#define __NR_signalfd 305
#define __NR_timerfd 306
#define __NR_eventfd 307
+#define __NR_sync_file_range2 308
#ifdef __KERNEL__
-#define __NR_syscalls 308
+#define __NR_syscalls 309
#define __NR__exit __NR_exit
#define NR_syscalls __NR_syscalls
diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh
index f98171f..0dcc01c 100755
--- a/scripts/checksyscalls.sh
+++ b/scripts/checksyscalls.sh
@@ -99,6 +99,11 @@ cat << EOF
#define __IGNORE_setfsuid32
#define __IGNORE_setfsgid32
+/* sync_file_range had a stupid ABI. Allow sync_file_range2 instead */
+#ifdef __NR_sync_file_range2
+#define __IGNORE_sync_file_range
+#endif
+
/* Unmerged syscalls for AFS, STREAMS, etc. */
#define __IGNORE_afs_syscall
#define __IGNORE_getpmsg
--
dwmw2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Wire up sys_sync_file_range() on powerpc
2007-06-18 9:25 ` David Woodhouse
@ 2007-06-18 9:41 ` Russell King
0 siblings, 0 replies; 5+ messages in thread
From: Russell King @ 2007-06-18 9:41 UTC (permalink / raw)
To: David Woodhouse
Cc: akpm, linux-arch, linuxppc-dev, torvalds, Paul Mackerras, drepper
On Mon, Jun 18, 2007 at 05:25:11PM +0800, David Woodhouse wrote:
> [PATCH] Add sys_sync_file_range2() system call
> ... with more sensible ABI, for those architectures which hated
> sys_sync_file_range() for wasting argument slots by misaligning 64-bit
> values. Convert ARM to use it, wire it up on PowerPC, and prevent the
> missing syscall checker from bitching about sync_file_range if you have
> sync_file_range2 instead.
>
> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
For the ARM bits:
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of:
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-06-18 9:41 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-16 11:18 [PATCH] Wire up sys_sync_file_range() on powerpc David Woodhouse
2007-06-16 18:20 ` David Woodhouse
2007-06-18 5:37 ` Paul Mackerras
2007-06-18 9:25 ` David Woodhouse
2007-06-18 9:41 ` Russell King
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).