public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Ulrich Drepper <drepper@redhat.com>
Cc: munroesj@us.ibm.com, "H. Peter Anvin" <hpa@zytor.com>,
	David Miller <davem@davemloft.net>,
	ralf@linux-mips.org, linux-arch@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel@teksavvy.com,
	torvalds@linux-foundation.org
Subject: Re: 64-syscall args on 32-bit vs syscall()
Date: Wed, 17 Mar 2010 19:56:19 +1100	[thread overview]
Message-ID: <1268816179.2335.187.camel@pasglop> (raw)
In-Reply-To: <4BA06E1B.2040706@redhat.com>

On Tue, 2010-03-16 at 22:52 -0700, Ulrich Drepper wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 03/16/2010 05:31 PM, Benjamin Herrenschmidt wrote:
> > My proposal is purely a change to the syscall()
> > function, nothing else. No kernel change, no ABI change, no change to
> > the way glibc normally calls syscalls internally, etc...
> 
> How can this be?  People are today actively working around the problem
> of 64-bit arguments.  You have to break something since you cannot
> recognize these situations.

Ok, so I -may- be missing something, but I believe this won't break
anything:

 - You keep the existing syscall() exported by glibc for binary
compatibility

 - You add a new __syscall() (or whatever you want to name it) that adds
a dummy argument at the beginning, and whose implementation shifts
everything by 2 instead of 1 argument before calling into the kernel

 - You define in unistd.h or whatever is relevant, a macro that does:

#define syscall(__sysno, __args..) __syscall(0, _sysno, __args)

I believe that should cover it, at least for powerpc, possibly for other
archs too though as I said, I may have missed something there.

IE. Whether your app writes:

	syscall(SYS_foo, my_64bit_arg);

Or

	syscall(SYS_foo, (u32)(my_64bit_arg >> 32), (u32)(my_64bit_arg));

Both should still work with the new approach and end up doing the right
thing.

Hence, apps that use the first form today because it works on x86 would
end up working at least on powerpc where they would have been otherwise
broken unless they used some arch specific #ifdef to do the second form.
 
>   And since it became meanwhile clear that
> there is no way to "fix" all archs magically I really don't want to
> introduce anything.  There are mechanisms in place to abstract out some
> of the issues.  And for the rest, well, if you're using syscalls
> directly you already have to encoded lowlevel knowledge.  One more bit
> doesn't hurt.  It's not as if this happens every day.

It doesn't happen everyday. However, if my proposal ends up fixing a
bunch of cases where it does without breaking anything, then I suppose
it's worth considering, though as I said, it's possible that I miss some
subtlety here in which case I'd be glad to stand corrected :-)

Cheers,
Ben.
  
> - -- 
> ➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
> Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
> 
> iEYEARECAAYFAkugbhsACgkQ2ijCOnn/RHQzlACeMp0UK2jZuZOgXhJjB8Z9p4kh
> rCoAn0zaJqFYV9tQ0Ct49Mprfa0O5iKh
> =71la
> -----END PGP SIGNATURE-----



  reply	other threads:[~2010-03-17  8:57 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-15  4:48 64-syscall args on 32-bit vs syscall() Benjamin Herrenschmidt
2010-03-15  5:06 ` David Miller
2010-03-15  5:18   ` Benjamin Herrenschmidt
2010-03-15  5:54     ` David Miller
2010-03-15 20:22       ` Benjamin Herrenschmidt
2010-03-15 13:44     ` Ralf Baechle
2010-03-15 15:13       ` H. Peter Anvin
2010-03-15 16:00         ` Ulrich Drepper
2010-03-15 19:00           ` David Miller
2010-03-15 19:41             ` H. Peter Anvin
2010-03-15 20:35               ` Benjamin Herrenschmidt
2010-03-15 20:41                 ` H. Peter Anvin
2010-03-16 21:56                 ` Steven Munroe
2010-03-17  0:31                   ` Benjamin Herrenschmidt
2010-03-17  5:52                     ` Ulrich Drepper
2010-03-17  8:56                       ` Benjamin Herrenschmidt [this message]
2010-03-17  9:14                         ` Ulrich Drepper
2010-03-17 10:13                           ` Benjamin Herrenschmidt
2010-03-17  9:18                         ` Jamie Lokier
2010-03-17 10:18                           ` Benjamin Herrenschmidt
2010-03-17 18:30                         ` H. Peter Anvin
2010-03-17 20:35                           ` Benjamin Herrenschmidt
2010-03-17 20:53                             ` H. Peter Anvin
2010-03-17 22:58                               ` Benjamin Herrenschmidt
2010-03-18 16:08                                 ` Steven Munroe
2010-03-18 16:21                                   ` Andreas Schwab
2010-03-18 17:03                                     ` Steven Munroe
2010-03-18 21:18                                       ` Benjamin Herrenschmidt
2010-03-19  1:22                                         ` Jamie Lokier
2010-03-15 20:27       ` Benjamin Herrenschmidt
2010-03-15 15:03 ` Steven Munroe
2010-03-15 20:32   ` Benjamin Herrenschmidt
2010-03-15 15:04 ` Jamie Lokier
2010-03-15 20:33   ` Benjamin Herrenschmidt

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=1268816179.2335.187.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=davem@davemloft.net \
    --cc=drepper@redhat.com \
    --cc=hpa@zytor.com \
    --cc=kernel@teksavvy.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=munroesj@us.ibm.com \
    --cc=ralf@linux-mips.org \
    --cc=torvalds@linux-foundation.org \
    /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