Re: Interface for the new fallocate() system call

2007-04-24 Thread Amit K. Arora
On Fri, Apr 20, 2007 at 10:59:18AM -0400, Jakub Jelinek wrote:
> On Fri, Apr 20, 2007 at 07:21:46PM +0530, Amit K. Arora wrote:
> > Ok.
> > In this case we may have to consider following things:
> > 
> > 1) Obviously, for this glibc will have to call fallocate() syscall with
> > different arguments on s390, than other archs. I think this should be
> > doable and should not be an issue with glibc folks (right?).
> 
> glibc can cope with this easily, will just add
> sysdeps/unix/sysv/linux/s390/fallocate.c or something similar to override
> the generic Linux implementation.
> 
> > 2) we also need to see how strace behaves in this case. With little
> > knowledge that I have of strace, I don't think it should depend on
> > argument ordering of a system call on different archs (since it uses
> > ptrace internally and that should take care of it). But, it will be
> > nice if someone can confirm this.
> 
> strace would solve this with #ifdef mess, it already does that in many
> places so guess another few lines don't make it significantly worse.

I will work on the revised fallocate patchset and will post it soon.

Thanks!
--
Regards,
Amit Arora
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-04-24 Thread Amit K. Arora
On Fri, Apr 20, 2007 at 10:59:18AM -0400, Jakub Jelinek wrote:
 On Fri, Apr 20, 2007 at 07:21:46PM +0530, Amit K. Arora wrote:
  Ok.
  In this case we may have to consider following things:
  
  1) Obviously, for this glibc will have to call fallocate() syscall with
  different arguments on s390, than other archs. I think this should be
  doable and should not be an issue with glibc folks (right?).
 
 glibc can cope with this easily, will just add
 sysdeps/unix/sysv/linux/s390/fallocate.c or something similar to override
 the generic Linux implementation.
 
  2) we also need to see how strace behaves in this case. With little
  knowledge that I have of strace, I don't think it should depend on
  argument ordering of a system call on different archs (since it uses
  ptrace internally and that should take care of it). But, it will be
  nice if someone can confirm this.
 
 strace would solve this with #ifdef mess, it already does that in many
 places so guess another few lines don't make it significantly worse.

I will work on the revised fallocate patchset and will post it soon.

Thanks!
--
Regards,
Amit Arora
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-04-20 Thread Jakub Jelinek
On Fri, Apr 20, 2007 at 07:21:46PM +0530, Amit K. Arora wrote:
> Ok.
> In this case we may have to consider following things:
> 
> 1) Obviously, for this glibc will have to call fallocate() syscall with
> different arguments on s390, than other archs. I think this should be
> doable and should not be an issue with glibc folks (right?).

glibc can cope with this easily, will just add
sysdeps/unix/sysv/linux/s390/fallocate.c or something similar to override
the generic Linux implementation.

> 2) we also need to see how strace behaves in this case. With little
> knowledge that I have of strace, I don't think it should depend on
> argument ordering of a system call on different archs (since it uses
> ptrace internally and that should take care of it). But, it will be
> nice if someone can confirm this.

strace would solve this with #ifdef mess, it already does that in many
places so guess another few lines don't make it significantly worse.

Jakub
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-04-20 Thread Amit K. Arora
On Wed, Apr 18, 2007 at 07:06:00AM -0600, Andreas Dilger wrote:
> On Apr 17, 2007  18:25 +0530, Amit K. Arora wrote:
> > On Fri, Mar 30, 2007 at 02:14:17AM -0500, Jakub Jelinek wrote:
> > > Wouldn't
> > > int fallocate(loff_t offset, loff_t len, int fd, int mode)
> > > work on both s390 and ppc/arm?  glibc will certainly wrap it and
> > > reorder the arguments as needed, so there is no need to keep fd first.
> > 
> > I think more people are comfirtable with this approach.
> 
> Really?  I thought from the last postings that "fd first, wrap on s390"
> was better.
> 
> > Since glibc
> > will wrap the system call and export the "conventional" interface
> > (with fd first) to applications, we may not worry about keeping fd first
> > in kernel code. I am personally fine with this approach.
> 
> It would seem to make more sense to wrap the syscall on those architectures
> that can't handle the "conventional" interface (fd first).

Ok.
In this case we may have to consider following things:

1) Obviously, for this glibc will have to call fallocate() syscall with
different arguments on s390, than other archs. I think this should be
doable and should not be an issue with glibc folks (right?).

2) we also need to see how strace behaves in this case. With little
knowledge that I have of strace, I don't think it should depend on
argument ordering of a system call on different archs (since it uses
ptrace internally and that should take care of it). But, it will be
nice if someone can confirm this.

Thanks!
--
Regards,
Amit Arora
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-04-20 Thread Jakub Jelinek
On Fri, Apr 20, 2007 at 07:21:46PM +0530, Amit K. Arora wrote:
 Ok.
 In this case we may have to consider following things:
 
 1) Obviously, for this glibc will have to call fallocate() syscall with
 different arguments on s390, than other archs. I think this should be
 doable and should not be an issue with glibc folks (right?).

glibc can cope with this easily, will just add
sysdeps/unix/sysv/linux/s390/fallocate.c or something similar to override
the generic Linux implementation.

 2) we also need to see how strace behaves in this case. With little
 knowledge that I have of strace, I don't think it should depend on
 argument ordering of a system call on different archs (since it uses
 ptrace internally and that should take care of it). But, it will be
 nice if someone can confirm this.

strace would solve this with #ifdef mess, it already does that in many
places so guess another few lines don't make it significantly worse.

Jakub
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-04-20 Thread Amit K. Arora
On Wed, Apr 18, 2007 at 07:06:00AM -0600, Andreas Dilger wrote:
 On Apr 17, 2007  18:25 +0530, Amit K. Arora wrote:
  On Fri, Mar 30, 2007 at 02:14:17AM -0500, Jakub Jelinek wrote:
   Wouldn't
   int fallocate(loff_t offset, loff_t len, int fd, int mode)
   work on both s390 and ppc/arm?  glibc will certainly wrap it and
   reorder the arguments as needed, so there is no need to keep fd first.
  
  I think more people are comfirtable with this approach.
 
 Really?  I thought from the last postings that fd first, wrap on s390
 was better.
 
  Since glibc
  will wrap the system call and export the conventional interface
  (with fd first) to applications, we may not worry about keeping fd first
  in kernel code. I am personally fine with this approach.
 
 It would seem to make more sense to wrap the syscall on those architectures
 that can't handle the conventional interface (fd first).

Ok.
In this case we may have to consider following things:

1) Obviously, for this glibc will have to call fallocate() syscall with
different arguments on s390, than other archs. I think this should be
doable and should not be an issue with glibc folks (right?).

2) we also need to see how strace behaves in this case. With little
knowledge that I have of strace, I don't think it should depend on
argument ordering of a system call on different archs (since it uses
ptrace internally and that should take care of it). But, it will be
nice if someone can confirm this.

Thanks!
--
Regards,
Amit Arora
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-04-18 Thread Andreas Dilger
On Apr 17, 2007  18:25 +0530, Amit K. Arora wrote:
> On Fri, Mar 30, 2007 at 02:14:17AM -0500, Jakub Jelinek wrote:
> > Wouldn't
> > int fallocate(loff_t offset, loff_t len, int fd, int mode)
> > work on both s390 and ppc/arm?  glibc will certainly wrap it and
> > reorder the arguments as needed, so there is no need to keep fd first.
> 
> I think more people are comfirtable with this approach.

Really?  I thought from the last postings that "fd first, wrap on s390"
was better.

> Since glibc
> will wrap the system call and export the "conventional" interface
> (with fd first) to applications, we may not worry about keeping fd first
> in kernel code. I am personally fine with this approach.

It would seem to make more sense to wrap the syscall on those architectures
that can't handle the "conventional" interface (fd first).

> Still, if people have major concerns, we can think of getting rid of the
> "mode" argument itself. Anyhow we may, in future, need to have a policy
> based system call (say, for providing the goal block by applications for
> performance reasons). "mode" can then be made part of it.

We need at least mode="unallocate" or a separate funallocate() call to
allow allocated-but-unwritten blocks to be unallocated without actually
punching out written data.

Cheers, Andreas
--
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-04-18 Thread Andreas Dilger
On Apr 17, 2007  18:25 +0530, Amit K. Arora wrote:
 On Fri, Mar 30, 2007 at 02:14:17AM -0500, Jakub Jelinek wrote:
  Wouldn't
  int fallocate(loff_t offset, loff_t len, int fd, int mode)
  work on both s390 and ppc/arm?  glibc will certainly wrap it and
  reorder the arguments as needed, so there is no need to keep fd first.
 
 I think more people are comfirtable with this approach.

Really?  I thought from the last postings that fd first, wrap on s390
was better.

 Since glibc
 will wrap the system call and export the conventional interface
 (with fd first) to applications, we may not worry about keeping fd first
 in kernel code. I am personally fine with this approach.

It would seem to make more sense to wrap the syscall on those architectures
that can't handle the conventional interface (fd first).

 Still, if people have major concerns, we can think of getting rid of the
 mode argument itself. Anyhow we may, in future, need to have a policy
 based system call (say, for providing the goal block by applications for
 performance reasons). mode can then be made part of it.

We need at least mode=unallocate or a separate funallocate() call to
allow allocated-but-unwritten blocks to be unallocated without actually
punching out written data.

Cheers, Andreas
--
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-04-17 Thread Amit K. Arora
On Fri, Mar 30, 2007 at 02:14:17AM -0500, Jakub Jelinek wrote:
> Wouldn't
> int fallocate(loff_t offset, loff_t len, int fd, int mode)
> work on both s390 and ppc/arm?  glibc will certainly wrap it and
> reorder the arguments as needed, so there is no need to keep fd first.
>

I think more people are comfirtable with this approach. Since glibc
will wrap the system call and export the "conventional" interface
(with fd first) to applications, we may not worry about keeping fd first
in kernel code. I am personally fine with this approach.

Still, if people have major concerns, we can think of getting rid of the
"mode" argument itself. Anyhow we may, in future, need to have a policy
based system call (say, for providing the goal block by applications for
performance reasons). "mode" can then be made part of it.

Comments ?
--
Regards,
Amit Arora
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-04-17 Thread Amit K. Arora
On Fri, Mar 30, 2007 at 02:14:17AM -0500, Jakub Jelinek wrote:
 Wouldn't
 int fallocate(loff_t offset, loff_t len, int fd, int mode)
 work on both s390 and ppc/arm?  glibc will certainly wrap it and
 reorder the arguments as needed, so there is no need to keep fd first.


I think more people are comfirtable with this approach. Since glibc
will wrap the system call and export the conventional interface
(with fd first) to applications, we may not worry about keeping fd first
in kernel code. I am personally fine with this approach.

Still, if people have major concerns, we can think of getting rid of the
mode argument itself. Anyhow we may, in future, need to have a policy
based system call (say, for providing the goal block by applications for
performance reasons). mode can then be made part of it.

Comments ?
--
Regards,
Amit Arora
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-04-09 Thread Jörn Engel
On Mon, 9 April 2007 23:01:42 +1000, Paul Mackerras wrote:
> Jörn Engel writes:
> 
> > Wouldn't that work be confined to fallocate()?  If I understand Heiko
> > correctly, the alternative would slow s390 down for every syscall,
> > including more performance-critical ones.
> 
> The alternative that Jakub suggested wouldn't slow s390 down.

True.  And it appears to be one of the least offensive options we have.

Jörn

-- 
My second remark is that our intellectual powers are rather geared to
master static relations and that our powers to visualize processes
evolving in time are relatively poorly developed.
-- Edsger W. Dijkstra
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-04-09 Thread Paul Mackerras
Jörn Engel writes:

> Wouldn't that work be confined to fallocate()?  If I understand Heiko
> correctly, the alternative would slow s390 down for every syscall,
> including more performance-critical ones.

The alternative that Jakub suggested wouldn't slow s390 down.

Paul.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-04-09 Thread Paul Mackerras
Jörn Engel writes:

 Wouldn't that work be confined to fallocate()?  If I understand Heiko
 correctly, the alternative would slow s390 down for every syscall,
 including more performance-critical ones.

The alternative that Jakub suggested wouldn't slow s390 down.

Paul.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-04-09 Thread Jörn Engel
On Mon, 9 April 2007 23:01:42 +1000, Paul Mackerras wrote:
 Jörn Engel writes:
 
  Wouldn't that work be confined to fallocate()?  If I understand Heiko
  correctly, the alternative would slow s390 down for every syscall,
  including more performance-critical ones.
 
 The alternative that Jakub suggested wouldn't slow s390 down.

True.  And it appears to be one of the least offensive options we have.

Jörn

-- 
My second remark is that our intellectual powers are rather geared to
master static relations and that our powers to visualize processes
evolving in time are relatively poorly developed.
-- Edsger W. Dijkstra
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-04-06 Thread Andreas Dilger
On Apr 05, 2007  16:56 +0530, Amit K. Arora wrote:
> This should work on all the platforms. The only concern I can think of
> here is the convention being followed till now, where all the entities on
> which the action has to be performed by the kernel (say fd, file/device
> name, pid etc.) is the first argument of the system call. If we can live
> with the small exception here, fine.

Yes, it is much cleaner to have fd first, like every other such syscall.

> Or else, we may have to implement the 
> 
>   int fd, int mode, loff_t offset, loff_t len
> 
> as the layout of arguments here. I think only s390 will have a problem
> with this, and we can think of a workaround for it (may be similar to
> what ARM did to implement sync_file_range() system call)   :
> 
> asmlinkage long sys_s390_fallocate(int fd, loff_t offset, loff_t len, int 
> mode)
> {
> return sys_fallocate(fd, offset, len, mode);
> }

Cheers, Andreas
--
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-04-06 Thread Andreas Dilger
On Apr 05, 2007  16:56 +0530, Amit K. Arora wrote:
 This should work on all the platforms. The only concern I can think of
 here is the convention being followed till now, where all the entities on
 which the action has to be performed by the kernel (say fd, file/device
 name, pid etc.) is the first argument of the system call. If we can live
 with the small exception here, fine.

Yes, it is much cleaner to have fd first, like every other such syscall.

 Or else, we may have to implement the 
 
   int fd, int mode, loff_t offset, loff_t len
 
 as the layout of arguments here. I think only s390 will have a problem
 with this, and we can think of a workaround for it (may be similar to
 what ARM did to implement sync_file_range() system call)   :
 
 asmlinkage long sys_s390_fallocate(int fd, loff_t offset, loff_t len, int 
 mode)
 {
 return sys_fallocate(fd, offset, len, mode);
 }

Cheers, Andreas
--
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-04-05 Thread Randy Dunlap
On Thu, 5 Apr 2007 16:56:19 +0530 Amit K. Arora wrote:

> On Fri, Mar 30, 2007 at 02:14:17AM -0500, Jakub Jelinek wrote:
> > Wouldn't
> > int fallocate(loff_t offset, loff_t len, int fd, int mode)
> > work on both s390 and ppc/arm?  glibc will certainly wrap it and
> > reorder the arguments as needed, so there is no need to keep fd first.
>  
> This should work on all the platforms. The only concern I can think of
> here is the convention being followed till now, where all the entities on
> which the action has to be performed by the kernel (say fd, file/device
> name, pid etc.) is the first argument of the system call. If we can live
> with the small exception here, fine.
> 
> Or else, we may have to implement the 
> 
>   int fd, int mode, loff_t offset, loff_t len
> 
> as the layout of arguments here. I think only s390 will have a problem
> with this, and we can think of a workaround for it (may be similar to
> what ARM did to implement sync_file_range() system call)   :
> 
> asmlinkage long sys_s390_fallocate(int fd, loff_t offset, loff_t len, int 
> mode)
> {
> return sys_fallocate(fd, offset, len, mode);
> }
> 
> 
> To me both the approaches look slightly unconventional. But, we need to
> compromise somewhere to make things work on all the platforms.
> 
> Any thoughts on which one of the above should we finalize on ?
> 
> Thanks!

If s390 can work around the calling order that easily, I certainly
prefer the more conventional ordering of:

>   int fd, int mode, loff_t offset, loff_t len

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-04-05 Thread Amit K. Arora
On Fri, Mar 30, 2007 at 02:14:17AM -0500, Jakub Jelinek wrote:
> Wouldn't
> int fallocate(loff_t offset, loff_t len, int fd, int mode)
> work on both s390 and ppc/arm?  glibc will certainly wrap it and
> reorder the arguments as needed, so there is no need to keep fd first.
 
This should work on all the platforms. The only concern I can think of
here is the convention being followed till now, where all the entities on
which the action has to be performed by the kernel (say fd, file/device
name, pid etc.) is the first argument of the system call. If we can live
with the small exception here, fine.

Or else, we may have to implement the 

  int fd, int mode, loff_t offset, loff_t len

as the layout of arguments here. I think only s390 will have a problem
with this, and we can think of a workaround for it (may be similar to
what ARM did to implement sync_file_range() system call)   :

asmlinkage long sys_s390_fallocate(int fd, loff_t offset, loff_t len, int mode)
{
return sys_fallocate(fd, offset, len, mode);
}


To me both the approaches look slightly unconventional. But, we need to
compromise somewhere to make things work on all the platforms.

Any thoughts on which one of the above should we finalize on ?

Thanks!
--
Regards,
Amit Arora
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-04-05 Thread Amit K. Arora
On Thu, Apr 05, 2007 at 04:56:19PM +0530, Amit K. Arora wrote:

Correction below:

> asmlinkage long sys_s390_fallocate(int fd, loff_t offset, loff_t len, int 
> mode)
> {
> return sys_fallocate(fd, offset, len, mode);
  return sys_fallocate(fd, mode, offset, len);
> }

--
Regards,
Amit Arora
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-04-05 Thread Amit K. Arora
On Thu, Apr 05, 2007 at 04:56:19PM +0530, Amit K. Arora wrote:

Correction below:

 asmlinkage long sys_s390_fallocate(int fd, loff_t offset, loff_t len, int 
 mode)
 {
 return sys_fallocate(fd, offset, len, mode);
  return sys_fallocate(fd, mode, offset, len);
 }

--
Regards,
Amit Arora
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-04-05 Thread Amit K. Arora
On Fri, Mar 30, 2007 at 02:14:17AM -0500, Jakub Jelinek wrote:
 Wouldn't
 int fallocate(loff_t offset, loff_t len, int fd, int mode)
 work on both s390 and ppc/arm?  glibc will certainly wrap it and
 reorder the arguments as needed, so there is no need to keep fd first.
 
This should work on all the platforms. The only concern I can think of
here is the convention being followed till now, where all the entities on
which the action has to be performed by the kernel (say fd, file/device
name, pid etc.) is the first argument of the system call. If we can live
with the small exception here, fine.

Or else, we may have to implement the 

  int fd, int mode, loff_t offset, loff_t len

as the layout of arguments here. I think only s390 will have a problem
with this, and we can think of a workaround for it (may be similar to
what ARM did to implement sync_file_range() system call)   :

asmlinkage long sys_s390_fallocate(int fd, loff_t offset, loff_t len, int mode)
{
return sys_fallocate(fd, offset, len, mode);
}


To me both the approaches look slightly unconventional. But, we need to
compromise somewhere to make things work on all the platforms.

Any thoughts on which one of the above should we finalize on ?

Thanks!
--
Regards,
Amit Arora
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-04-05 Thread Randy Dunlap
On Thu, 5 Apr 2007 16:56:19 +0530 Amit K. Arora wrote:

 On Fri, Mar 30, 2007 at 02:14:17AM -0500, Jakub Jelinek wrote:
  Wouldn't
  int fallocate(loff_t offset, loff_t len, int fd, int mode)
  work on both s390 and ppc/arm?  glibc will certainly wrap it and
  reorder the arguments as needed, so there is no need to keep fd first.
  
 This should work on all the platforms. The only concern I can think of
 here is the convention being followed till now, where all the entities on
 which the action has to be performed by the kernel (say fd, file/device
 name, pid etc.) is the first argument of the system call. If we can live
 with the small exception here, fine.
 
 Or else, we may have to implement the 
 
   int fd, int mode, loff_t offset, loff_t len
 
 as the layout of arguments here. I think only s390 will have a problem
 with this, and we can think of a workaround for it (may be similar to
 what ARM did to implement sync_file_range() system call)   :
 
 asmlinkage long sys_s390_fallocate(int fd, loff_t offset, loff_t len, int 
 mode)
 {
 return sys_fallocate(fd, offset, len, mode);
 }
 
 
 To me both the approaches look slightly unconventional. But, we need to
 compromise somewhere to make things work on all the platforms.
 
 Any thoughts on which one of the above should we finalize on ?
 
 Thanks!

If s390 can work around the calling order that easily, I certainly
prefer the more conventional ordering of:

   int fd, int mode, loff_t offset, loff_t len

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-03-30 Thread Heiko Carstens
On Fri, Mar 30, 2007 at 12:44:49PM +0200, Jörn Engel wrote:
> On Fri, 30 March 2007 19:15:58 +1000, Paul Mackerras wrote:
> > It does mean extra unnecessary work for 64-bit platforms, though...
> 
> Wouldn't that work be confined to fallocate()?  If I understand Heiko
> correctly, the alternative would slow s390 down for every syscall,
> including more performance-critical ones.

That is correct.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-03-30 Thread Jörn Engel
On Fri, 30 March 2007 19:15:58 +1000, Paul Mackerras wrote:
> Heiko Carstens writes:
> 
> > If possible I'd prefer the six-32-bit-args approach.
> 
> It does mean extra unnecessary work for 64-bit platforms, though...

Wouldn't that work be confined to fallocate()?  If I understand Heiko
correctly, the alternative would slow s390 down for every syscall,
including more performance-critical ones.

Jörn

-- 
tglx1 thinks that joern should get a (TM) for "Thinking Is Hard"
-- Thomas Gleixner
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-03-30 Thread Paul Mackerras
Heiko Carstens writes:

> If possible I'd prefer the six-32-bit-args approach.

It does mean extra unnecessary work for 64-bit platforms, though...

Paul.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-03-30 Thread Paul Mackerras
Jakub Jelinek writes:

> Wouldn't
> int fallocate(loff_t offset, loff_t len, int fd, int mode)
> work on both s390 and ppc/arm?  glibc will certainly wrap it and
> reorder the arguments as needed, so there is no need to keep fd first.

That looks fine to me.

Paul.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-03-30 Thread Heiko Carstens
On Fri, Mar 30, 2007 at 02:14:17AM -0500, Jakub Jelinek wrote:
> On Thu, Mar 29, 2007 at 10:10:10AM -0700, Andrew Morton wrote:
> > > Platform: s390
> > > --
> > > s390 prefers following layout:
> > > 
> > >int fallocate(int fd, loff_t offset, loff_t len, int mode)
> > > 
> > > For details on why and how "int, int, loff_t, loff_t" is a problem on
> > > s390, please see Heiko's mail on 16th March. Here is the link:
> > > http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg133595.html
> > > 
> > > Platform: ppc, arm
> > > --
> > > ppc (32 bit) has a problem with "int, loff_t, loff_t, int" layout,
> > > since this will result in a pad between fd and offset, making seven
> > > arguments total - which is not supported by ppc32. It supports only
> > > 6 arguments. Thus the desired layout by ppc32 is:
> > > 
> > >int fallocate(int fd, int mode, loff_t offset, loff_t len)
> > > 
> > > Even ARM prefers above kind of layout. For details please see the
> > > definition of sys_arm_sync_file_range().
> > 
> > This is a clean-looking option.  Can s390 be changed to support seven-arg
> > syscalls?
> 
> Wouldn't
> int fallocate(loff_t offset, loff_t len, int fd, int mode)
> work on both s390 and ppc/arm?  glibc will certainly wrap it and
> reorder the arguments as needed, so there is no need to keep fd first.

That would be fine for s390.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-03-30 Thread Heiko Carstens
> > Even ARM prefers above kind of layout. For details please see the
> > definition of sys_arm_sync_file_range().
> 
> This is a clean-looking option.  Can s390 be changed to support seven-arg
> syscalls?
> 
> > Option of loff_t => high u32 + low u32
> > --
> > Matthew and Russell have suggested another option of breaking each
> > "loff_t" into two "u32"s. This will result in 6 arguments in total.
> > 
> > Following think that this is a good alternative:
> > Matthew Wilcox, Russell King, Heiko Carstens
> > 
> > Following do not like this idea:
> > Chris Wedgwood
> 
> It's a bit weird-looking, but the six-32-bit-args approach is simple
> enought to understand and implement.  Presumably the glibc wrapper
> would hide that detail from everyone.

s390 can be changed to support seven-arg syscalls. But that would require
creating an additional stackframe in *libc to save original register
contents and in addition it would make our syscall hotpath slower.
That is because we have to take care of an additional register that might
contain user space passed contents and needs to be put on the kernel stack.
If possible I'd prefer the six-32-bit-args approach.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-03-30 Thread Jakub Jelinek
On Thu, Mar 29, 2007 at 10:10:10AM -0700, Andrew Morton wrote:
> > Platform: s390
> > --
> > s390 prefers following layout:
> > 
> >int fallocate(int fd, loff_t offset, loff_t len, int mode)
> > 
> > For details on why and how "int, int, loff_t, loff_t" is a problem on
> > s390, please see Heiko's mail on 16th March. Here is the link:
> > http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg133595.html
> > 
> > Platform: ppc, arm
> > --
> > ppc (32 bit) has a problem with "int, loff_t, loff_t, int" layout,
> > since this will result in a pad between fd and offset, making seven
> > arguments total - which is not supported by ppc32. It supports only
> > 6 arguments. Thus the desired layout by ppc32 is:
> > 
> >int fallocate(int fd, int mode, loff_t offset, loff_t len)
> > 
> > Even ARM prefers above kind of layout. For details please see the
> > definition of sys_arm_sync_file_range().
> 
> This is a clean-looking option.  Can s390 be changed to support seven-arg
> syscalls?

Wouldn't
int fallocate(loff_t offset, loff_t len, int fd, int mode)
work on both s390 and ppc/arm?  glibc will certainly wrap it and
reorder the arguments as needed, so there is no need to keep fd first.

Jakub
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-03-30 Thread Heiko Carstens
On Thu, Mar 29, 2007 at 07:01:54PM +0200, Jan Engelhardt wrote:
> Hi,
> 
> On Mar 29 2007 17:21, Amit K. Arora wrote:
> >
> >We need to come up with the best possible layout of arguments for the
> >fallocate() system call. Various architectures have different
> >requirements for how the arguments should look like. Since the mail
> >chain has become huge, here is the summary of various inputs received
> >so far.
> 
> >s390 prefers following layout:
> >   int fallocate(int fd, loff_t offset, loff_t len, int mode)
> >For details on why and how "int, int, loff_t, loff_t" is a problem on
> >s390, please see Heiko's mail on 16th March. Here is the link:
> >http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg133595.html
> 
> Quoting that...
>   |len -> r6 + second halve on stack
> 
> Then, is not this a gcc glitch? (IMO, it should put all of "len" on the 
> stack)

It _does_ put all of "len" on the stack. That is what I tried to explain
in the section that follows what you quoted.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-03-30 Thread Heiko Carstens
On Thu, Mar 29, 2007 at 07:01:54PM +0200, Jan Engelhardt wrote:
 Hi,
 
 On Mar 29 2007 17:21, Amit K. Arora wrote:
 
 We need to come up with the best possible layout of arguments for the
 fallocate() system call. Various architectures have different
 requirements for how the arguments should look like. Since the mail
 chain has become huge, here is the summary of various inputs received
 so far.
 
 s390 prefers following layout:
int fallocate(int fd, loff_t offset, loff_t len, int mode)
 For details on why and how int, int, loff_t, loff_t is a problem on
 s390, please see Heiko's mail on 16th March. Here is the link:
 http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg133595.html
 
 Quoting that...
   |len - r6 + second halve on stack
 
 Then, is not this a gcc glitch? (IMO, it should put all of len on the 
 stack)

It _does_ put all of len on the stack. That is what I tried to explain
in the section that follows what you quoted.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-03-30 Thread Jakub Jelinek
On Thu, Mar 29, 2007 at 10:10:10AM -0700, Andrew Morton wrote:
  Platform: s390
  --
  s390 prefers following layout:
  
 int fallocate(int fd, loff_t offset, loff_t len, int mode)
  
  For details on why and how int, int, loff_t, loff_t is a problem on
  s390, please see Heiko's mail on 16th March. Here is the link:
  http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg133595.html
  
  Platform: ppc, arm
  --
  ppc (32 bit) has a problem with int, loff_t, loff_t, int layout,
  since this will result in a pad between fd and offset, making seven
  arguments total - which is not supported by ppc32. It supports only
  6 arguments. Thus the desired layout by ppc32 is:
  
 int fallocate(int fd, int mode, loff_t offset, loff_t len)
  
  Even ARM prefers above kind of layout. For details please see the
  definition of sys_arm_sync_file_range().
 
 This is a clean-looking option.  Can s390 be changed to support seven-arg
 syscalls?

Wouldn't
int fallocate(loff_t offset, loff_t len, int fd, int mode)
work on both s390 and ppc/arm?  glibc will certainly wrap it and
reorder the arguments as needed, so there is no need to keep fd first.

Jakub
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-03-30 Thread Heiko Carstens
  Even ARM prefers above kind of layout. For details please see the
  definition of sys_arm_sync_file_range().
 
 This is a clean-looking option.  Can s390 be changed to support seven-arg
 syscalls?
 
  Option of loff_t = high u32 + low u32
  --
  Matthew and Russell have suggested another option of breaking each
  loff_t into two u32s. This will result in 6 arguments in total.
  
  Following think that this is a good alternative:
  Matthew Wilcox, Russell King, Heiko Carstens
  
  Following do not like this idea:
  Chris Wedgwood
 
 It's a bit weird-looking, but the six-32-bit-args approach is simple
 enought to understand and implement.  Presumably the glibc wrapper
 would hide that detail from everyone.

s390 can be changed to support seven-arg syscalls. But that would require
creating an additional stackframe in *libc to save original register
contents and in addition it would make our syscall hotpath slower.
That is because we have to take care of an additional register that might
contain user space passed contents and needs to be put on the kernel stack.
If possible I'd prefer the six-32-bit-args approach.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-03-30 Thread Heiko Carstens
On Fri, Mar 30, 2007 at 02:14:17AM -0500, Jakub Jelinek wrote:
 On Thu, Mar 29, 2007 at 10:10:10AM -0700, Andrew Morton wrote:
   Platform: s390
   --
   s390 prefers following layout:
   
  int fallocate(int fd, loff_t offset, loff_t len, int mode)
   
   For details on why and how int, int, loff_t, loff_t is a problem on
   s390, please see Heiko's mail on 16th March. Here is the link:
   http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg133595.html
   
   Platform: ppc, arm
   --
   ppc (32 bit) has a problem with int, loff_t, loff_t, int layout,
   since this will result in a pad between fd and offset, making seven
   arguments total - which is not supported by ppc32. It supports only
   6 arguments. Thus the desired layout by ppc32 is:
   
  int fallocate(int fd, int mode, loff_t offset, loff_t len)
   
   Even ARM prefers above kind of layout. For details please see the
   definition of sys_arm_sync_file_range().
  
  This is a clean-looking option.  Can s390 be changed to support seven-arg
  syscalls?
 
 Wouldn't
 int fallocate(loff_t offset, loff_t len, int fd, int mode)
 work on both s390 and ppc/arm?  glibc will certainly wrap it and
 reorder the arguments as needed, so there is no need to keep fd first.

That would be fine for s390.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-03-30 Thread Paul Mackerras
Heiko Carstens writes:

 If possible I'd prefer the six-32-bit-args approach.

It does mean extra unnecessary work for 64-bit platforms, though...

Paul.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-03-30 Thread Paul Mackerras
Jakub Jelinek writes:

 Wouldn't
 int fallocate(loff_t offset, loff_t len, int fd, int mode)
 work on both s390 and ppc/arm?  glibc will certainly wrap it and
 reorder the arguments as needed, so there is no need to keep fd first.

That looks fine to me.

Paul.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-03-30 Thread Jörn Engel
On Fri, 30 March 2007 19:15:58 +1000, Paul Mackerras wrote:
 Heiko Carstens writes:
 
  If possible I'd prefer the six-32-bit-args approach.
 
 It does mean extra unnecessary work for 64-bit platforms, though...

Wouldn't that work be confined to fallocate()?  If I understand Heiko
correctly, the alternative would slow s390 down for every syscall,
including more performance-critical ones.

Jörn

-- 
tglx1 thinks that joern should get a (TM) for Thinking Is Hard
-- Thomas Gleixner
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-03-30 Thread Heiko Carstens
On Fri, Mar 30, 2007 at 12:44:49PM +0200, Jörn Engel wrote:
 On Fri, 30 March 2007 19:15:58 +1000, Paul Mackerras wrote:
  It does mean extra unnecessary work for 64-bit platforms, though...
 
 Wouldn't that work be confined to fallocate()?  If I understand Heiko
 correctly, the alternative would slow s390 down for every syscall,
 including more performance-critical ones.

That is correct.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-03-29 Thread Linus Torvalds


On Thu, 29 Mar 2007, Jan Engelhardt wrote:
>
> I have to disagree, since wrapping it into a struct and copying the struct
> in kernelspace from userspace requires more code.

Not just more code, but more security issues too.

Passing system call arguments by value means that there are no subtle 
security issues - the value you use is the value you got. But once you 
pass-by-reference, you have to make damn sure that you do the proper user 
space accesses and verify the pointer correctly.

User-space (aka "user-supplied") pointers are just more dangerous. We 
obviously can't avoid them, but they need much more care than just a 
random value directly passed in a register.

Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-03-29 Thread Jan Engelhardt
 
On Mar 29 2007 13:18, linux-os (Dick Johnson) wrote:
>
>I think it's always better to put only a pointer on the stack as
>above.

I have to disagree, since wrapping it into a struct and copying the struct
in kernelspace from userspace requires more code. Pointers only become
useful at 3 (rarely) or 4 (yeah, more likely) and 5+ (definitely)
arguments, (3) see above about copying, (4) middle thing and (5) tons of
arguments like mmap() should be wrapped up... for simplicity of dealing
with it later.


Jan
-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-03-29 Thread linux-os \(Dick Johnson\)

On Thu, 29 Mar 2007, Jan Engelhardt wrote:

> Hi,
>
> On Mar 29 2007 17:21, Amit K. Arora wrote:
>>
>> We need to come up with the best possible layout of arguments for the
>> fallocate() system call. Various architectures have different
>> requirements for how the arguments should look like. Since the mail
>> chain has become huge, here is the summary of various inputs received
>> so far.
>
>> s390 prefers following layout:
>>   int fallocate(int fd, loff_t offset, loff_t len, int mode)
>> For details on why and how "int, int, loff_t, loff_t" is a problem on
>> s390, please see Heiko's mail on 16th March. Here is the link:
>> http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg133595.html
>
> Quoting that...
>   |len -> r6 + second halve on stack
>
> Then, is not this a gcc glitch? (IMO, it should put all of "len" on the
> stack)
>
>> Platform: ppc, arm
>> --
>> 6 arguments. Thus the desired layout by ppc32 is:
>>   int fallocate(int fd, int mode, loff_t offset, loff_t len)
>>
>> Option of loff_t => high u32 + low u32
>> --
>> Matthew and Russell have suggested another option of breaking each
>> "loff_t" into two "u32"s. This will result in 6 arguments in total.
>>
>> What are your thoughts on this ? What layout should we finalize on ?
>> Perhaps, since sync_file_range() system call has similar arguments, we
>> can take hint from the challenges faced on implementing it on various
>> architectures, and decide.
>>
>> Please suggest. Thanks!
>
> Does it actually matter? Glibc can have its own argument ordering
> different from the syscalls, so at least it would be possible to lay out
> the syscall arguments in the most portable way while retaining nice
> userspace C code. Hey, glibc might even wrap it up in a struct! (Using a
> pointer, as suggested in one of the proposals.)
>
> int fallocate(int fd, loff_t offset, loff_t len, int mode)
> {
>   struct fallocate_foobar d = {fd, offset, len, mode};
>   return _syscall(..., );
> }
>
> Jan
> --

I think it's always better to put only a pointer on the stack as
above.

Cheers,
Dick Johnson
Penguin : Linux version 2.6.16.24 on an i686 machine (5592.62 BogoMips).
New book: http://www.AbominableFirebug.com/
_



The information transmitted in this message is confidential and may be 
privileged.  Any review, retransmission, dissemination, or other use of this 
information by persons or entities other than the intended recipient is 
prohibited.  If you are not the intended recipient, please notify Analogic 
Corporation immediately - by replying to this message or by sending an email to 
[EMAIL PROTECTED] - and destroy all copies of this information, including any 
attachments, without reading or disclosing them.

Thank you.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-03-29 Thread Andrew Morton
On Thu, 29 Mar 2007 17:21:26 +0530 "Amit K. Arora" <[EMAIL PROTECTED]> wrote:

> Hello,
> 
> We need to come up with the best possible layout of arguments for the
> fallocate() system call. Various architectures have different
> requirements for how the arguments should look like. Since the mail
> chain has become huge, here is the summary of various inputs received
> so far.
> 
> Platform: s390
> --
> s390 prefers following layout:
> 
>int fallocate(int fd, loff_t offset, loff_t len, int mode)
> 
> For details on why and how "int, int, loff_t, loff_t" is a problem on
> s390, please see Heiko's mail on 16th March. Here is the link:
> http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg133595.html
> 
> Platform: ppc, arm
> --
> ppc (32 bit) has a problem with "int, loff_t, loff_t, int" layout,
> since this will result in a pad between fd and offset, making seven
> arguments total - which is not supported by ppc32. It supports only
> 6 arguments. Thus the desired layout by ppc32 is:
> 
>int fallocate(int fd, int mode, loff_t offset, loff_t len)
> 
> Even ARM prefers above kind of layout. For details please see the
> definition of sys_arm_sync_file_range().

This is a clean-looking option.  Can s390 be changed to support seven-arg
syscalls?

> Option of loff_t => high u32 + low u32
> --
> Matthew and Russell have suggested another option of breaking each
> "loff_t" into two "u32"s. This will result in 6 arguments in total.
> 
> Following think that this is a good alternative:
> Matthew Wilcox, Russell King, Heiko Carstens
> 
> Following do not like this idea:
> Chris Wedgwood

It's a bit weird-looking, but the six-32-bit-args approach is simple
enought to understand and implement.  Presumably the glibc wrapper
would hide that detail from everyone.
 
> 
> What are your thoughts on this ? What layout should we finalize on ?
> Perhaps, since sync_file_range() system call has similar arguments, we
> can take hint from the challenges faced on implementing it on various
> architectures, and decide.
> 


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-03-29 Thread Jan Engelhardt
Hi,

On Mar 29 2007 17:21, Amit K. Arora wrote:
>
>We need to come up with the best possible layout of arguments for the
>fallocate() system call. Various architectures have different
>requirements for how the arguments should look like. Since the mail
>chain has become huge, here is the summary of various inputs received
>so far.

>s390 prefers following layout:
>   int fallocate(int fd, loff_t offset, loff_t len, int mode)
>For details on why and how "int, int, loff_t, loff_t" is a problem on
>s390, please see Heiko's mail on 16th March. Here is the link:
>http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg133595.html

Quoting that...
|len -> r6 + second halve on stack

Then, is not this a gcc glitch? (IMO, it should put all of "len" on the 
stack)

>Platform: ppc, arm
>--
>6 arguments. Thus the desired layout by ppc32 is:
>   int fallocate(int fd, int mode, loff_t offset, loff_t len)
>
>Option of loff_t => high u32 + low u32
>--
>Matthew and Russell have suggested another option of breaking each
>"loff_t" into two "u32"s. This will result in 6 arguments in total.
>
>What are your thoughts on this ? What layout should we finalize on ?
>Perhaps, since sync_file_range() system call has similar arguments, we
>can take hint from the challenges faced on implementing it on various
>architectures, and decide.
>
>Please suggest. Thanks!

Does it actually matter? Glibc can have its own argument ordering
different from the syscalls, so at least it would be possible to lay out
the syscall arguments in the most portable way while retaining nice
userspace C code. Hey, glibc might even wrap it up in a struct! (Using a 
pointer, as suggested in one of the proposals.)

int fallocate(int fd, loff_t offset, loff_t len, int mode)
{
struct fallocate_foobar d = {fd, offset, len, mode};
return _syscall(..., );
}




Jan
-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-03-29 Thread Chris Wedgwood
On Thu, Mar 29, 2007 at 05:21:26PM +0530, Amit K. Arora wrote:

>int fallocate(int fd, loff_t offset, loff_t len, int mode)

Right now there are only two possible values for mode --- it's not
clear what additional values there will be in the future.

How about two syscalls?  If we decide later on we need something more
complicated we can revisit this and *THEN* add another system call
which may end up being a superset of the other two.

I know that sounds somewhat icky but:

  * it's fairly simple

  * we get nice argument handling on all arches by dropping u32 mode
(don't we?)

  * syscalls don't really cost a lot to keep about, they do cost in
terms on maintenance though, but in this case i don't see it being
all that much of a problem

  * IMO badly/over designed syscalls are going to be a bigger problem
long term

Given that *NO* single fs in mainline right now can *reliably* use
this functionality for a while maybe whatever solution people come up
with next should sit in -mm for a while?  At least that gives people
exposure to it and a chance to make some changes as once it's merged
to mainline it's pretty hard to change.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-03-29 Thread Chris Wedgwood
On Thu, Mar 29, 2007 at 05:21:26PM +0530, Amit K. Arora wrote:

int fallocate(int fd, loff_t offset, loff_t len, int mode)

Right now there are only two possible values for mode --- it's not
clear what additional values there will be in the future.

How about two syscalls?  If we decide later on we need something more
complicated we can revisit this and *THEN* add another system call
which may end up being a superset of the other two.

I know that sounds somewhat icky but:

  * it's fairly simple

  * we get nice argument handling on all arches by dropping u32 mode
(don't we?)

  * syscalls don't really cost a lot to keep about, they do cost in
terms on maintenance though, but in this case i don't see it being
all that much of a problem

  * IMO badly/over designed syscalls are going to be a bigger problem
long term

Given that *NO* single fs in mainline right now can *reliably* use
this functionality for a while maybe whatever solution people come up
with next should sit in -mm for a while?  At least that gives people
exposure to it and a chance to make some changes as once it's merged
to mainline it's pretty hard to change.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-03-29 Thread Jan Engelhardt
Hi,

On Mar 29 2007 17:21, Amit K. Arora wrote:

We need to come up with the best possible layout of arguments for the
fallocate() system call. Various architectures have different
requirements for how the arguments should look like. Since the mail
chain has become huge, here is the summary of various inputs received
so far.

s390 prefers following layout:
   int fallocate(int fd, loff_t offset, loff_t len, int mode)
For details on why and how int, int, loff_t, loff_t is a problem on
s390, please see Heiko's mail on 16th March. Here is the link:
http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg133595.html

Quoting that...
|len - r6 + second halve on stack

Then, is not this a gcc glitch? (IMO, it should put all of len on the 
stack)

Platform: ppc, arm
--
6 arguments. Thus the desired layout by ppc32 is:
   int fallocate(int fd, int mode, loff_t offset, loff_t len)

Option of loff_t = high u32 + low u32
--
Matthew and Russell have suggested another option of breaking each
loff_t into two u32s. This will result in 6 arguments in total.

What are your thoughts on this ? What layout should we finalize on ?
Perhaps, since sync_file_range() system call has similar arguments, we
can take hint from the challenges faced on implementing it on various
architectures, and decide.

Please suggest. Thanks!

Does it actually matter? Glibc can have its own argument ordering
different from the syscalls, so at least it would be possible to lay out
the syscall arguments in the most portable way while retaining nice
userspace C code. Hey, glibc might even wrap it up in a struct! (Using a 
pointer, as suggested in one of the proposals.)

int fallocate(int fd, loff_t offset, loff_t len, int mode)
{
struct fallocate_foobar d = {fd, offset, len, mode};
return _syscall(..., d);
}




Jan
-- 
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-03-29 Thread Andrew Morton
On Thu, 29 Mar 2007 17:21:26 +0530 Amit K. Arora [EMAIL PROTECTED] wrote:

 Hello,
 
 We need to come up with the best possible layout of arguments for the
 fallocate() system call. Various architectures have different
 requirements for how the arguments should look like. Since the mail
 chain has become huge, here is the summary of various inputs received
 so far.
 
 Platform: s390
 --
 s390 prefers following layout:
 
int fallocate(int fd, loff_t offset, loff_t len, int mode)
 
 For details on why and how int, int, loff_t, loff_t is a problem on
 s390, please see Heiko's mail on 16th March. Here is the link:
 http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg133595.html
 
 Platform: ppc, arm
 --
 ppc (32 bit) has a problem with int, loff_t, loff_t, int layout,
 since this will result in a pad between fd and offset, making seven
 arguments total - which is not supported by ppc32. It supports only
 6 arguments. Thus the desired layout by ppc32 is:
 
int fallocate(int fd, int mode, loff_t offset, loff_t len)
 
 Even ARM prefers above kind of layout. For details please see the
 definition of sys_arm_sync_file_range().

This is a clean-looking option.  Can s390 be changed to support seven-arg
syscalls?

 Option of loff_t = high u32 + low u32
 --
 Matthew and Russell have suggested another option of breaking each
 loff_t into two u32s. This will result in 6 arguments in total.
 
 Following think that this is a good alternative:
 Matthew Wilcox, Russell King, Heiko Carstens
 
 Following do not like this idea:
 Chris Wedgwood

It's a bit weird-looking, but the six-32-bit-args approach is simple
enought to understand and implement.  Presumably the glibc wrapper
would hide that detail from everyone.
 
 
 What are your thoughts on this ? What layout should we finalize on ?
 Perhaps, since sync_file_range() system call has similar arguments, we
 can take hint from the challenges faced on implementing it on various
 architectures, and decide.
 


-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-03-29 Thread linux-os \(Dick Johnson\)

On Thu, 29 Mar 2007, Jan Engelhardt wrote:

 Hi,

 On Mar 29 2007 17:21, Amit K. Arora wrote:

 We need to come up with the best possible layout of arguments for the
 fallocate() system call. Various architectures have different
 requirements for how the arguments should look like. Since the mail
 chain has become huge, here is the summary of various inputs received
 so far.

 s390 prefers following layout:
   int fallocate(int fd, loff_t offset, loff_t len, int mode)
 For details on why and how int, int, loff_t, loff_t is a problem on
 s390, please see Heiko's mail on 16th March. Here is the link:
 http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg133595.html

 Quoting that...
   |len - r6 + second halve on stack

 Then, is not this a gcc glitch? (IMO, it should put all of len on the
 stack)

 Platform: ppc, arm
 --
 6 arguments. Thus the desired layout by ppc32 is:
   int fallocate(int fd, int mode, loff_t offset, loff_t len)

 Option of loff_t = high u32 + low u32
 --
 Matthew and Russell have suggested another option of breaking each
 loff_t into two u32s. This will result in 6 arguments in total.

 What are your thoughts on this ? What layout should we finalize on ?
 Perhaps, since sync_file_range() system call has similar arguments, we
 can take hint from the challenges faced on implementing it on various
 architectures, and decide.

 Please suggest. Thanks!

 Does it actually matter? Glibc can have its own argument ordering
 different from the syscalls, so at least it would be possible to lay out
 the syscall arguments in the most portable way while retaining nice
 userspace C code. Hey, glibc might even wrap it up in a struct! (Using a
 pointer, as suggested in one of the proposals.)

 int fallocate(int fd, loff_t offset, loff_t len, int mode)
 {
   struct fallocate_foobar d = {fd, offset, len, mode};
   return _syscall(..., d);
 }

 Jan
 --

I think it's always better to put only a pointer on the stack as
above.

Cheers,
Dick Johnson
Penguin : Linux version 2.6.16.24 on an i686 machine (5592.62 BogoMips).
New book: http://www.AbominableFirebug.com/
_



The information transmitted in this message is confidential and may be 
privileged.  Any review, retransmission, dissemination, or other use of this 
information by persons or entities other than the intended recipient is 
prohibited.  If you are not the intended recipient, please notify Analogic 
Corporation immediately - by replying to this message or by sending an email to 
[EMAIL PROTECTED] - and destroy all copies of this information, including any 
attachments, without reading or disclosing them.

Thank you.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-03-29 Thread Jan Engelhardt
 
On Mar 29 2007 13:18, linux-os (Dick Johnson) wrote:

I think it's always better to put only a pointer on the stack as
above.

I have to disagree, since wrapping it into a struct and copying the struct
in kernelspace from userspace requires more code. Pointers only become
useful at 3 (rarely) or 4 (yeah, more likely) and 5+ (definitely)
arguments, (3) see above about copying, (4) middle thing and (5) tons of
arguments like mmap() should be wrapped up... for simplicity of dealing
with it later.


Jan
-- 
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Interface for the new fallocate() system call

2007-03-29 Thread Linus Torvalds


On Thu, 29 Mar 2007, Jan Engelhardt wrote:

 I have to disagree, since wrapping it into a struct and copying the struct
 in kernelspace from userspace requires more code.

Not just more code, but more security issues too.

Passing system call arguments by value means that there are no subtle 
security issues - the value you use is the value you got. But once you 
pass-by-reference, you have to make damn sure that you do the proper user 
space accesses and verify the pointer correctly.

User-space (aka user-supplied) pointers are just more dangerous. We 
obviously can't avoid them, but they need much more care than just a 
random value directly passed in a register.

Linus
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/