linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonas Bonn <jonas@southpole.se>
To: Arnd Bergmann <arnd@arndb.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Christoph Hellwig <hch@infradead.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"H.J. Lu" <hjl.tools@gmail.com>, Ingo Molnar <mingo@elte.hu>,
	Thomas Gleixner <tglx@linutronix.de>,
	Richard Kuo <rkuo@codeaurora.org>,
	Mark Salter <msalter@redhat.com>,
	Tobias Klauser <tklauser@distanz.ch>
Subject: Re: RFD: x32 ABI system call numbers
Date: Sat, 01 Oct 2011 21:38:42 +0200	[thread overview]
Message-ID: <1317497922.23899.6.camel@satguru> (raw)
In-Reply-To: <201109011335.05663.arnd@arndb.de>

[-- Attachment #1: Type: text/plain, Size: 5174 bytes --]

On Thu, 2011-09-01 at 13:35 +0200, Arnd Bergmann wrote:
> On Wednesday 31 August 2011, H. Peter Anvin wrote:
> > On 08/31/2011 10:19 AM, Linus Torvalds wrote:
> > > 
> > > I think tv_nsec was just overlooked, and people thought "it has no
> > > legacy users that were 'int', so we'll just leave it at 'long', which
> > > is guaranteed to be enough for nanoseconds that only needs a range of
> > > 32 bits".
> > > 
> > > In contrast, tv_usec probably does have legacy users that are "int".
> > > 
> > > So POSIX almost certainly only looked backwards, and never thought
> > > about users who would need to make it "long long" for compatibility
> > > reasons.
> > > 
> > > The fact that *every*other*related*field* in POSIX/SuS has a typedef
> > > exactly for these kinds of reasons just shows how stupid that "long
> > > tv_nsec" thing is.
> > > 
> > > I suspect that on Linux we can just say "tv_nsec" is suseconds_t too.
> > > Then we can make time_t and suseconds_t just match, and be "__s64" on
> > > all new platforms.
> > > 
> > 
> > Let me see if I can raise this with the POSIX committee.
> 
> Shall we go ahead with this patch for 3.1 in the meantime? This is the
> least invasive way I can see to let OpenRISC use 64 bit time_t in the
> released kernel.

Was there any consensus reached on this matter?  A couple of days left
to try to sneak this in, if this is what everyone agrees is the right
way forward...

The patch is fine as far as OpenRISC is concerned.

/Jonas



> 
> The worst thing that can happen is that we will have to change it again
> if this patch breaks something on OpenRISC, but if we don't do it now,
> then we have one more architecture stuck with 32 bit time_t or we will
> have to break its ABI.
> 
> I'm not completely convinced about the type we should use for tv_nsec
> and tv_usec. The main worry I have is that common implementations
> of timeval_add() or similar will require an expensive 64 bit division
> on 32 bit systems, which they would not need with a 32 bit suseconds_t.
> Should we use explicit padding instead in that case?
> 
> Interestingly, I noticed that parisc always uses a 32 bit suseconds_t,
> even for its 64 bit ABI (which is not used all that much), so it has
> implicit padding.
> 
> 8<----
> OpenRISC: change time_t and suseconds_t to 64 bit
> 
> time_t should really be 64 bit wide for all new ABIs including 32 bit
> architectures, to allow having timestamps beyond 2038. For now, we
> leave the default in asm-generic/posix-types to 32 bit wide, but the
> plan is to change that in the next merge window so we reduce the
> risk of breaking other architectures in the process.
> 
> In order to allow struct timespec/timeval to be free of padding, we
> need suseconds_t to be the same size, and change the second member
> of struct timespec to also be suseconds_t instead of long.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> 
> diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild
> index 11162e6..77bcc02 100644
> --- a/arch/openrisc/include/asm/Kbuild
> +++ b/arch/openrisc/include/asm/Kbuild
> @@ -38,7 +38,6 @@ generic-y += msgbuf.h
>  generic-y += pci.h
>  generic-y += percpu.h
>  generic-y += poll.h
> -generic-y += posix_types.h
>  generic-y += resource.h
>  generic-y += rmap.h
>  generic-y += scatterlist.h
> diff --git a/arch/openrisc/include/asm/posix_types.h b/arch/openrisc/include/asm/posix_types.h
> new file mode 100644
> index 0000000..f0b2944
> --- /dev/null
> +++ b/arch/openrisc/include/asm/posix_types.h
> @@ -0,0 +1,12 @@
> +#ifndef __OPENRISC_POSIX_TIME_T
> +#define __OPENRISC_POSIX_TIME_T
> +
> +typedef long long __kernel_suseconds_t;
> +#define __kernel_suseconds_t __kernel_suseconds_t
> +
> +typedef long long __kernel_time_t;
> +#define __kernel_time_t __kernel_time_t
> +
> +#include <asm-generic/posix_types.h>
> +
> +#endif
> diff --git a/include/asm-generic/posix_types.h b/include/asm-generic/posix_types.h
> index 3dab008..0c53135 100644
> --- a/include/asm-generic/posix_types.h
> +++ b/include/asm-generic/posix_types.h
> @@ -39,6 +39,10 @@ typedef unsigned int	__kernel_gid_t;
>  typedef long		__kernel_suseconds_t;
>  #endif
>  
> +#ifndef __kernel_time_t
> +typedef long		__kernel_time_t;
> +#endif
> +
>  #ifndef __kernel_daddr_t
>  typedef int		__kernel_daddr_t;
>  #endif
> @@ -78,7 +82,6 @@ typedef long		__kernel_ptrdiff_t;
>   */
>  typedef long		__kernel_off_t;
>  typedef long long	__kernel_loff_t;
> -typedef long		__kernel_time_t;
>  typedef long		__kernel_clock_t;
>  typedef int		__kernel_timer_t;
>  typedef int		__kernel_clockid_t;
> diff --git a/include/linux/time.h b/include/linux/time.h
> index b306178..207c0aa 100644
> --- a/include/linux/time.h
> +++ b/include/linux/time.h
> @@ -12,8 +12,8 @@
>  #ifndef _STRUCT_TIMESPEC
>  #define _STRUCT_TIMESPEC
>  struct timespec {
> -	__kernel_time_t	tv_sec;			/* seconds */
> -	long		tv_nsec;		/* nanoseconds */
> +	__kernel_time_t		tv_sec;		/* seconds */
> +	__kernel_suseconds_t	tv_nsec;	/* nanoseconds */
>  };
>  #endif
>  


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2011-10-01 19:40 UTC|newest]

Thread overview: 94+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-26 23:00 RFD: x32 ABI system call numbers H. Peter Anvin
2011-08-26 23:13 ` Linus Torvalds
2011-08-26 23:39   ` H. Peter Anvin
2011-08-27  0:36     ` Linus Torvalds
2011-08-27  0:43       ` Linus Torvalds
2011-08-27  0:53         ` H. Peter Anvin
2011-08-27  1:18           ` Linus Torvalds
2011-08-27  1:35             ` H. Peter Anvin
2011-08-27  1:45               ` Linus Torvalds
2011-08-27  1:12         ` H. Peter Anvin
2011-08-27  1:42           ` Linus Torvalds
2011-08-29 19:01             ` Geert Uytterhoeven
2011-08-29 19:03               ` H. Peter Anvin
2011-08-30  1:17               ` Ted Ts'o
2011-08-30  1:48               ` Linus Torvalds
2011-08-30  2:16                 ` Kyle Moffett
2011-08-30  4:45                   ` H. Peter Anvin
2011-08-30  7:06                     ` Geert Uytterhoeven
2011-08-30 12:18                       ` Arnd Bergmann
2011-08-30  7:09                   ` Andi Kleen
2011-08-30  9:56                     ` Alan Cox
2011-08-30  7:00                 ` Geert Uytterhoeven
2011-09-20 18:37                   ` Jan Engelhardt
2011-09-06 20:40         ` Florian Weimer
2011-08-27  0:57       ` H. Peter Anvin
2011-08-27  4:40         ` Christoph Hellwig
2011-08-29 15:04           ` Arnd Bergmann
2011-08-29 18:31             ` H. Peter Anvin
2011-08-30 12:09               ` Arnd Bergmann
2011-08-30 16:35                 ` H. Peter Anvin
2011-08-31 16:14                   ` Arnd Bergmann
2011-08-31 16:25                     ` H. Peter Anvin
2011-08-31 16:39                       ` Arnd Bergmann
2011-08-31 16:48                         ` Linus Torvalds
2011-08-31 19:18                           ` Arnd Bergmann
2011-08-31 19:44                             ` H. Peter Anvin
2011-08-31 19:54                               ` Alan Cox
2011-08-31 20:02                                 ` H. Peter Anvin
2011-08-31 20:55                                   ` Arnd Bergmann
2011-08-31 20:58                                     ` H. Peter Anvin
2011-08-31 19:49                             ` Geert Uytterhoeven
2011-08-31 16:46                     ` Linus Torvalds
2011-08-31 17:05                       ` H.J. Lu
2011-09-03  2:56                         ` H.J. Lu
2011-09-03  3:04                           ` Linus Torvalds
2011-09-03  4:02                             ` H.J. Lu
2011-09-03  4:29                               ` H. Peter Anvin
2011-09-03  4:44                                 ` H.J. Lu
2011-09-03  5:16                                   ` H. Peter Anvin
2011-09-03 14:11                                     ` H.J. Lu
2011-09-03  5:29                                   ` H. Peter Anvin
2011-09-03  8:41                                     ` Arnd Bergmann
2011-09-03 14:04                                       ` Valdis.Kletnieks
2011-09-03 16:40                                         ` H. Peter Anvin
2011-09-03 17:16                                           ` Valdis.Kletnieks
2011-09-03 17:22                                             ` H.J. Lu
2011-09-03 17:28                                               ` H. Peter Anvin
2011-09-03 17:27                                             ` H. Peter Anvin
2011-09-04 13:51                                               ` Valdis.Kletnieks
2011-09-04 15:17                                               ` Arnd Bergmann
2011-09-04 17:08                                                 ` Linus Torvalds
2011-09-04 18:40                                                 ` H.J. Lu
2011-09-04 19:06                                                   ` Arnd Bergmann
2011-09-04 19:31                                                     ` H.J. Lu
2011-09-04 21:13                                                       ` Arnd Bergmann
2011-09-04 21:25                                                         ` H.J. Lu
2011-09-04 21:41                                                           ` Arnd Bergmann
2011-09-04 22:13                                                             ` H.J. Lu
2011-09-05  7:48                                                               ` Arnd Bergmann
2011-09-05 15:11                                                                 ` H.J. Lu
2011-09-05 17:21                                                                   ` Arnd Bergmann
2011-09-05 19:34                                                                     ` H.J. Lu
2011-09-05 19:54                                                                       ` H.J. Lu
2011-09-05 19:59                                                                         ` H. Peter Anvin
2011-09-05 20:27                                                                           ` Arnd Bergmann
2011-09-09 21:02                                                                   ` H.J. Lu
2011-09-04 20:11                                                     ` H. Peter Anvin
2011-09-04 19:31                                                   ` richard -rw- weinberger
2011-09-04 19:32                                                     ` H.J. Lu
2011-09-03 14:15                                     ` H.J. Lu
2011-08-31 17:09                       ` H. Peter Anvin
2011-08-31 17:19                         ` Linus Torvalds
2011-08-31 17:38                           ` H. Peter Anvin
2011-09-01 11:35                             ` Arnd Bergmann
2011-10-01 19:38                               ` Jonas Bonn [this message]
2012-02-08 21:36                           ` 64-bit time on 32-bit systems H. Peter Anvin
2011-09-01 13:30                         ` RFD: x32 ABI system call numbers Avi Kivity
2011-09-01 14:13                           ` H. Peter Anvin
2011-09-02  0:49                             ` Pedro Alves
2011-09-02  1:51                               ` H. Peter Anvin
2011-09-02  8:02                                 ` Arnd Bergmann
2011-09-02  8:42                                 ` Pedro Alves
2011-09-01  6:08                     ` Jonas Bonn
2011-09-02  6:17     ` Andy Lutomirski

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=1317497922.23899.6.camel@satguru \
    --to=jonas@southpole.se \
    --cc=arnd@arndb.de \
    --cc=hch@infradead.org \
    --cc=hjl.tools@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=msalter@redhat.com \
    --cc=rkuo@codeaurora.org \
    --cc=tglx@linutronix.de \
    --cc=tklauser@distanz.ch \
    --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;
as well as URLs for NNTP newsgroup(s).