linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	arnd@arndb.de, "H. Peter Anvin" <hpa@zytor.com>,
	linux-api@vger.kernel.org, linux-arch@vger.kernel.org,
	Ingo Molnar <mingo@elte.hu>,
	ralf@linux-mips.org, tglx@linutronix.de,
	Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: [patch 143/166] preadv/pwritev: Add preadv and pwritev system calls.
Date: Fri, 03 Apr 2009 10:35:36 +0200	[thread overview]
Message-ID: <49D5CA58.20908@redhat.com> (raw)
In-Reply-To: <alpine.LFD.2.00.0904021839390.15441@localhost.localdomain>

Linus Torvalds wrote:
> 
> On Thu, 2 Apr 2009, akpm@linux-foundation.org wrote:
>> glibc entriely and use a syscall prototype which works without
>> arch-specific wrappers inside the kernel: The offset argument is
>> explicitly split into two 32bit values.
> 
> Grr. That may make sense on 32-bit architectures, but makes no sense 
> what-so-ever on 64-bit ones.
> 
> Why not just say that it's two "unsigned long" arguments, and split it by 
> "sizeof unsigned long". And then, on 64-bit architectures, the high bits 
> can be ignored. You can even get gcc to optimize it all away by doing 
> something like
> 
> 	#define HALF_LONG (BITS_IN_LONG / 2)
> 
> 	offset = (((loff_t)high << HALF_LONG) << HALF_LONG) | low;
> 
> and then gcc should automaticaly notice that shifting up that way is just 
> a fancy way of saying "0", and ignore the high bits.
> 
> How married are people to this crazy 2x "32 bits" model?

The tricky corner case are 32bit compat syscalls on 64bit kernel, where
a noticable number of archs (IIRC at least ppc, mips and s390) can't
pass unaligned 64bit values through the syscall abi.  The 32/32 split
was done because of that.

I think using two unsigned longs instead of two u32 should work.  And
allows us to handle 128bit file offsets on 64bit.  That I'll call
future-proof interface!  Nevertheless I'd like to have comments from the
arch maintainers on the idea.

cheers,
  Gerd

  reply	other threads:[~2009-04-03  8:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-02 23:59 [patch 143/166] preadv/pwritev: Add preadv and pwritev system calls akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b
     [not found] ` <200904022359.n32NxNYu022834-AB4EexQrvXRQetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>
2009-04-03  1:43   ` Linus Torvalds
2009-04-03  8:35     ` Gerd Hoffmann [this message]
2009-04-03  9:25       ` Gerd Hoffmann
     [not found]         ` <49D5D609.7030400-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-04-03 11:53           ` Gerd Hoffmann
2009-04-03 15:03       ` Linus Torvalds
2009-04-03 19:57         ` Gerd Hoffmann
     [not found]           ` <49D66A22.7090909-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-04-03 20:08             ` Linus Torvalds
2009-04-04 17:38         ` Andrew Morton
2009-04-04 17:51           ` Linus Torvalds
     [not found]     ` <alpine.LFD.2.00.0904021839390.15441-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2009-04-03 16:57       ` H. Peter Anvin

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=49D5CA58.20908@redhat.com \
    --to=kraxel@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=hpa@zytor.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=ralf@linux-mips.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    /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 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).