All of lore.kernel.org
 help / color / mirror / Atom feed
From: Deepa Dinamani <deepa.kernel@gmail.com>
To: willemdebruijn.kernel@gmail.com
Cc: "open list:RALINK MIPS ARCHITECTURE" <linux-mips@linux-mips.org>,
	Parisc List <linux-parisc@vger.kernel.org>,
	Arnd Bergmann <arnd@arndb.de>,
	y2038 Mailman List <y2038@lists.linaro.org>,
	Linux Network Devel Mailing List <netdev@vger.kernel.org>,
	"James E.J. Bottomley" <jejb@parisc-linux.org>,
	Ralf Baechle <ralf@linux-mips.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-rdma@vger.kernel.org, linux-alpha@vger.kernel.org,
	sparclinux <sparclinux@vger.kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	rth@twiddle.net
Subject: Re: [PATCH v2 6/8] socket: Add SO_TIMESTAMP[NS]_NEW
Date: Sat, 15 Dec 2018 08:50:58 -0800	[thread overview]
Message-ID: <CABeXuvqrZgEDF5RYQEPJ8RyXDg0uvXx_qMq=2ER8Bc9RXFPDGQ@mail.gmail.com> (raw)
In-Reply-To: <CAF=yD-L4xTU-KXsQ=uU36fEKv5St=69mmKqT8sD1mAmT_hfuVQ@mail.gmail.com>

On Sat, Dec 15, 2018 at 7:12 AM Willem de Bruijn
<willemdebruijn.kernel@gmail.com> wrote:
>
> On Fri, Dec 14, 2018 at 8:07 PM Deepa Dinamani <deepa.kernel@gmail.com> wrote:
> >
> > > > diff --git a/arch/alpha/include/uapi/asm/socket.h b/arch/alpha/include/uapi/asm/socket.h
> > > > index 00e45c80e574..352e3dc0b3d9 100644
> > > > --- a/arch/alpha/include/uapi/asm/socket.h
> > > > +++ b/arch/alpha/include/uapi/asm/socket.h
> > > > @@ -3,6 +3,7 @@
> > > >  #define _UAPI_ASM_SOCKET_H
> > > >
> > > >  #include <asm/sockios.h>
> > > > +#include <asm/bitsperlong.h>
> > > >
> > > >  /* For setsockopt(2) */
> > > >  /*
> > > > @@ -110,12 +111,22 @@
> > > >
> > > >  #define SO_TIMESTAMP_OLD         29
> > > >  #define SO_TIMESTAMPNS_OLD       35
> > > > +
> > > >  #define SO_TIMESTAMPING_OLD      37
> > > >
> > > > +#define SO_TIMESTAMP_NEW         62
> > > > +#define SO_TIMESTAMPNS_NEW       63
> > > > +
> > > >  #if !defined(__KERNEL__)
> > > >
> > > > -#define SO_TIMESTAMP           SO_TIMESTAMP_OLD
> > > > -#define SO_TIMESTAMPNS         SO_TIMESTAMPNS_OLD
> > > > +#if __BITS_PER_LONG == 64
> > > > +#define SO_TIMESTAMP           SO_TIMESTAMP_OLD
> > > > +#define SO_TIMESTAMPNS         SO_TIMESTAMPNS_OLD
> > > > +#else
> > > > +#define SO_TIMESTAMP (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_TIMESTAMP_OLD : SO_TIMESTAMP_NEW)
> > > > +#define SO_TIMESTAMPNS (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_TIMESTAMPNS_OLD : SO_TIMESTAMPNS_NEW)
> > > > +#endif
> > > > +
> > >
> > > This is not platform specific. Perhaps it can be deduplicated. The
> > > interface expects callers to include <linux/socket.h>, not
> > > <asm/socket.h> directly. So perhaps it can go there?
> >
> > I'm not following what you are saying here.
> >
> > Are you talking about in kernel users or userspace interface?
> >
> > Userspace should always include sys/socket.h according to the man page.
> > I'm not sure if userspace can even include linux/socket.h directly.
> > On my distribution this includes bits/socket.h which in turn includes
> > asm/socket.h.
>
> I meant include/uapi/linux/socket.h.
>
> But you're right that that is not referenced from sys/socket.h.
>
> I do see a reference to it in my bits/socket.h
>
>     /* Socket level message types.  This must match the definitions in
>        <linux/socket.h>.  */
>
> so perhaps the logic could be both there and in libc bits/socket.h.

bits/socket.h cannot be included directly, and it's just how one of
the libc implementations decided to do it.
It doesn't even have to exist.

> > Which file gets installed as asm/socket.h is defined per architecture
> > in the kbuild file such as
> > arch/ia64/include/uapi/asm/Kbuild (without series applied):
> >
> >  generic-y += poll.h
> >  generic-y += sembuf.h
> >  generic-y += shmbuf.h
> >  generic-y += socket.h
> >
> > Also the new timestamp numbers being added are not the same for all
> > architectures.
> >
> > So I'm not sure how this can be moved to linux/socket.h.
>
> Does that matter, as long as they are defined? This basic block is the
> same between all archs:

3 reasons for not doing this:

1. We do not want to break userspace. If we move this to
linux/socket.h all the userspace programs now have to include
linux/socket.h or get this definition through a new libc.
2. All the socket options are together in the file asm/socket.h. It
doesn't seem good for maintainability to move just a few bits
elsewhere.
3. There are only 4 arches (after the series is applied) that have
their own asm/socket.h. And, this is because there seems to be
significant differences to asm-generic/socket.h that don't seem
logically obvious to group and eliminate some of the defines.

Also for the other comment. The reason the conditionals were not
consistent is because they were not consistent to begin with.
I'm trying to follow your request to keep code churn to minimal.
It's just that I moved to a different function as that seemed logical
to me. Do you prefer me to remove that refactoring?

-Deepa
_______________________________________________
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038

WARNING: multiple messages have this Message-ID (diff)
From: Deepa Dinamani <deepa.kernel@gmail.com>
To: willemdebruijn.kernel@gmail.com
Cc: "David S. Miller" <davem@davemloft.net>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Network Devel Mailing List <netdev@vger.kernel.org>,
	Arnd Bergmann <arnd@arndb.de>,
	y2038 Mailman List <y2038@lists.linaro.org>,
	"James E.J. Bottomley" <jejb@parisc-linux.org>,
	Ralf Baechle <ralf@linux-mips.org>,
	rth@twiddle.net, linux-alpha@vger.kernel.org,
	"open list:RALINK MIPS ARCHITECTURE" <linux-mips@linux-mips.org>,
	Parisc List <linux-parisc@vger.kernel.org>,
	linux-rdma@vger.kernel.org,
	sparclinux <sparclinux@vger.kernel.org>
Subject: Re: [PATCH v2 6/8] socket: Add SO_TIMESTAMP[NS]_NEW
Date: Sat, 15 Dec 2018 08:50:58 -0800	[thread overview]
Message-ID: <CABeXuvqrZgEDF5RYQEPJ8RyXDg0uvXx_qMq=2ER8Bc9RXFPDGQ@mail.gmail.com> (raw)
In-Reply-To: <CAF=yD-L4xTU-KXsQ=uU36fEKv5St=69mmKqT8sD1mAmT_hfuVQ@mail.gmail.com>

On Sat, Dec 15, 2018 at 7:12 AM Willem de Bruijn
<willemdebruijn.kernel@gmail.com> wrote:
>
> On Fri, Dec 14, 2018 at 8:07 PM Deepa Dinamani <deepa.kernel@gmail.com> wrote:
> >
> > > > diff --git a/arch/alpha/include/uapi/asm/socket.h b/arch/alpha/include/uapi/asm/socket.h
> > > > index 00e45c80e574..352e3dc0b3d9 100644
> > > > --- a/arch/alpha/include/uapi/asm/socket.h
> > > > +++ b/arch/alpha/include/uapi/asm/socket.h
> > > > @@ -3,6 +3,7 @@
> > > >  #define _UAPI_ASM_SOCKET_H
> > > >
> > > >  #include <asm/sockios.h>
> > > > +#include <asm/bitsperlong.h>
> > > >
> > > >  /* For setsockopt(2) */
> > > >  /*
> > > > @@ -110,12 +111,22 @@
> > > >
> > > >  #define SO_TIMESTAMP_OLD         29
> > > >  #define SO_TIMESTAMPNS_OLD       35
> > > > +
> > > >  #define SO_TIMESTAMPING_OLD      37
> > > >
> > > > +#define SO_TIMESTAMP_NEW         62
> > > > +#define SO_TIMESTAMPNS_NEW       63
> > > > +
> > > >  #if !defined(__KERNEL__)
> > > >
> > > > -#define SO_TIMESTAMP           SO_TIMESTAMP_OLD
> > > > -#define SO_TIMESTAMPNS         SO_TIMESTAMPNS_OLD
> > > > +#if __BITS_PER_LONG == 64
> > > > +#define SO_TIMESTAMP           SO_TIMESTAMP_OLD
> > > > +#define SO_TIMESTAMPNS         SO_TIMESTAMPNS_OLD
> > > > +#else
> > > > +#define SO_TIMESTAMP (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_TIMESTAMP_OLD : SO_TIMESTAMP_NEW)
> > > > +#define SO_TIMESTAMPNS (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_TIMESTAMPNS_OLD : SO_TIMESTAMPNS_NEW)
> > > > +#endif
> > > > +
> > >
> > > This is not platform specific. Perhaps it can be deduplicated. The
> > > interface expects callers to include <linux/socket.h>, not
> > > <asm/socket.h> directly. So perhaps it can go there?
> >
> > I'm not following what you are saying here.
> >
> > Are you talking about in kernel users or userspace interface?
> >
> > Userspace should always include sys/socket.h according to the man page.
> > I'm not sure if userspace can even include linux/socket.h directly.
> > On my distribution this includes bits/socket.h which in turn includes
> > asm/socket.h.
>
> I meant include/uapi/linux/socket.h.
>
> But you're right that that is not referenced from sys/socket.h.
>
> I do see a reference to it in my bits/socket.h
>
>     /* Socket level message types.  This must match the definitions in
>        <linux/socket.h>.  */
>
> so perhaps the logic could be both there and in libc bits/socket.h.

bits/socket.h cannot be included directly, and it's just how one of
the libc implementations decided to do it.
It doesn't even have to exist.

> > Which file gets installed as asm/socket.h is defined per architecture
> > in the kbuild file such as
> > arch/ia64/include/uapi/asm/Kbuild (without series applied):
> >
> >  generic-y += poll.h
> >  generic-y += sembuf.h
> >  generic-y += shmbuf.h
> >  generic-y += socket.h
> >
> > Also the new timestamp numbers being added are not the same for all
> > architectures.
> >
> > So I'm not sure how this can be moved to linux/socket.h.
>
> Does that matter, as long as they are defined? This basic block is the
> same between all archs:

3 reasons for not doing this:

1. We do not want to break userspace. If we move this to
linux/socket.h all the userspace programs now have to include
linux/socket.h or get this definition through a new libc.
2. All the socket options are together in the file asm/socket.h. It
doesn't seem good for maintainability to move just a few bits
elsewhere.
3. There are only 4 arches (after the series is applied) that have
their own asm/socket.h. And, this is because there seems to be
significant differences to asm-generic/socket.h that don't seem
logically obvious to group and eliminate some of the defines.

Also for the other comment. The reason the conditionals were not
consistent is because they were not consistent to begin with.
I'm trying to follow your request to keep code churn to minimal.
It's just that I moved to a different function as that seemed logical
to me. Do you prefer me to remove that refactoring?

-Deepa

WARNING: multiple messages have this Message-ID (diff)
From: Deepa Dinamani <deepa.kernel@gmail.com>
To: willemdebruijn.kernel@gmail.com
Cc: "David S. Miller" <davem@davemloft.net>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Network Devel Mailing List <netdev@vger.kernel.org>,
	Arnd Bergmann <arnd@arndb.de>,
	y2038 Mailman List <y2038@lists.linaro.org>,
	"James E.J. Bottomley" <jejb@parisc-linux.org>,
	Ralf Baechle <ralf@linux-mips.org>,
	rth@twiddle.net, linux-alpha@vger.kernel.org,
	"open list:RALINK MIPS ARCHITECTURE" <linux-mips@linux-mips.org>,
	Parisc List <linux-parisc@vger.kernel.org>,
	linux-rdma@vger.kernel.org,
	sparclinux <sparclinux@vger.kernel.org>
Subject: Re: [PATCH v2 6/8] socket: Add SO_TIMESTAMP[NS]_NEW
Date: Sat, 15 Dec 2018 16:50:58 +0000	[thread overview]
Message-ID: <CABeXuvqrZgEDF5RYQEPJ8RyXDg0uvXx_qMq=2ER8Bc9RXFPDGQ@mail.gmail.com> (raw)
In-Reply-To: <CAF=yD-L4xTU-KXsQ=uU36fEKv5St=69mmKqT8sD1mAmT_hfuVQ@mail.gmail.com>

On Sat, Dec 15, 2018 at 7:12 AM Willem de Bruijn
<willemdebruijn.kernel@gmail.com> wrote:
>
> On Fri, Dec 14, 2018 at 8:07 PM Deepa Dinamani <deepa.kernel@gmail.com> wrote:
> >
> > > > diff --git a/arch/alpha/include/uapi/asm/socket.h b/arch/alpha/include/uapi/asm/socket.h
> > > > index 00e45c80e574..352e3dc0b3d9 100644
> > > > --- a/arch/alpha/include/uapi/asm/socket.h
> > > > +++ b/arch/alpha/include/uapi/asm/socket.h
> > > > @@ -3,6 +3,7 @@
> > > >  #define _UAPI_ASM_SOCKET_H
> > > >
> > > >  #include <asm/sockios.h>
> > > > +#include <asm/bitsperlong.h>
> > > >
> > > >  /* For setsockopt(2) */
> > > >  /*
> > > > @@ -110,12 +111,22 @@
> > > >
> > > >  #define SO_TIMESTAMP_OLD         29
> > > >  #define SO_TIMESTAMPNS_OLD       35
> > > > +
> > > >  #define SO_TIMESTAMPING_OLD      37
> > > >
> > > > +#define SO_TIMESTAMP_NEW         62
> > > > +#define SO_TIMESTAMPNS_NEW       63
> > > > +
> > > >  #if !defined(__KERNEL__)
> > > >
> > > > -#define SO_TIMESTAMP           SO_TIMESTAMP_OLD
> > > > -#define SO_TIMESTAMPNS         SO_TIMESTAMPNS_OLD
> > > > +#if __BITS_PER_LONG = 64
> > > > +#define SO_TIMESTAMP           SO_TIMESTAMP_OLD
> > > > +#define SO_TIMESTAMPNS         SO_TIMESTAMPNS_OLD
> > > > +#else
> > > > +#define SO_TIMESTAMP (sizeof(time_t) = sizeof(__kernel_long_t) ? SO_TIMESTAMP_OLD : SO_TIMESTAMP_NEW)
> > > > +#define SO_TIMESTAMPNS (sizeof(time_t) = sizeof(__kernel_long_t) ? SO_TIMESTAMPNS_OLD : SO_TIMESTAMPNS_NEW)
> > > > +#endif
> > > > +
> > >
> > > This is not platform specific. Perhaps it can be deduplicated. The
> > > interface expects callers to include <linux/socket.h>, not
> > > <asm/socket.h> directly. So perhaps it can go there?
> >
> > I'm not following what you are saying here.
> >
> > Are you talking about in kernel users or userspace interface?
> >
> > Userspace should always include sys/socket.h according to the man page.
> > I'm not sure if userspace can even include linux/socket.h directly.
> > On my distribution this includes bits/socket.h which in turn includes
> > asm/socket.h.
>
> I meant include/uapi/linux/socket.h.
>
> But you're right that that is not referenced from sys/socket.h.
>
> I do see a reference to it in my bits/socket.h
>
>     /* Socket level message types.  This must match the definitions in
>        <linux/socket.h>.  */
>
> so perhaps the logic could be both there and in libc bits/socket.h.

bits/socket.h cannot be included directly, and it's just how one of
the libc implementations decided to do it.
It doesn't even have to exist.

> > Which file gets installed as asm/socket.h is defined per architecture
> > in the kbuild file such as
> > arch/ia64/include/uapi/asm/Kbuild (without series applied):
> >
> >  generic-y += poll.h
> >  generic-y += sembuf.h
> >  generic-y += shmbuf.h
> >  generic-y += socket.h
> >
> > Also the new timestamp numbers being added are not the same for all
> > architectures.
> >
> > So I'm not sure how this can be moved to linux/socket.h.
>
> Does that matter, as long as they are defined? This basic block is the
> same between all archs:

3 reasons for not doing this:

1. We do not want to break userspace. If we move this to
linux/socket.h all the userspace programs now have to include
linux/socket.h or get this definition through a new libc.
2. All the socket options are together in the file asm/socket.h. It
doesn't seem good for maintainability to move just a few bits
elsewhere.
3. There are only 4 arches (after the series is applied) that have
their own asm/socket.h. And, this is because there seems to be
significant differences to asm-generic/socket.h that don't seem
logically obvious to group and eliminate some of the defines.

Also for the other comment. The reason the conditionals were not
consistent is because they were not consistent to begin with.
I'm trying to follow your request to keep code churn to minimal.
It's just that I moved to a different function as that seemed logical
to me. Do you prefer me to remove that refactoring?

-Deepa

  reply	other threads:[~2018-12-15 16:50 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-11 20:25 [PATCH v2 0/8] net: y2038-safe socket timestamps Deepa Dinamani
2018-12-11 20:25 ` Deepa Dinamani
2018-12-11 20:25 ` [PATCH v2 1/8] arch: Use asm-generic/socket.h when possible Deepa Dinamani
2018-12-11 20:25   ` Deepa Dinamani
2018-12-11 20:25 ` [PATCH v2 2/8] sockopt: Rename SO_TIMESTAMP* to SO_TIMESTAMP*_OLD Deepa Dinamani
2018-12-11 20:25   ` Deepa Dinamani
2018-12-11 20:25 ` [PATCH v2 3/8] arch: sparc: Override struct __kernel_old_timeval Deepa Dinamani
2018-12-11 20:25   ` Deepa Dinamani
2018-12-11 20:25 ` [PATCH v2 4/8] socket: Use old_timeval types for socket timestamps Deepa Dinamani
2018-12-11 20:25 ` [PATCH v2 5/8] socket: Add struct __kernel_sock_timeval Deepa Dinamani
2018-12-11 20:25 ` [PATCH v2 6/8] socket: Add SO_TIMESTAMP[NS]_NEW Deepa Dinamani
2018-12-11 20:25   ` Deepa Dinamani
2018-12-12 15:22   ` Willem de Bruijn
2018-12-12 15:22     ` Willem de Bruijn
2018-12-12 15:35     ` Willem de Bruijn
2018-12-12 15:35       ` Willem de Bruijn
2018-12-15  1:07     ` Deepa Dinamani
2018-12-15  1:07       ` Deepa Dinamani
2018-12-15 15:11       ` Willem de Bruijn
2018-12-15 15:11         ` Willem de Bruijn
2018-12-15 16:50         ` Deepa Dinamani [this message]
2018-12-15 16:50           ` Deepa Dinamani
2018-12-15 16:50           ` Deepa Dinamani
2018-12-15 18:51           ` Willem de Bruijn
2018-12-15 18:51             ` Willem de Bruijn
2018-12-15 20:56             ` Deepa Dinamani
2018-12-15 20:56               ` Deepa Dinamani
2018-12-18 16:33             ` Arnd Bergmann
2018-12-18 16:33               ` Arnd Bergmann
2018-12-18 21:27               ` Deepa Dinamani
2018-12-18 21:27                 ` Deepa Dinamani
2018-12-11 20:25 ` [PATCH v2 7/8] socket: Add SO_TIMESTAMPING_NEW Deepa Dinamani
2018-12-11 20:25   ` Deepa Dinamani
2018-12-12 15:25   ` Willem de Bruijn
2018-12-12 15:25     ` Willem de Bruijn
2018-12-18 16:16     ` Arnd Bergmann
2018-12-18 16:16       ` Arnd Bergmann
2018-12-18 21:22       ` Deepa Dinamani
2018-12-18 21:22         ` Deepa Dinamani
2018-12-11 20:25 ` [PATCH v2 8/8] socket: Update timestamping Documentation Deepa Dinamani
2018-12-12 15:07   ` Willem de Bruijn
2018-12-14 23:24 ` [PATCH v2 0/8] net: y2038-safe socket timestamps David Miller
2018-12-14 23:24   ` David Miller
2018-12-14 23:24   ` David Miller

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='CABeXuvqrZgEDF5RYQEPJ8RyXDg0uvXx_qMq=2ER8Bc9RXFPDGQ@mail.gmail.com' \
    --to=deepa.kernel@gmail.com \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=jejb@parisc-linux.org \
    --cc=linux-alpha@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=ralf@linux-mips.org \
    --cc=rth@twiddle.net \
    --cc=sparclinux@vger.kernel.org \
    --cc=willemdebruijn.kernel@gmail.com \
    --cc=y2038@lists.linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.