Re: [PATCH net-next 3/3] net: core: Namespace-ify sysctl_rmem_max and sysctl_wmem_max

2021-01-20 Thread Nicolas Dichtel
Le 20/01/2021 à 14:28, Menglong Dong a écrit :
[snip]
>>> For that reason, make sysctl_wmem_max and sysctl_rmem_max
>>> per-namespace.
>>
>> I think having those values be restricted by init netns is a desirable
>> property.
> 
> I just thought that having these values per-namespace can be more flexible,
> and users can have more choices. Is there any bad influence that I didn't
> realize?
You can have a look here:
https://lore.kernel.org/netdev/1501495652.1876.17.ca...@edumazet-glaptop3.roam.corp.google.com/
https://patchwork.ozlabs.org/project/netdev/patch/20170726170333.24580-1-mcr...@redhat.com/


Regards,
Nicolas


Re: linux-next: Tree for Sep 17 (net/ipv4/devinet.c)

2020-09-18 Thread Nicolas Dichtel
Le 17/09/2020 à 22:45, Randy Dunlap a écrit :
> On 9/17/20 3:23 AM, Stephen Rothwell wrote:
>> Hi all,
>>
>> Changes since 20200916:
>>
> 
> 
> Maybe some older versions of gcc just can't handle IS_ENABLED() inside an
> if (expression) very well.
> 
>> gcc --version
> gcc (SUSE Linux) 7.5.0
I tried with a (very old) gcc and I did not reproduce this error:
$ gcc --version
gcc (Debian 4.9.2-10+deb8u2) 4.9.2


> 
> This patch:
> 
> commit 9efd6a3cecdde984d67e63d17fe6af53c7c50968
> Author: Nicolas Dichtel 
> Date:   Wed May 13 15:58:43 2020 +0200
> 
> netns: enable to inherit devconf from current netns
> 
> causes a build error:
> 
> ../net/ipv4/devinet.c: In function ‘devinet_init_net’:
> ../net/ipv4/devinet.c:2672:7: error: ‘sysctl_devconf_inherit_init_net’ 
> undeclared (first use in this function); did you mean ‘devinet_init_net’?
>sysctl_devconf_inherit_init_net == 3) {
>^~~
>devinet_init_net
> ../net/ipv4/devinet.c:2672:7: note: each undeclared identifier is reported 
> only
> 
> 


Re: [PATCH] Remove ipvs v6 dependency on iptables

2020-08-28 Thread Nicolas Dichtel
Le 28/08/2020 à 00:07, Lach a écrit :
> This dependency was added in 63dca2c0b0e7a92cb39d1b1ecefa32ffda201975, 
> because this commit had dependency on
> ipv6_find_hdr, which was located in iptables-specific code
> 
> But it is no longer required, because 
> f8f626754ebeca613cf1af2e6f890cfde0e74d5b moved them to a more common location
> ---
Your 'Signed-off-by' is missing, the commit log lines are too long, a commit
should not be referenced like this.
Please run checkpatch on your submissions.


Regards,
Nicolas


Re: [PATCH] net: sysctl: cleanup net_sysctl_init error exit paths

2019-09-18 Thread Nicolas Dichtel
Le 17/09/2019 à 17:53, George G. Davis a écrit :
[snip]
> Ping, "Linux 5.3" kernel has been released [1] and it appears that the
> 5.4 merge window is open. The patch [2] remains unchanged since my initial
> post. Please consider applying it.

net-next is closed:
http://vger.kernel.org/~davem/net-next.html

You will have to resend the patch when net-next opens.


Re: [PATCH 2/2] net: ipv6: Fix a possible null-pointer dereference in vti6_link_config()

2019-07-26 Thread Nicolas Dichtel
Le 26/07/2019 à 10:03, Jia-Ju Bai a écrit :
> In vti6_link_config(), there is an if statement on line 649 to check
> whether rt is NULL:
> if (rt)
> 
> When rt is NULL, it is used on line 651:
> ip6_rt_put(rt);
> dst_release(>dst);
> 
> Thus, a possible null-pointer dereference may occur.
> 
> To fix this bug, ip6_rt_put() is called when rt is not NULL.
> 
> This bug is found by a static analysis tool STCheck written by us.
> 
> Signed-off-by: Jia-Ju Bai 
> ---
>  net/ipv6/ip6_vti.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c
> index 024db17386d2..572647205c52 100644
> --- a/net/ipv6/ip6_vti.c
> +++ b/net/ipv6/ip6_vti.c
> @@ -646,9 +646,10 @@ static void vti6_link_config(struct ip6_tnl *t, bool 
> keep_mtu)
>>raddr, >laddr,
>p->link, NULL, strict);
>  
> - if (rt)
> + if (rt) {
>   tdev = rt->dst.dev;
> - ip6_rt_put(rt);
> + ip6_rt_put(rt);
> + }
Please, look at ip6_rt_put(), it is explicitly stated that it can be called with
rt == NULL.


Re: [PATCH 1/2] net: ipv4: Fix a possible null-pointer dereference in inet_csk_rebuild_route()

2019-07-26 Thread Nicolas Dichtel
Le 26/07/2019 à 04:25, Jia-Ju Bai a écrit :
> In inet_csk_rebuild_route(), rt is assigned to NULL on line 1071.
> On line 1076, rt is used:
> return >dst;
> Thus, a possible null-pointer dereference may occur.>
> To fix this bug, rt is checked before being used.
> 
> This bug is found by a static analysis tool STCheck written by us.
> 
> Signed-off-by: Jia-Ju Bai 
> ---
>  net/ipv4/inet_connection_sock.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
> index f5c163d4771b..27d9d80f3401 100644
> --- a/net/ipv4/inet_connection_sock.c
> +++ b/net/ipv4/inet_connection_sock.c
> @@ -1073,7 +1073,10 @@ static struct dst_entry *inet_csk_rebuild_route(struct 
> sock *sk, struct flowi *f
>   sk_setup_caps(sk, >dst);
>   rcu_read_unlock();
>  
> - return >dst;
> + if (rt)
> + return >dst;
> + else
> + return NULL;
Hmm, ->dst is the first field (and that will never change), thus >dst is
NULL if rt is NULL.
I don't think there is a problem with the current code.


Regards,
Nicolas


Re: [PATCH linux] objtool: fix pkg-config query in case of cross-compilation

2019-04-11 Thread Nicolas Dichtel
Le 11/04/2019 à 10:52, Rolf Eike Beer a écrit :
> Am Donnerstag, 11. April 2019, 10:39:40 CEST schrieb Nicolas Dichtel:
>> In case of cross-compilation, there may be two pkg-config tools, one for
>> the host and one for the target. Enable to override the default name.
>>
>> Fixes: 056d28d135bc ("objtool: Query pkg-config for libelf location")
>> Signed-off-by: Nicolas Dichtel 
> 
> If you do that, you have to fix a lot of other places, too. This starts in 
> scripts/kconfig/ and also includes e.g. tools/testing/.
> 
> Usually you have pkg-config for host and ${target_platform}-pkg-config for 
> the 
My use case was for buildroot, which define pkg-config and host-pkgconf. In
fact, I've just seen that a buildroot patch was accepted for this problem:
https://patchwork.ozlabs.org/patch/1081379/


Regards,
Nicolas


[PATCH linux] objtool: fix pkg-config query in case of cross-compilation

2019-04-11 Thread Nicolas Dichtel
In case of cross-compilation, there may be two pkg-config tools, one for
the host and one for the target. Enable to override the default name.

Fixes: 056d28d135bc ("objtool: Query pkg-config for libelf location")
Signed-off-by: Nicolas Dichtel 
---
 Makefile   | 3 ++-
 tools/objtool/Makefile | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 15c8251d4d5e..f12ca3598fc4 100644
--- a/Makefile
+++ b/Makefile
@@ -953,7 +953,8 @@ mod_sign_cmd = true
 endif
 export mod_sign_cmd
 
-HOST_LIBELF_LIBS = $(shell pkg-config libelf --libs 2>/dev/null || echo -lelf)
+export HOST_PKG_CONFIG ?= pkg-config
+HOST_LIBELF_LIBS = $(shell $(HOST_PKG_CONFIG) libelf --libs 2>/dev/null || 
echo -lelf)
 
 ifdef CONFIG_STACK_VALIDATION
   has_libelf := $(call try-run,\
diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile
index 53f8be0f4a1f..4e229e77aacf 100644
--- a/tools/objtool/Makefile
+++ b/tools/objtool/Makefile
@@ -25,8 +25,8 @@ LIBSUBCMD = $(LIBSUBCMD_OUTPUT)libsubcmd.a
 OBJTOOL:= $(OUTPUT)objtool
 OBJTOOL_IN := $(OBJTOOL)-in.o
 
-LIBELF_FLAGS := $(shell pkg-config libelf --cflags 2>/dev/null)
-LIBELF_LIBS  := $(shell pkg-config libelf --libs 2>/dev/null || echo -lelf)
+LIBELF_FLAGS := $(shell $(HOST_PKG_CONFIG) libelf --cflags 2>/dev/null)
+LIBELF_LIBS  := $(shell $(HOST_PKG_CONFIG) libelf --libs 2>/dev/null || echo 
-lelf)
 
 all: $(OBJTOOL)
 
-- 
2.21.0



Re: [PATCH net-next v5] ipmr: ip6mr: Create new sockopt to clear mfc cache or vifs

2019-02-14 Thread Nicolas Dichtel
Le 14/02/2019 à 03:44, Callum Sinclair a écrit :
> Currently the only way to clear the forwarding cache was to delete the
> entries one by one using the MRT_DEL_MFC socket option or to destroy and
> recreate the socket.
> 
> Create a new socket option which with the use of optional flags can
> clear any combination of multicast entries (static or not static) and
> multicast vifs (static or not static).
> 
> Calling the new socket option MRT_FLUSH with the flags MRT_FLUSH_MFC and
> MRT_FLUSH_VIFS will clear all entries and vifs on the socket except for
> static entries.
> 
> Signed-off-by: Callum Sinclair 
Except two minor comments (see below),
Acked-by: Nicolas Dichtel 

[snip]

> +/* MRT6_FLUSH optional flags */
> +#define MRT6_FLUSH_MFC   1   /* Flush multicast entries */
> +#define MRT6_FLUSH_MFC_STATIC2   /* Flush static multicast 
> entries */
> +#define MRT6_FLUSH_VIFS  4   /* Flushing multicast vifs */
> +#define MRT6_FLUSH_VIFS_STATIC   8   /* Flush static multicast vifs 
> */
vifs are called mifs in ipv6, maybe it's better to keep the consistency with
MRT6_FLUSH_MIFS and MRT6_FLUSH_MIFS_STATIC.

[snip]

> + if (flags & (MRT6_FLUSH_MFC | MRT6_FLUSH_MFC_STATIC)) {
> + list_for_each_entry_safe(c, tmp, >mfc_cache_list, list) {
> + if (((c->mfc_flags & MFC_STATIC) && !(flags & 
> MRT6_FLUSH_MFC_STATIC)) ||
> + (!(c->mfc_flags & MFC_STATIC) && !(flags & 
> MRT6_FLUSH_MFC)))
> + continue;
> + rhltable_remove(>mfc_hash, >mnode, 
> ip6mr_rht_params);
> + list_del_rcu(>list);
> + call_ip6mr_mfc_entry_notifiers(read_pnet(>net),
> +FIB_EVENT_ENTRY_DEL,
> + 
>(struct mfc6_cache *)c, mrt->id);
Two many tabs here.


Regards,
Nicolas


Re: [PATCH net-next v4] ipmr: ip6mr: Create new sockopt to clear mfc cache or vifs

2019-02-13 Thread Nicolas Dichtel
Le 12/02/2019 à 04:12, Callum Sinclair a écrit :
[snip]
>   /* Wipe the cache */
> - list_for_each_entry_safe(c, tmp, >mfc_cache_list, list) {
> - if (!all && (c->mfc_flags & MFC_STATIC))
> - continue;
> - rhltable_remove(>mfc_hash, >mnode, ipmr_rht_params);
> - list_del_rcu(>list);
> - cache = (struct mfc_cache *)c;
> - call_ipmr_mfc_entry_notifiers(net, FIB_EVENT_ENTRY_DEL, cache,
> -   mrt->id);
> - mroute_netlink_event(mrt, cache, RTM_DELROUTE);
> - mr_cache_put(c);
> - }
> -
> - if (atomic_read(>cache_resolve_queue_len) != 0) {
> - spin_lock_bh(_unres_lock);
> - list_for_each_entry_safe(c, tmp, >mfc_unres_queue, list) {
> - list_del(>list);
> + if (flags & (MRT_FLUSH_MFC | MRT_FLUSH_MFC_STATIC)) {
> + list_for_each_entry_safe(c, tmp, >mfc_cache_list, list) {
> + if (((c->mfc_flags & MFC_STATIC) && !(flags & 
> MRT_FLUSH_MFC_STATIC)) ||
> + (!(c->mfc_flags & MFC_STATIC) && !(flags & 
> MRT_FLUSH_MFC)))
> + continue;
> + rhltable_remove(>mfc_hash, >mnode, 
> ipmr_rht_params);
> + list_del_rcu(>list);
>   cache = (struct mfc_cache *)c;
> + call_ipmr_mfc_entry_notifiers(net, FIB_EVENT_ENTRY_DEL, 
> cache,
> +   mrt->id);
>   mroute_netlink_event(mrt, cache, RTM_DELROUTE);
> - ipmr_destroy_unres(mrt, cache);
> + mr_cache_put(c);
> + }
> +
> + if (atomic_read(>cache_resolve_queue_len) != 0) {
I wonder if the mfc_unres_queue must be cleaned up when only
MRT_FLUSH_MFC_STATIC is provided. My first intuition would be to do it only with
MRT_FLUSH_MFC.
Any opinion?


Regards,
Nicolas


Re: [PATCH net-next v3] ipmr: ip6mr: Create new sockopt to clear mfc cache or vifs

2019-02-11 Thread Nicolas Dichtel
Le 11/02/2019 à 04:54, Callum Sinclair a écrit :
> v1 -> v2:
> Implemented additional flags for static entries
> v2 -> v3:
> Cleaned up flag logic so any combination of routes can be cleared.
> Fixed style errors
> Fixed incorrect flag values
nit: those lines are usually put after the '---', thus they don't appear in the
final commit log (they are useful for reviewers only).

> 
> Currently the only way to clear the forwarding cache was to delete the
> entries one by one using the MRT_DEL_MFC socket option or to destroy and
> recreate the socket.
> 
> Create a new socket option which with the use of optional flags can
> clear any combination of multicast entries (static or not static) and
> multicast vifs (static or not static).
> 
> Calling the new socket option MRT_FLUSH with the flags MRT_FLUSH_MFC and
> MRT_FLUSH_VIFS will clear all entries and vifs on the socket except for
> static entries.
> 
> Signed-off-by: Callum Sinclair 
> ---
ie, here

>  include/uapi/linux/mroute.h  |  9 -
>  include/uapi/linux/mroute6.h |  9 -
>  net/ipv4/ipmr.c  | 73 -
>  net/ipv6/ip6mr.c | 78 +++-
>  4 files changed, 112 insertions(+), 57 deletions(-)
> 
> diff --git a/include/uapi/linux/mroute.h b/include/uapi/linux/mroute.h
> index 5d37a9ccce63..11c8c1fc1124 100644
> --- a/include/uapi/linux/mroute.h
> +++ b/include/uapi/linux/mroute.h
> @@ -28,12 +28,19 @@
>  #define MRT_TABLE(MRT_BASE+9)/* Specify mroute table ID  
> */
>  #define MRT_ADD_MFC_PROXY(MRT_BASE+10)   /* Add a (*,*|G) mfc entry  
> */
>  #define MRT_DEL_MFC_PROXY(MRT_BASE+11)   /* Del a (*,*|G) mfc entry  
> */
> -#define MRT_MAX  (MRT_BASE+11)
> +#define MRT_FLUSH(MRT_BASE+12)   /* Flush all mfc entries and/or vifs
> */
> +#define MRT_MAX  (MRT_BASE+12)
>  
>  #define SIOCGETVIFCNTSIOCPROTOPRIVATE/* IP protocol privates 
> */
>  #define SIOCGETSGCNT (SIOCPROTOPRIVATE+1)
>  #define SIOCGETRPF   (SIOCPROTOPRIVATE+2)
>  
> +/* MRT_FLUSH optional flags */
> +#define MRT_FLUSH_MFC1   /* Flush multicast entries */
> +#define MRT_FLUSH_MFC_STATIC 2   /* Flush static multicast entries */
> +#define MRT_FLUSH_VIFS   4   /* Flush multicast vifs */
> +#define MRT_FLUSH_VIFS_STATIC8   /* Flush static multicast vifs 
> */
> +
>  #define MAXVIFS  32
>  typedef unsigned long vifbitmap_t;   /* User mode code depends on this lot */
>  typedef unsigned short vifi_t;
> diff --git a/include/uapi/linux/mroute6.h b/include/uapi/linux/mroute6.h
> index cc006390..ac84ef11b29c 100644
> --- a/include/uapi/linux/mroute6.h
> +++ b/include/uapi/linux/mroute6.h
> @@ -31,12 +31,19 @@
>  #define MRT6_TABLE   (MRT6_BASE+9)   /* Specify mroute table ID  
> */
>  #define MRT6_ADD_MFC_PROXY   (MRT6_BASE+10)  /* Add a (*,*|G) mfc entry  
> */
>  #define MRT6_DEL_MFC_PROXY   (MRT6_BASE+11)  /* Del a (*,*|G) mfc entry  
> */
> -#define MRT6_MAX (MRT6_BASE+11)
> +#define MRT6_FLUSH   (MRT6_BASE+12)  /* Flush all mfc entries and/or vifs
> */
> +#define MRT6_MAX (MRT6_BASE+12)
>  
>  #define SIOCGETMIFCNT_IN6SIOCPROTOPRIVATE/* IP protocol privates 
> */
>  #define SIOCGETSGCNT_IN6 (SIOCPROTOPRIVATE+1)
>  #define SIOCGETRPF   (SIOCPROTOPRIVATE+2)
>  
> +/* MRT6_FLUSH optional flags */
> +#define MRT6_FLUSH_MFC   1   /* Flush multicast entries */
> +#define MRT6_FLUSH_MFC_STATIC2   /* Flush static multicast 
> entries */
> +#define MRT6_FLUSH_VIFS  4   /* Flushing multicast vifs */
> +#define MRT6_FLUSH_VIFS_STATIC   8   /* Flush static multicast vifs 
> */
> +
>  #define MAXMIFS  32
>  typedef unsigned long mifbitmap_t;   /* User mode code depends on this lot */
>  typedef unsigned short mifi_t;
> diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
> index e536970557dd..2c95ef8cf224 100644
> --- a/net/ipv4/ipmr.c
> +++ b/net/ipv4/ipmr.c
> @@ -110,7 +110,7 @@ static int ipmr_cache_report(struct mr_table *mrt,
>  static void mroute_netlink_event(struct mr_table *mrt, struct mfc_cache *mfc,
>int cmd);
>  static void igmpmsg_netlink_event(struct mr_table *mrt, struct sk_buff *pkt);
> -static void mroute_clean_tables(struct mr_table *mrt, bool all);
> +static void mroute_clean_tables(struct mr_table *mrt, int flags);
>  static void ipmr_expire_process(struct timer_list *t);
>  
>  #ifdef CONFIG_IP_MROUTE_MULTIPLE_TABLES
> @@ -415,7 +415,8 @@ static struct mr_table *ipmr_new_table(struct net *net, 
> u32 id)
>  static void ipmr_free_table(struct mr_table *mrt)
>  {
>   del_timer_sync(>ipmr_expire_timer);
> - mroute_clean_tables(mrt, true);
> + mroute_clean_tables(mrt, MRT_FLUSH_VIFS | MRT_FLUSH_VIFS_STATIC |
> + MRT_FLUSH_MFC | 
> MRT_FLUSH_MFC_STATIC);
nit: MRT_FLUSH_MFC must be aligned with 'mrt'

> 

Re: [PATCH net-next] ipmr: ip6mr: Create new sockopt to clear mfc cache or vifs

2019-02-08 Thread Nicolas Dichtel
Le 08/02/2019 à 15:43, Nikolay Aleksandrov a écrit :
> On 08/02/2019 16:18, Nicolas Dichtel wrote:
>> Le 08/02/2019 à 05:11, Callum Sinclair a écrit :
>>> Currently the only way to clear the mfc cache was to delete the entries
>> mfc stands for 'multicast forwarding cache', so 'mfc cache' is a bit strange.
>>
>>> one by one using the MRT_DEL_MFC socket option or to destroy and
>>> recreate the socket.
>> Note that if entries were added with MRT_ADD_MFC_PROXY, they will survive to 
>> the
>> socket destruction. This is not the case with your new cmd. Is it intended?
> 
> I think you're referring to MFC_STATIC entries (sk != mroute_sk). It
> doesn't matter how you add an entry - they all get cleaned up if added
> through the mroute socket.
Yes, right.
MRT_FLUSH_MFC_STATIC ?


Re: [PATCH net-next] ipmr: ip6mr: Create new sockopt to clear mfc cache or vifs

2019-02-08 Thread Nicolas Dichtel
Le 08/02/2019 à 05:11, Callum Sinclair a écrit :
> Currently the only way to clear the mfc cache was to delete the entries
mfc stands for 'multicast forwarding cache', so 'mfc cache' is a bit strange.

> one by one using the MRT_DEL_MFC socket option or to destroy and
> recreate the socket.
Note that if entries were added with MRT_ADD_MFC_PROXY, they will survive to the
socket destruction. This is not the case with your new cmd. Is it intended?
Maybe a third option (something like MRT_FLUSH_MFC_PROXY) would be useful to
avoid confusion?

> 
> Create a new socket option which will clear the multicast forwarding
> cache on the socket without destroying the socket. The new socket option
> MRT_FLUSH_ENTRIES will clear all multicast entries on the sockets table
> and the MRT_FLUSH_VIFS will delete all multicast vifs on the socket
> table.
> 
> Signed-off-by: Callum Sinclair 
> ---
>  include/uapi/linux/mroute.h  |  7 +++-
>  include/uapi/linux/mroute6.h |  7 +++-
>  net/ipv4/ipmr.c  | 69 -
>  net/ipv6/ip6mr.c | 74 ++--
>  4 files changed, 100 insertions(+), 57 deletions(-)
> 
> diff --git a/include/uapi/linux/mroute.h b/include/uapi/linux/mroute.h
> index 5d37a9ccce63..673495ca3495 100644
> --- a/include/uapi/linux/mroute.h
> +++ b/include/uapi/linux/mroute.h
> @@ -28,12 +28,17 @@
>  #define MRT_TABLE(MRT_BASE+9)/* Specify mroute table ID  
> */
>  #define MRT_ADD_MFC_PROXY(MRT_BASE+10)   /* Add a (*,*|G) mfc entry  
> */
>  #define MRT_DEL_MFC_PROXY(MRT_BASE+11)   /* Del a (*,*|G) mfc entry  
> */
> -#define MRT_MAX  (MRT_BASE+11)
> +#define MRT_FLUSH(MRT_BASE+12)   /* Flush all multicast entries and vifs 
> */
nit: "Flush all mfc entries and/or vifs" ?

> +#define MRT_MAX  (MRT_BASE+12)
>  
>  #define SIOCGETVIFCNTSIOCPROTOPRIVATE/* IP protocol privates 
> */
>  #define SIOCGETSGCNT (SIOCPROTOPRIVATE+1)
>  #define SIOCGETRPF   (SIOCPROTOPRIVATE+2)
>  
> +/* MRT_FLUSH optional flags */
> +#define MRT_FLUSH_ENTRIES1   /* For flushing all multicast entries */
Maybe MRT_FLUSH_MFC is more consistent with the previous naming (MRT_ADD_MFC, 
etc.)


Regards,
Nicolas


[PATCH net] netlink: avoid a double skb free in genlmsg_mcast()

2018-03-14 Thread Nicolas Dichtel
nlmsg_multicast() consumes always the skb, thus the original skb must be
freed only when this function is called with a clone.

Fixes: cb9f7a9a5c96 ("netlink: ensure to loop over all netns in 
genlmsg_multicast_allns()")
Reported-by: Ben Hutchings <ben.hutchi...@codethink.co.uk>
Signed-off-by: Nicolas Dichtel <nicolas.dich...@6wind.com>
---
 net/netlink/genetlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index 6f02499ef007..b9ce82c9440f 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -1106,7 +1106,7 @@ static int genlmsg_mcast(struct sk_buff *skb, u32 portid, 
unsigned long group,
if (!err)
delivered = true;
else if (err != -ESRCH)
-   goto error;
+   return err;
return delivered ? 0 : -ESRCH;
  error:
kfree_skb(skb);
-- 
2.15.1



[PATCH net] netlink: avoid a double skb free in genlmsg_mcast()

2018-03-14 Thread Nicolas Dichtel
nlmsg_multicast() consumes always the skb, thus the original skb must be
freed only when this function is called with a clone.

Fixes: cb9f7a9a5c96 ("netlink: ensure to loop over all netns in 
genlmsg_multicast_allns()")
Reported-by: Ben Hutchings 
Signed-off-by: Nicolas Dichtel 
---
 net/netlink/genetlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index 6f02499ef007..b9ce82c9440f 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -1106,7 +1106,7 @@ static int genlmsg_mcast(struct sk_buff *skb, u32 portid, 
unsigned long group,
if (!err)
delivered = true;
else if (err != -ESRCH)
-   goto error;
+   return err;
return delivered ? 0 : -ESRCH;
  error:
kfree_skb(skb);
-- 
2.15.1



Re: [PATCH 4.4 24/36] netlink: ensure to loop over all netns in genlmsg_multicast_allns()

2018-03-14 Thread Nicolas Dichtel
Le 13/03/2018 à 01:04, Ben Hutchings a écrit :
> On Fri, 2018-03-09 at 16:18 -0800, Greg Kroah-Hartman wrote:
>> 4.4-stable review patch.  If anyone has any objections, please let me know.
>>
>> ------
>>
>> From: Nicolas Dichtel <nicolas.dich...@6wind.com>
>>
>>
>> [ Upstream commit cb9f7a9a5c96a773bbc9c70660dc600cfff82f82 ]
> [...] 
>> -return nlmsg_multicast(prev->genl_sock, skb, portid, group, flags);
>> +err = nlmsg_multicast(prev->genl_sock, skb, portid, group, flags);
>> +if (!err)
>> +delivered = true;
>> +else if (err != -ESRCH)
>> +goto error;
> 
> This call to nlmsg_multicast() consumes skb rather than a clone, so we
> must not free it again here.
Right, good catch.

I will send an update.

Regards,
Nicolas


Re: [PATCH 4.4 24/36] netlink: ensure to loop over all netns in genlmsg_multicast_allns()

2018-03-14 Thread Nicolas Dichtel
Le 13/03/2018 à 01:04, Ben Hutchings a écrit :
> On Fri, 2018-03-09 at 16:18 -0800, Greg Kroah-Hartman wrote:
>> 4.4-stable review patch.  If anyone has any objections, please let me know.
>>
>> ------
>>
>> From: Nicolas Dichtel 
>>
>>
>> [ Upstream commit cb9f7a9a5c96a773bbc9c70660dc600cfff82f82 ]
> [...] 
>> -return nlmsg_multicast(prev->genl_sock, skb, portid, group, flags);
>> +err = nlmsg_multicast(prev->genl_sock, skb, portid, group, flags);
>> +if (!err)
>> +delivered = true;
>> +else if (err != -ESRCH)
>> +goto error;
> 
> This call to nlmsg_multicast() consumes skb rather than a clone, so we
> must not free it again here.
Right, good catch.

I will send an update.

Regards,
Nicolas


Re: [PATCH net-next 0/3 V1] rtnetlink: enable IFLA_IF_NETNSID for RTM_{DEL,SET}LINK

2018-01-26 Thread Nicolas Dichtel
Le 26/01/2018 à 09:36, Jiri Benc a écrit :
> On Fri, 26 Jan 2018 00:34:51 +0100, Nicolas Dichtel wrote:
>> Why meaningful? The user knows that the answer is like if if was done in 
>> another
>> netns. It enables to have only one netlink socket instead of one per netns. 
>> But
>> the code using it will be the same.  
> 
> Because you can't use it to query the linked interface. You can't even
> use it as an opaque value to track interfaces (netnsid+ifindex) because
> netnsids are not unique across net name spaces. You can easily have two
> interfaces that have all the ifindex, ifname, netnsid (and basically
> everything else) identical but being completely different interfaces.
Yes, the user have to map those info correctly. And this complexifies the (user)
code a lot.

> That's really not helpful.
> 
>> I fear that with your approach, it will results to a lot of complexity in the
>> kernel.  
> 
> The complexity is (at least partly) already there. It's an inevitable
> result of the design decision to have relative identifiers.
Yes, you're right. My approach moves the complexity to the user, which make this
feature hard to use.

> 
> I agree that we should think about how to make this easy to implement.
> I like your idea of doing this somehow generically. Perhaps it's
> possible to do while keeping the netnsids valid in the caller's netns?
Yes. I agree that it will be a lot easier to use if the conversion is done in
the kernel. And having a generic mechanism will also help a lot to use it.

> 
>> What is really missing for me, is a way to get a fd from an nsid. The user
>> should be able to call RTM_GETNSID with an fd and a nsid and the kernel 
>> performs
>> the needed operations so that the fd points to the corresponding netns.  
> 
> That's what I was missing, too. I even looked into implementing it. But
> opening a fd on behalf of the process and returning it over netlink is a
> wrong thing to do. Netlink messages can get lost. Then you have a fd
> leak you can do nothing about.
Yes, I also looked at this ;-)

> 
> Given that we have netnsids used for so much stuff already (like
> NETLINK_LISTEN_ALL_NSID) you need to track them anyway. And if you need
> to track them, why bother with another identifier? It would be better
> if netnsid can be used universally for anything. Then there will be no
> need for the conversion.
I like this idea a lot. So the missing part is a setns() using the nsid ;-)


Regards,
Nicolas


Re: [PATCH net-next 0/3 V1] rtnetlink: enable IFLA_IF_NETNSID for RTM_{DEL,SET}LINK

2018-01-26 Thread Nicolas Dichtel
Le 26/01/2018 à 09:36, Jiri Benc a écrit :
> On Fri, 26 Jan 2018 00:34:51 +0100, Nicolas Dichtel wrote:
>> Why meaningful? The user knows that the answer is like if if was done in 
>> another
>> netns. It enables to have only one netlink socket instead of one per netns. 
>> But
>> the code using it will be the same.  
> 
> Because you can't use it to query the linked interface. You can't even
> use it as an opaque value to track interfaces (netnsid+ifindex) because
> netnsids are not unique across net name spaces. You can easily have two
> interfaces that have all the ifindex, ifname, netnsid (and basically
> everything else) identical but being completely different interfaces.
Yes, the user have to map those info correctly. And this complexifies the (user)
code a lot.

> That's really not helpful.
> 
>> I fear that with your approach, it will results to a lot of complexity in the
>> kernel.  
> 
> The complexity is (at least partly) already there. It's an inevitable
> result of the design decision to have relative identifiers.
Yes, you're right. My approach moves the complexity to the user, which make this
feature hard to use.

> 
> I agree that we should think about how to make this easy to implement.
> I like your idea of doing this somehow generically. Perhaps it's
> possible to do while keeping the netnsids valid in the caller's netns?
Yes. I agree that it will be a lot easier to use if the conversion is done in
the kernel. And having a generic mechanism will also help a lot to use it.

> 
>> What is really missing for me, is a way to get a fd from an nsid. The user
>> should be able to call RTM_GETNSID with an fd and a nsid and the kernel 
>> performs
>> the needed operations so that the fd points to the corresponding netns.  
> 
> That's what I was missing, too. I even looked into implementing it. But
> opening a fd on behalf of the process and returning it over netlink is a
> wrong thing to do. Netlink messages can get lost. Then you have a fd
> leak you can do nothing about.
Yes, I also looked at this ;-)

> 
> Given that we have netnsids used for so much stuff already (like
> NETLINK_LISTEN_ALL_NSID) you need to track them anyway. And if you need
> to track them, why bother with another identifier? It would be better
> if netnsid can be used universally for anything. Then there will be no
> need for the conversion.
I like this idea a lot. So the missing part is a setns() using the nsid ;-)


Regards,
Nicolas


Re: [PATCH net-next 0/3 V1] rtnetlink: enable IFLA_IF_NETNSID for RTM_{DEL,SET}LINK

2018-01-25 Thread Nicolas Dichtel
Le 25/01/2018 à 23:30, Jiri Benc a écrit :
> On Thu, 25 Jan 2018 15:20:59 +0100, Nicolas Dichtel wrote:
>> Hmm, I don't agree. For me, it would be the correct answer. If user has a 
>> socket
>> in ns_a and targets a RTM_GETLINK in ns_b, the answer he gets should be like 
>> if
>> it was done in ns_b.
> 
> But that information would be useless for the caller. Why return a
> value that has no meaning for the caller and can not be used? More so
> when the kernel is aware of what the correct meaningful value is?
Why meaningful? The user knows that the answer is like if if was done in another
netns. It enables to have only one netlink socket instead of one per netns. But
the code using it will be the same.
I fear that with your approach, it will results to a lot of complexity in the
kernel.

> 
>> This is already the case with messages received with NETLINK_LISTEN_ALL_NSID,
>> there is no reason to do something different.
> 
> NETLINK_LISTEN_ALL_NSID is tough due to way it is implemented. But yes,
> it should translate the netnsids to be valid in the socket's netns.
> That's the only sane way for the listener.
A listener that uses this option should know the details about each netns it
listens. Thus, he has no problem to interpret the answer.

What is really missing for me, is a way to get a fd from an nsid. The user
should be able to call RTM_GETNSID with an fd and a nsid and the kernel performs
the needed operations so that the fd points to the corresponding netns.

Nicolas


Re: [PATCH net-next 0/3 V1] rtnetlink: enable IFLA_IF_NETNSID for RTM_{DEL,SET}LINK

2018-01-25 Thread Nicolas Dichtel
Le 25/01/2018 à 23:30, Jiri Benc a écrit :
> On Thu, 25 Jan 2018 15:20:59 +0100, Nicolas Dichtel wrote:
>> Hmm, I don't agree. For me, it would be the correct answer. If user has a 
>> socket
>> in ns_a and targets a RTM_GETLINK in ns_b, the answer he gets should be like 
>> if
>> it was done in ns_b.
> 
> But that information would be useless for the caller. Why return a
> value that has no meaning for the caller and can not be used? More so
> when the kernel is aware of what the correct meaningful value is?
Why meaningful? The user knows that the answer is like if if was done in another
netns. It enables to have only one netlink socket instead of one per netns. But
the code using it will be the same.
I fear that with your approach, it will results to a lot of complexity in the
kernel.

> 
>> This is already the case with messages received with NETLINK_LISTEN_ALL_NSID,
>> there is no reason to do something different.
> 
> NETLINK_LISTEN_ALL_NSID is tough due to way it is implemented. But yes,
> it should translate the netnsids to be valid in the socket's netns.
> That's the only sane way for the listener.
A listener that uses this option should know the details about each netns it
listens. Thus, he has no problem to interpret the answer.

What is really missing for me, is a way to get a fd from an nsid. The user
should be able to call RTM_GETNSID with an fd and a nsid and the kernel performs
the needed operations so that the fd points to the corresponding netns.

Nicolas


Re: [PATCH net-next 0/3 V1] rtnetlink: enable IFLA_IF_NETNSID for RTM_{DEL,SET}LINK

2018-01-25 Thread Nicolas Dichtel
Le 24/01/2018 à 17:35, Jiri Benc a écrit :
> On Wed, 24 Jan 2018 16:24:34 +0100, Nicolas Dichtel wrote:
>> I wonder if it would be possible to do something in the netlink framework, 
>> like
>> NETLINK_LISTEN_ALL_NSID.
>> Having some ancillary data at the netlink socket level and a function like
>> nlsock_net() (instead of sock_net()) to get the corresponding netns.
>> With that, it would be possible, in a generci way, to support this feature 
>> for
>> all netlink family.
> 
> I'm not sure it's worth the effort to do that in the framework. You'll
> need modifications all the way down to the code that generates the
> attributes anyway.
> 
> It's not enough to just specify that the operation should be done on a
> different netns and hide that from the handlers. Take for example the
> existing RTM_GETLINK. Let's say it's executed from within ns_a and
> targeted to ns_b (thus IFLA_IF_NETNSID = netnsid of ns_b). Now, if
> there's a veth interface in ns_b whose other end is in ns_c, there will
> be IFLA_LINK_NETNSID attribute in the response. But the value has to be
> netnsid of ns_c as seen from *ns_a*. If you just pretended to switch to
> ns_b before invoking rtnl_getlink, it would be netnsid of ns_c as seen
> from ns_b which would be wrong.
Hmm, I don't agree. For me, it would be the correct answer. If user has a socket
in ns_a and targets a RTM_GETLINK in ns_b, the answer he gets should be like if
it was done in ns_b.
This is already the case with messages received with NETLINK_LISTEN_ALL_NSID,
there is no reason to do something different.


Regards,
Nicolas


Re: [PATCH net-next 0/3 V1] rtnetlink: enable IFLA_IF_NETNSID for RTM_{DEL,SET}LINK

2018-01-25 Thread Nicolas Dichtel
Le 24/01/2018 à 17:35, Jiri Benc a écrit :
> On Wed, 24 Jan 2018 16:24:34 +0100, Nicolas Dichtel wrote:
>> I wonder if it would be possible to do something in the netlink framework, 
>> like
>> NETLINK_LISTEN_ALL_NSID.
>> Having some ancillary data at the netlink socket level and a function like
>> nlsock_net() (instead of sock_net()) to get the corresponding netns.
>> With that, it would be possible, in a generci way, to support this feature 
>> for
>> all netlink family.
> 
> I'm not sure it's worth the effort to do that in the framework. You'll
> need modifications all the way down to the code that generates the
> attributes anyway.
> 
> It's not enough to just specify that the operation should be done on a
> different netns and hide that from the handlers. Take for example the
> existing RTM_GETLINK. Let's say it's executed from within ns_a and
> targeted to ns_b (thus IFLA_IF_NETNSID = netnsid of ns_b). Now, if
> there's a veth interface in ns_b whose other end is in ns_c, there will
> be IFLA_LINK_NETNSID attribute in the response. But the value has to be
> netnsid of ns_c as seen from *ns_a*. If you just pretended to switch to
> ns_b before invoking rtnl_getlink, it would be netnsid of ns_c as seen
> from ns_b which would be wrong.
Hmm, I don't agree. For me, it would be the correct answer. If user has a socket
in ns_a and targets a RTM_GETLINK in ns_b, the answer he gets should be like if
it was done in ns_b.
This is already the case with messages received with NETLINK_LISTEN_ALL_NSID,
there is no reason to do something different.


Regards,
Nicolas


Re: [PATCH net-next 0/3 V1] rtnetlink: enable IFLA_IF_NETNSID for RTM_{DEL,SET}LINK

2018-01-24 Thread Nicolas Dichtel
Hi,

Le 24/01/2018 à 15:26, Christian Brauner a écrit :
> Hi,
> 
> Based on the previous discussion this enables passing a IFLA_IF_NETNSID
> property along with RTM_SETLINK and RTM_DELLINK requests. The patch for
> RTM_NEWLINK will be sent out in a separate patch since there are more
> corner-cases to think about.
I wonder if it would be possible to do something in the netlink framework, like
NETLINK_LISTEN_ALL_NSID.
Having some ancillary data at the netlink socket level and a function like
nlsock_net() (instead of sock_net()) to get the corresponding netns.
With that, it would be possible, in a generci way, to support this feature for
all netlink family.


Regards,
Nicolas


Re: [PATCH net-next 0/3 V1] rtnetlink: enable IFLA_IF_NETNSID for RTM_{DEL,SET}LINK

2018-01-24 Thread Nicolas Dichtel
Hi,

Le 24/01/2018 à 15:26, Christian Brauner a écrit :
> Hi,
> 
> Based on the previous discussion this enables passing a IFLA_IF_NETNSID
> property along with RTM_SETLINK and RTM_DELLINK requests. The patch for
> RTM_NEWLINK will be sent out in a separate patch since there are more
> corner-cases to think about.
I wonder if it would be possible to do something in the netlink framework, like
NETLINK_LISTEN_ALL_NSID.
Having some ancillary data at the netlink socket level and a function like
nlsock_net() (instead of sock_net()) to get the corresponding netns.
With that, it would be possible, in a generci way, to support this feature for
all netlink family.


Regards,
Nicolas


Re: [PATCH net-next 1/1] rtnetlink: request RTM_GETLINK by pid or fd

2018-01-24 Thread Nicolas Dichtel
Le 23/01/2018 à 18:08, Jiri Benc a écrit :
> On Tue, 23 Jan 2018 17:37:11 +0100, Nicolas Dichtel wrote:
>> When a virtual interface moves to another netns, the netlink RTM_DELLINK 
>> message
>> contains the attribute IFLA_NEW_NETNSID, which identifies where the interface
>> moves. The nsid may be allocated if needed.
> 
> The problem is that ifindex may change and it's not announced. The only
> way is to track both ifindex and ifname, watch for the ifname to appear
> in the target netns and update the application's view of ifindex.
Yes, you're right.

> 
> It would be much better if the whole (ifindex, netnsid) pair was
> returned. I think it could be added.
Sure. Do you plan to send a patch?

> 
>> I don't know if it's acceptable to also allocate an nsid in case of a 
>> physical
>> interface.
> 
> I think we need that.
If you agree, I can send a patch to remove this limitation.


Regards,
Nicolas


Re: [PATCH net-next 1/1] rtnetlink: request RTM_GETLINK by pid or fd

2018-01-24 Thread Nicolas Dichtel
Le 23/01/2018 à 18:08, Jiri Benc a écrit :
> On Tue, 23 Jan 2018 17:37:11 +0100, Nicolas Dichtel wrote:
>> When a virtual interface moves to another netns, the netlink RTM_DELLINK 
>> message
>> contains the attribute IFLA_NEW_NETNSID, which identifies where the interface
>> moves. The nsid may be allocated if needed.
> 
> The problem is that ifindex may change and it's not announced. The only
> way is to track both ifindex and ifname, watch for the ifname to appear
> in the target netns and update the application's view of ifindex.
Yes, you're right.

> 
> It would be much better if the whole (ifindex, netnsid) pair was
> returned. I think it could be added.
Sure. Do you plan to send a patch?

> 
>> I don't know if it's acceptable to also allocate an nsid in case of a 
>> physical
>> interface.
> 
> I think we need that.
If you agree, I can send a patch to remove this limitation.


Regards,
Nicolas


Re: [PATCH net-next 1/1] rtnetlink: request RTM_GETLINK by pid or fd

2018-01-23 Thread Nicolas Dichtel
Le 23/01/2018 à 11:26, Wolfgang Bumiller a écrit :
> On Tue, Jan 23, 2018 at 10:30:09AM +0100, Jiri Benc wrote:
>> On Mon, 22 Jan 2018 23:25:41 +0100, Christian Brauner wrote:
>>> This is not necessarily true in scenarios where I move a network device
>>> via RTM_NEWLINK + IFLA_NET_NS_PID into a network namespace I haven't
>>> created. Here is an example:
>>>
>>> nlmsghdr->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
>>> nlmsghdr->nlmsg_type = RTM_NEWLINK;
>>> /* move to network namespace of pid */
>>> nla_put_u32(nlmsg, IFLA_NET_NS_PID, pid)
>>> /* give interface new name */
>>> nla_put_string(nlmsg, IFLA_IFNAME, ifname)
>>>
>>> The only thing I have is the pid that identifies the network namespace.
>>
>> How do you know the interface did not get renamed in the new netns?
>>
>> This is racy and won't work reliably. You really need to know the
>> netnsid before moving the interface to the netns to be able to do
>> meaningful queries.
> 
> Even if you know the netnsid, do the mentioned watches work for
> nested/child namespaces if eg. a container creates new namespace before
> and/or after the watch was established and moves interfaces to these
> child namespaces, would you just see them disappear, or can you keep
> track of them later on as well?
nsid can be monitored (see ip monitor nsid).

> 
> Even if that works, from what the documentation tells me netlink is an
> unreliable protocol, so if my watcher's socket buffer is full, wouldn't
> I be losing important tracking information?
You can track socket error statistics. In case of error, you can start a dump to
ensure that you have the right view of the system.

> 
> I think one possible solution to tracking interfaces would be to have a
> unique identifier that never changes (even if it's just a simple
> uint64_t incremented whenever an interface is created). But since
> they're not local to the current namespace that may require a lot of
> extra permission checks (but I'm just speculating here...).
It's not possible to have unique identifiers. With CRIU, you need to be able to
reassign all existing ids.


Re: [PATCH net-next 1/1] rtnetlink: request RTM_GETLINK by pid or fd

2018-01-23 Thread Nicolas Dichtel
Le 23/01/2018 à 11:26, Wolfgang Bumiller a écrit :
> On Tue, Jan 23, 2018 at 10:30:09AM +0100, Jiri Benc wrote:
>> On Mon, 22 Jan 2018 23:25:41 +0100, Christian Brauner wrote:
>>> This is not necessarily true in scenarios where I move a network device
>>> via RTM_NEWLINK + IFLA_NET_NS_PID into a network namespace I haven't
>>> created. Here is an example:
>>>
>>> nlmsghdr->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
>>> nlmsghdr->nlmsg_type = RTM_NEWLINK;
>>> /* move to network namespace of pid */
>>> nla_put_u32(nlmsg, IFLA_NET_NS_PID, pid)
>>> /* give interface new name */
>>> nla_put_string(nlmsg, IFLA_IFNAME, ifname)
>>>
>>> The only thing I have is the pid that identifies the network namespace.
>>
>> How do you know the interface did not get renamed in the new netns?
>>
>> This is racy and won't work reliably. You really need to know the
>> netnsid before moving the interface to the netns to be able to do
>> meaningful queries.
> 
> Even if you know the netnsid, do the mentioned watches work for
> nested/child namespaces if eg. a container creates new namespace before
> and/or after the watch was established and moves interfaces to these
> child namespaces, would you just see them disappear, or can you keep
> track of them later on as well?
nsid can be monitored (see ip monitor nsid).

> 
> Even if that works, from what the documentation tells me netlink is an
> unreliable protocol, so if my watcher's socket buffer is full, wouldn't
> I be losing important tracking information?
You can track socket error statistics. In case of error, you can start a dump to
ensure that you have the right view of the system.

> 
> I think one possible solution to tracking interfaces would be to have a
> unique identifier that never changes (even if it's just a simple
> uint64_t incremented whenever an interface is created). But since
> they're not local to the current namespace that may require a lot of
> extra permission checks (but I'm just speculating here...).
It's not possible to have unique identifiers. With CRIU, you need to be able to
reassign all existing ids.


Re: [PATCH net-next 1/1] rtnetlink: request RTM_GETLINK by pid or fd

2018-01-23 Thread Nicolas Dichtel
Le 22/01/2018 à 23:06, Jiri Benc a écrit :
[snip]
> Btw, we have one missing piece here: when an interface is moved to a
> name space that does not have netnsid attached, we want to find out
> where the interface was moved to. But there's currently no reliable way
> to do it. For veth, the other end can be used to get the netnsid (note
> that RTM_GETLINK will return the correct link netnsid even when the
> queried veth interface is in a different name space), for openvswitch,
> we can now use genetlink, etc., but using different ways for different
> interface types is not the best API ever and for standalone interfaces
> we have nothing. I'd like to see something added to uAPI to cover this
> in a generic way.
When a virtual interface moves to another netns, the netlink RTM_DELLINK message
contains the attribute IFLA_NEW_NETNSID, which identifies where the interface
moves. The nsid may be allocated if needed.
I don't know if it's acceptable to also allocate an nsid in case of a physical
interface.


Regards,
Nicolas


Re: [PATCH net-next 1/1] rtnetlink: request RTM_GETLINK by pid or fd

2018-01-23 Thread Nicolas Dichtel
Le 22/01/2018 à 23:06, Jiri Benc a écrit :
[snip]
> Btw, we have one missing piece here: when an interface is moved to a
> name space that does not have netnsid attached, we want to find out
> where the interface was moved to. But there's currently no reliable way
> to do it. For veth, the other end can be used to get the netnsid (note
> that RTM_GETLINK will return the correct link netnsid even when the
> queried veth interface is in a different name space), for openvswitch,
> we can now use genetlink, etc., but using different ways for different
> interface types is not the best API ever and for standalone interfaces
> we have nothing. I'd like to see something added to uAPI to cover this
> in a generic way.
When a virtual interface moves to another netns, the netlink RTM_DELLINK message
contains the attribute IFLA_NEW_NETNSID, which identifies where the interface
moves. The nsid may be allocated if needed.
I don't know if it's acceptable to also allocate an nsid in case of a physical
interface.


Regards,
Nicolas


Re: [PATCH 4.14 053/118] Revert "Revert "xfrm: Fix stack-out-of-bounds read in xfrm_state_find.""

2018-01-15 Thread Nicolas Dichtel
Le 16/01/2018 à 07:33, Steffen Klassert a écrit :
> On Mon, Jan 15, 2018 at 11:56:12AM -0500, David Miller wrote:
>> From: Steffen Klassert <steffen.klass...@secunet.com>
>> Date: Mon, 15 Jan 2018 14:23:29 +0100
>>
>>> On Mon, Jan 15, 2018 at 01:34:40PM +0100, Greg Kroah-Hartman wrote:
>>>> 4.14-stable review patch.  If anyone has any objections, please let me 
>>>> know.
>>>>
>>>> --
>>>>
>>>> From: "David S. Miller" <da...@davemloft.net>
>>>>
>>>>
>>>> This reverts commit 94802151894d482e82c324edf2c658f8e6b96508.
>>>>
>>>> It breaks transport mode when the policy template has
>>>> wildcard addresses configured.
>>>>
>>>> Signed-off-by: David S. Miller <da...@davemloft.net>
>>>> Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>
>>>
>>> Hm, this seems to be one revert too much.
>>>
>>> commit 94802151894d482e82c324edf2c658f8e6b96508 reverted already
>>> the buggy commit. Reverting the revert will bring the bug back.
>>
>> Steffen, in the email where you asked me to revert that is the
>> commit ID you referenced.
> 
> I think there was a misunderstanding. I asked you to queue the
> commit with that ID to stable on Dec 23 (this commit ID is the
> revert of the buggy patch). This commit was included to stable
> on Jan 4 then:
> 
> https://www.spinics.net/lists/stable/msg208727.html
> 
> So with this, everything was ok.
> 
> Maybe you started to look again into this because Nicolas Dichtel
> (Cced) asked to queue this patch on Jan 5, the patch was already
> in the stable tree (Jan 4) but probably not in an actual release
> at this time.
Oh, I didn't find it at this time in the linux-stable tree nor in the stable
patchwork. Bad timing :/

I still don't find it in the patchwork:
http://patchwork.ozlabs.org/bundle/davem/stable/?series==1442=*==both
Am I missing something?

> 
>>
>> We can drop this, but you need to then tell us whether 4.14 needs
>> the revert any longer and if so what the correct SHA ID would
>> be.
> 
> I think we can we can just drop this.
> 
> Unless Nicolas knows something that is still missing, v4.14.12 and
> above should be ok as is.
I agree, we can drop this.


Thank you,
Nicolas


Re: [PATCH 4.14 053/118] Revert "Revert "xfrm: Fix stack-out-of-bounds read in xfrm_state_find.""

2018-01-15 Thread Nicolas Dichtel
Le 16/01/2018 à 07:33, Steffen Klassert a écrit :
> On Mon, Jan 15, 2018 at 11:56:12AM -0500, David Miller wrote:
>> From: Steffen Klassert 
>> Date: Mon, 15 Jan 2018 14:23:29 +0100
>>
>>> On Mon, Jan 15, 2018 at 01:34:40PM +0100, Greg Kroah-Hartman wrote:
>>>> 4.14-stable review patch.  If anyone has any objections, please let me 
>>>> know.
>>>>
>>>> --
>>>>
>>>> From: "David S. Miller" 
>>>>
>>>>
>>>> This reverts commit 94802151894d482e82c324edf2c658f8e6b96508.
>>>>
>>>> It breaks transport mode when the policy template has
>>>> wildcard addresses configured.
>>>>
>>>> Signed-off-by: David S. Miller 
>>>> Signed-off-by: Greg Kroah-Hartman 
>>>
>>> Hm, this seems to be one revert too much.
>>>
>>> commit 94802151894d482e82c324edf2c658f8e6b96508 reverted already
>>> the buggy commit. Reverting the revert will bring the bug back.
>>
>> Steffen, in the email where you asked me to revert that is the
>> commit ID you referenced.
> 
> I think there was a misunderstanding. I asked you to queue the
> commit with that ID to stable on Dec 23 (this commit ID is the
> revert of the buggy patch). This commit was included to stable
> on Jan 4 then:
> 
> https://www.spinics.net/lists/stable/msg208727.html
> 
> So with this, everything was ok.
> 
> Maybe you started to look again into this because Nicolas Dichtel
> (Cced) asked to queue this patch on Jan 5, the patch was already
> in the stable tree (Jan 4) but probably not in an actual release
> at this time.
Oh, I didn't find it at this time in the linux-stable tree nor in the stable
patchwork. Bad timing :/

I still don't find it in the patchwork:
http://patchwork.ozlabs.org/bundle/davem/stable/?series==1442=*==both
Am I missing something?

> 
>>
>> We can drop this, but you need to then tell us whether 4.14 needs
>> the revert any longer and if so what the correct SHA ID would
>> be.
> 
> I think we can we can just drop this.
> 
> Unless Nicolas knows something that is still missing, v4.14.12 and
> above should be ok as is.
I agree, we can drop this.


Thank you,
Nicolas


Re: [PATCH net-next 2/3] ipmr: add netlink notifications on igmpmsg cache reports

2017-06-14 Thread Nicolas Dichtel
Le 13/06/2017 à 19:08, Julien Gomes a écrit :
> Add Netlink notifications on cache reports in ipmr, in addition to the
> existing igmpmsg sent to mroute_sk.
> Send RTM_NEWCACHEREPORT notifications to RTNLGRP_IPV4_MROUTE.
> 
> MSGTYPE, VIF_ID, SRC_ADDR and DST_ADDR Netlink attributes contain the
> same data as their equivalent fields in the igmpmsg header.
> PKT attribute is the packet sent to mroute_sk, without the added igmpmsg
> header.
> 
> Suggested-by: Ryan Halbrook 
> Signed-off-by: Julien Gomes 
> ---
>  include/uapi/linux/mroute.h | 11 
>  net/ipv4/ipmr.c | 63 
> +++--
>  2 files changed, 72 insertions(+), 2 deletions(-)
> 
> diff --git a/include/uapi/linux/mroute.h b/include/uapi/linux/mroute.h
> index f904367c0cee..f6f9e01ee734 100644
> --- a/include/uapi/linux/mroute.h
> +++ b/include/uapi/linux/mroute.h
> @@ -152,6 +152,17 @@ enum {
>  };
>  #define IPMRA_VIFA_MAX (__IPMRA_VIFA_MAX - 1)
>  
> +/* ipmr netlink cache report attributes */
> +enum {
IPMRA_CACHEREPORTA_UNSPEC is missing.
By the way, maybe something shorter than IPMRA_CACHEREPORTA_ would be better.
What about IPMR_CREPORTA_? IPMR_CACHEA_? IPMR_IGMPA_? or whatever.
What is the signification of the two 'A'? One for 'attribute', but the other?

> + IPMRA_CACHEREPORTA_MSGTYPE,
> + IPMRA_CACHEREPORTA_VIF_ID,
> + IPMRA_CACHEREPORTA_SRC_ADDR,
> + IPMRA_CACHEREPORTA_DST_ADDR,
> + IPMRA_CACHEREPORTA_PKT,
> + __IPMRA_CACHEREPORTA_MAX
> +};
> +#define IPMRA_CACHEREPORTA_MAX (__IPMRA_CACHEREPORTA_MAX - 1)


Re: [PATCH net-next 2/3] ipmr: add netlink notifications on igmpmsg cache reports

2017-06-14 Thread Nicolas Dichtel
Le 13/06/2017 à 19:08, Julien Gomes a écrit :
> Add Netlink notifications on cache reports in ipmr, in addition to the
> existing igmpmsg sent to mroute_sk.
> Send RTM_NEWCACHEREPORT notifications to RTNLGRP_IPV4_MROUTE.
> 
> MSGTYPE, VIF_ID, SRC_ADDR and DST_ADDR Netlink attributes contain the
> same data as their equivalent fields in the igmpmsg header.
> PKT attribute is the packet sent to mroute_sk, without the added igmpmsg
> header.
> 
> Suggested-by: Ryan Halbrook 
> Signed-off-by: Julien Gomes 
> ---
>  include/uapi/linux/mroute.h | 11 
>  net/ipv4/ipmr.c | 63 
> +++--
>  2 files changed, 72 insertions(+), 2 deletions(-)
> 
> diff --git a/include/uapi/linux/mroute.h b/include/uapi/linux/mroute.h
> index f904367c0cee..f6f9e01ee734 100644
> --- a/include/uapi/linux/mroute.h
> +++ b/include/uapi/linux/mroute.h
> @@ -152,6 +152,17 @@ enum {
>  };
>  #define IPMRA_VIFA_MAX (__IPMRA_VIFA_MAX - 1)
>  
> +/* ipmr netlink cache report attributes */
> +enum {
IPMRA_CACHEREPORTA_UNSPEC is missing.
By the way, maybe something shorter than IPMRA_CACHEREPORTA_ would be better.
What about IPMR_CREPORTA_? IPMR_CACHEA_? IPMR_IGMPA_? or whatever.
What is the signification of the two 'A'? One for 'attribute', but the other?

> + IPMRA_CACHEREPORTA_MSGTYPE,
> + IPMRA_CACHEREPORTA_VIF_ID,
> + IPMRA_CACHEREPORTA_SRC_ADDR,
> + IPMRA_CACHEREPORTA_DST_ADDR,
> + IPMRA_CACHEREPORTA_PKT,
> + __IPMRA_CACHEREPORTA_MAX
> +};
> +#define IPMRA_CACHEREPORTA_MAX (__IPMRA_CACHEREPORTA_MAX - 1)


Re: [PATCH] kbuild: replace genhdr-y with generated-y, deprecating genhdr-y

2017-06-09 Thread Nicolas Dichtel
Le 09/06/2017 à 10:29, Masahiro Yamada a écrit :
> Prior to commit fcc8487d477a ("uapi: export all headers under uapi
> directories"), genhdr-y was meant to specify generated UAPI headers.
> 
> - generated-y: generated headers (other than asm-generic wrappers)
> - header-y   : headers to be exported
> - genhdr-y   : generated headers to be exported (generated-y + header-y)
> 
> Now headers under UAPI directories are all exported.  So, there is no
> more difference between generated-y and genhdr-y.
> 
> We see two users of genhdr-y, arch/{arm,x86}/include/uapi/asm/Kbuild.
> They generate some headers in arch/{arm,x86}/include/uapi/generated/
> directories, which are obviously exported.
> 
> Replace genhdr-y with generated-y, and deprecate genhdr-y.
> 
> Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com>
Good catch. It eases the understanding of all those mechanisms.

After the fix of the typo in the commitlog:
Acked-by: Nicolas Dichtel <nicolas.dich...@6wind.com>


Re: [PATCH] kbuild: replace genhdr-y with generated-y, deprecating genhdr-y

2017-06-09 Thread Nicolas Dichtel
Le 09/06/2017 à 10:29, Masahiro Yamada a écrit :
> Prior to commit fcc8487d477a ("uapi: export all headers under uapi
> directories"), genhdr-y was meant to specify generated UAPI headers.
> 
> - generated-y: generated headers (other than asm-generic wrappers)
> - header-y   : headers to be exported
> - genhdr-y   : generated headers to be exported (generated-y + header-y)
> 
> Now headers under UAPI directories are all exported.  So, there is no
> more difference between generated-y and genhdr-y.
> 
> We see two users of genhdr-y, arch/{arm,x86}/include/uapi/asm/Kbuild.
> They generate some headers in arch/{arm,x86}/include/uapi/generated/
> directories, which are obviously exported.
> 
> Replace genhdr-y with generated-y, and deprecate genhdr-y.
> 
> Signed-off-by: Masahiro Yamada 
Good catch. It eases the understanding of all those mechanisms.

After the fix of the typo in the commitlog:
Acked-by: Nicolas Dichtel 


Re: [PATCH v2] kbuild: skip install/check of headers right under uapi directories

2017-05-16 Thread Nicolas Dichtel
Le 16/05/2017 à 07:15, Masahiro Yamada a écrit :
> Since commit 61562f981e92 ("uapi: export all arch specifics
> directories"), "make INSTALL_HDR_PATH=$root/usr headers_install"
> deletes standard glibc headers and others in $root/usr/include.
> 
> The cause of the issue is that headers_install now starts descending
> from arch/$(hdr-arch)/include/uapi with $root/usr/include for its
> destination when installing asm headers.  So, headers already there
> are assumed to be unwanted.
> 
> When headers_install starts descending from include/uapi with
> $root/usr/include for its destination, it works around the problem
> by creating an dummy destination $root/usr/include/uapi, but this
> is tricky.
> 
> To fix the problem in a clean way is to skip headers install/check
> in include/uapi or arch/$(hdr-arch)/include/uapi because we know
> there are only sub-directories in uapi directories.  A good side
> effect is the empty destination $root/usr/include/uapi will go
> away.
> 
> I am also removing the trailing slash in the headers_check target to
> skip checking in arch/$(hdr-arch)/include/uapi.
> 
> Fixes: 61562f981e92 ("uapi: export all arch specifics directories")
> Reported-by: Dan Williams <dan.j.willi...@intel.com>
> Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com>
Thank you for the patch.

Acked-by: Nicolas Dichtel <nicolas.dich...@6wind.com>


Re: [PATCH v2] kbuild: skip install/check of headers right under uapi directories

2017-05-16 Thread Nicolas Dichtel
Le 16/05/2017 à 07:15, Masahiro Yamada a écrit :
> Since commit 61562f981e92 ("uapi: export all arch specifics
> directories"), "make INSTALL_HDR_PATH=$root/usr headers_install"
> deletes standard glibc headers and others in $root/usr/include.
> 
> The cause of the issue is that headers_install now starts descending
> from arch/$(hdr-arch)/include/uapi with $root/usr/include for its
> destination when installing asm headers.  So, headers already there
> are assumed to be unwanted.
> 
> When headers_install starts descending from include/uapi with
> $root/usr/include for its destination, it works around the problem
> by creating an dummy destination $root/usr/include/uapi, but this
> is tricky.
> 
> To fix the problem in a clean way is to skip headers install/check
> in include/uapi or arch/$(hdr-arch)/include/uapi because we know
> there are only sub-directories in uapi directories.  A good side
> effect is the empty destination $root/usr/include/uapi will go
> away.
> 
> I am also removing the trailing slash in the headers_check target to
> skip checking in arch/$(hdr-arch)/include/uapi.
> 
> Fixes: 61562f981e92 ("uapi: export all arch specifics directories")
> Reported-by: Dan Williams 
> Signed-off-by: Masahiro Yamada 
Thank you for the patch.

Acked-by: Nicolas Dichtel 


Re: [PATCH v11 10/12] uapi: export all headers under uapi directories

2017-05-09 Thread Nicolas Dichtel
Le 08/05/2017 à 01:17, Masahiro Yamada a écrit :
Hi Masahiro,

[snip]

> I will send pull-requests for v4.12 in a few days.
> 
> I need to fix a complex conflict reported by
> https://lkml.org/lkml/2017/4/10/1208
> 
> I rebased linux-kbuild/uapi on commit 13e0988140
> (dropping 08/12 "cryptouser.h: fix include from userland").
Ok.

> 
> 
> I updated the list of headers, which were not exported,
> are now exported.
> 
> If you find something is wrong, please let me know.
> The list is now as follows:
> 
> asm-arc/kvm_para.h
> asm-arc/ucontext.h
> asm-blackfin/shmparam.h
> asm-blackfin/ucontext.h
> asm-c6x/shmparam.h
> asm-c6x/ucontext.h
> asm-cris/kvm_para.h
> asm-h8300/shmparam.h
> asm-h8300/ucontext.h
> asm-hexagon/shmparam.h
> asm-m32r/kvm_para.h
> asm-m68k/kvm_para.h
> asm-m68k/shmparam.h
> asm-metag/kvm_para.h
> asm-metag/shmparam.h
> asm-metag/ucontext.h
> asm-mips/hwcap.h
> asm-mips/reg.h
> asm-mips/ucontext.h
> asm-nios2/kvm_para.h
> asm-nios2/ucontext.h
> asm-openrisc/shmparam.h
> asm-parisc/kvm_para.h
> asm-powerpc/perf_regs.h
> asm-sh/kvm_para.h
> asm-sh/ucontext.h
> asm-tile/shmparam.h
> asm-unicore32/shmparam.h
> asm-unicore32/ucontext.h
> asm-x86/hwcap2.h
> asm-xtensa/kvm_para.h
> drm/armada_drm.h
> drm/etnaviv_drm.h
> drm/vgem_drm.h
> linux/aspeed-lpc-ctrl.h
> linux/auto_dev-ioctl.h
> linux/bcache.h
> linux/btrfs_tree.h
> linux/can/vxcan.h
> linux/cifs/cifs_mount.h
> linux/coresight-stm.h
> linux/cryptouser.h
> linux/genwqe/genwqe_card.h
> linux/fsmap.h
> linux/hash_info.h
> linux/kcm.h
> linux/kcov.h
> linux/kfd_ioctl.h
> linux/lightnvm.h
> linux/module.h
> linux/nbd-netlink.h
> linux/nilfs2_api.h
> linux/nilfs2_ondisk.h
> linux/nsfs.h
> linux/pr.h
> linux/qrtr.h
> linux/rpmsg.h
> linux/sched/types.h
> linux/sed-opal.h
> linux/smc.h
> linux/smc_diag.h
> linux/stm.h
> linux/wil6210_uapi.h
> rdma/bnxt_re-abi.h

linux/vfio_ccw.h is missing in your list.
And to be a bit picky, linux/fsmap.h should be put before
linux/genwqe/genwqe_card.h ;-)

I've rebased my tree on commit 2868b2513aa7 (see
https://github.com/NicolasDichtel/linux/commits/master) and the following file
should also be added after that: linux/switchtec_ioctl.h.


Thank you,
Nicolas


Re: [PATCH v11 10/12] uapi: export all headers under uapi directories

2017-05-09 Thread Nicolas Dichtel
Le 08/05/2017 à 01:17, Masahiro Yamada a écrit :
Hi Masahiro,

[snip]

> I will send pull-requests for v4.12 in a few days.
> 
> I need to fix a complex conflict reported by
> https://lkml.org/lkml/2017/4/10/1208
> 
> I rebased linux-kbuild/uapi on commit 13e0988140
> (dropping 08/12 "cryptouser.h: fix include from userland").
Ok.

> 
> 
> I updated the list of headers, which were not exported,
> are now exported.
> 
> If you find something is wrong, please let me know.
> The list is now as follows:
> 
> asm-arc/kvm_para.h
> asm-arc/ucontext.h
> asm-blackfin/shmparam.h
> asm-blackfin/ucontext.h
> asm-c6x/shmparam.h
> asm-c6x/ucontext.h
> asm-cris/kvm_para.h
> asm-h8300/shmparam.h
> asm-h8300/ucontext.h
> asm-hexagon/shmparam.h
> asm-m32r/kvm_para.h
> asm-m68k/kvm_para.h
> asm-m68k/shmparam.h
> asm-metag/kvm_para.h
> asm-metag/shmparam.h
> asm-metag/ucontext.h
> asm-mips/hwcap.h
> asm-mips/reg.h
> asm-mips/ucontext.h
> asm-nios2/kvm_para.h
> asm-nios2/ucontext.h
> asm-openrisc/shmparam.h
> asm-parisc/kvm_para.h
> asm-powerpc/perf_regs.h
> asm-sh/kvm_para.h
> asm-sh/ucontext.h
> asm-tile/shmparam.h
> asm-unicore32/shmparam.h
> asm-unicore32/ucontext.h
> asm-x86/hwcap2.h
> asm-xtensa/kvm_para.h
> drm/armada_drm.h
> drm/etnaviv_drm.h
> drm/vgem_drm.h
> linux/aspeed-lpc-ctrl.h
> linux/auto_dev-ioctl.h
> linux/bcache.h
> linux/btrfs_tree.h
> linux/can/vxcan.h
> linux/cifs/cifs_mount.h
> linux/coresight-stm.h
> linux/cryptouser.h
> linux/genwqe/genwqe_card.h
> linux/fsmap.h
> linux/hash_info.h
> linux/kcm.h
> linux/kcov.h
> linux/kfd_ioctl.h
> linux/lightnvm.h
> linux/module.h
> linux/nbd-netlink.h
> linux/nilfs2_api.h
> linux/nilfs2_ondisk.h
> linux/nsfs.h
> linux/pr.h
> linux/qrtr.h
> linux/rpmsg.h
> linux/sched/types.h
> linux/sed-opal.h
> linux/smc.h
> linux/smc_diag.h
> linux/stm.h
> linux/wil6210_uapi.h
> rdma/bnxt_re-abi.h

linux/vfio_ccw.h is missing in your list.
And to be a bit picky, linux/fsmap.h should be put before
linux/genwqe/genwqe_card.h ;-)

I've rebased my tree on commit 2868b2513aa7 (see
https://github.com/NicolasDichtel/linux/commits/master) and the following file
should also be added after that: linux/switchtec_ioctl.h.


Thank you,
Nicolas


[PATCH v11 12/12] arch/include: remove empty Kbuild files

2017-03-27 Thread Nicolas Dichtel
Signed-off-by: Nicolas Dichtel <nicolas.dich...@6wind.com>
---
 arch/cris/include/arch-v10/arch/Kbuild | 1 -
 arch/cris/include/arch-v32/arch/Kbuild | 1 -
 arch/tile/include/arch/Kbuild  | 1 -
 3 files changed, 3 deletions(-)
 delete mode 100644 arch/cris/include/arch-v10/arch/Kbuild
 delete mode 100644 arch/cris/include/arch-v32/arch/Kbuild
 delete mode 100644 arch/tile/include/arch/Kbuild

diff --git a/arch/cris/include/arch-v10/arch/Kbuild 
b/arch/cris/include/arch-v10/arch/Kbuild
deleted file mode 100644
index 1f0fc7a66f5f..
--- a/arch/cris/include/arch-v10/arch/Kbuild
+++ /dev/null
@@ -1 +0,0 @@
-# CRISv10 arch
diff --git a/arch/cris/include/arch-v32/arch/Kbuild 
b/arch/cris/include/arch-v32/arch/Kbuild
deleted file mode 100644
index 2fd65c7e15c9..
--- a/arch/cris/include/arch-v32/arch/Kbuild
+++ /dev/null
@@ -1 +0,0 @@
-# CRISv32 arch
diff --git a/arch/tile/include/arch/Kbuild b/arch/tile/include/arch/Kbuild
deleted file mode 100644
index 3751c9fabcf2..
--- a/arch/tile/include/arch/Kbuild
+++ /dev/null
@@ -1 +0,0 @@
-# Tile arch headers
-- 
2.8.1



[PATCH v11 12/12] arch/include: remove empty Kbuild files

2017-03-27 Thread Nicolas Dichtel
Signed-off-by: Nicolas Dichtel 
---
 arch/cris/include/arch-v10/arch/Kbuild | 1 -
 arch/cris/include/arch-v32/arch/Kbuild | 1 -
 arch/tile/include/arch/Kbuild  | 1 -
 3 files changed, 3 deletions(-)
 delete mode 100644 arch/cris/include/arch-v10/arch/Kbuild
 delete mode 100644 arch/cris/include/arch-v32/arch/Kbuild
 delete mode 100644 arch/tile/include/arch/Kbuild

diff --git a/arch/cris/include/arch-v10/arch/Kbuild 
b/arch/cris/include/arch-v10/arch/Kbuild
deleted file mode 100644
index 1f0fc7a66f5f..
--- a/arch/cris/include/arch-v10/arch/Kbuild
+++ /dev/null
@@ -1 +0,0 @@
-# CRISv10 arch
diff --git a/arch/cris/include/arch-v32/arch/Kbuild 
b/arch/cris/include/arch-v32/arch/Kbuild
deleted file mode 100644
index 2fd65c7e15c9..
--- a/arch/cris/include/arch-v32/arch/Kbuild
+++ /dev/null
@@ -1 +0,0 @@
-# CRISv32 arch
diff --git a/arch/tile/include/arch/Kbuild b/arch/tile/include/arch/Kbuild
deleted file mode 100644
index 3751c9fabcf2..
--- a/arch/tile/include/arch/Kbuild
+++ /dev/null
@@ -1 +0,0 @@
-# Tile arch headers
-- 
2.8.1



[PATCH v11 02/12] nios2: put setup.h in uapi

2017-03-27 Thread Nicolas Dichtel
This header file is exported, but from a userland pov, it's just a wrapper
to asm-generic/setup.h.

Signed-off-by: Nicolas Dichtel <nicolas.dich...@6wind.com>
Reviewed-by: Tobias Klauser <tklau...@distanz.ch>
---
 arch/nios2/include/uapi/asm/Kbuild | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/nios2/include/uapi/asm/Kbuild 
b/arch/nios2/include/uapi/asm/Kbuild
index e0bb972a50d7..69c965304146 100644
--- a/arch/nios2/include/uapi/asm/Kbuild
+++ b/arch/nios2/include/uapi/asm/Kbuild
@@ -2,4 +2,5 @@ include include/uapi/asm-generic/Kbuild.asm
 
 header-y += elf.h
 
+generic-y += setup.h
 generic-y += ucontext.h
-- 
2.8.1



[PATCH v11 09/12] smc_diag.h: fix include from userland

2017-03-27 Thread Nicolas Dichtel
This patch prepares the uapi export by fixing the following error:

.../linux/smc_diag.h:6:27: fatal error: rdma/ib_verbs.h: No such file or 
directory
 #include 

Signed-off-by: Nicolas Dichtel <nicolas.dich...@6wind.com>
---
 include/rdma/ib_verbs.h   | 3 +--
 include/uapi/linux/smc_diag.h | 2 +-
 include/uapi/rdma/ib_user_verbs.h | 2 ++
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 0f1813c13687..50f276a4afdc 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -61,6 +61,7 @@
 #include 
 #include 
 #include 
+#include 
 
 extern struct workqueue_struct *ib_wq;
 extern struct workqueue_struct *ib_comp_wq;
@@ -1838,8 +1839,6 @@ enum ib_mad_result {
IB_MAD_RESULT_CONSUMED = 1 << 2  /* Packet consumed: stop processing */
 };
 
-#define IB_DEVICE_NAME_MAX 64
-
 struct ib_port_cache {
struct ib_pkey_cache  *pkey;
struct ib_gid_table   *gid;
diff --git a/include/uapi/linux/smc_diag.h b/include/uapi/linux/smc_diag.h
index 0063919fea34..87712bfaa9dd 100644
--- a/include/uapi/linux/smc_diag.h
+++ b/include/uapi/linux/smc_diag.h
@@ -3,7 +3,7 @@
 
 #include 
 #include 
-#include 
+#include 
 
 /* Request structure */
 struct smc_diag_req {
diff --git a/include/uapi/rdma/ib_user_verbs.h 
b/include/uapi/rdma/ib_user_verbs.h
index 997f904c7692..8edce2b65903 100644
--- a/include/uapi/rdma/ib_user_verbs.h
+++ b/include/uapi/rdma/ib_user_verbs.h
@@ -1124,4 +1124,6 @@ struct ib_uverbs_ex_destroy_rwq_ind_table  {
__u32 ind_tbl_handle;
 };
 
+#define IB_DEVICE_NAME_MAX 64
+
 #endif /* IB_USER_VERBS_H */
-- 
2.8.1



[PATCH v11 10/12] uapi: export all headers under uapi directories

2017-03-27 Thread Nicolas Dichtel
Regularly, when a new header is created in include/uapi/, the developer
forgets to add it in the corresponding Kbuild file. This error is usually
detected after the release is out.

In fact, all headers under uapi directories should be exported, thus it's
useless to have an exhaustive list.

After this patch, the following files, which were not exported, are now
exported (with make headers_install_all):
asm-arc/kvm_para.h
asm-arc/ucontext.h
asm-avr32/kvm_para.h
asm-blackfin/shmparam.h
asm-blackfin/ucontext.h
asm-c6x/shmparam.h
asm-c6x/ucontext.h
asm-cris/kvm_para.h
asm-h8300/shmparam.h
asm-h8300/ucontext.h
asm-hexagon/shmparam.h
asm-m32r/kvm_para.h
asm-m68k/kvm_para.h
asm-m68k/shmparam.h
asm-metag/kvm_para.h
asm-metag/shmparam.h
asm-metag/ucontext.h
asm-mips/hwcap.h
asm-mips/reg.h
asm-mips/ucontext.h
asm-nios2/kvm_para.h
asm-nios2/ucontext.h
asm-openrisc/shmparam.h
asm-parisc/kvm_para.h
asm-powerpc/perf_regs.h
asm-sh/kvm_para.h
asm-sh/ucontext.h
asm-tile/shmparam.h
asm-unicore32/shmparam.h
asm-unicore32/ucontext.h
asm-x86/hwcap2.h
asm-xtensa/kvm_para.h
drm/armada_drm.h
drm/etnaviv_drm.h
drm/vgem_drm.h
linux/auto_dev-ioctl.h
linux/bcache.h
linux/btrfs_tree.h
linux/cifs/cifs_mount.h
linux/coresight-stm.h
linux/crypto.h
linux/cryptouser.h
linux/genwqe/genwqe_card.h
linux/hash_info.h
linux/kcm.h
linux/kcov.h
linux/kfd_ioctl.h
linux/lightnvm.h
linux/module.h
linux/nilfs2_api.h
linux/nilfs2_ondisk.h
linux/nsfs.h
linux/pr.h
linux/qrtr.h
linux/rpmsg.h
linux/sched/types.h
linux/sed-opal.h
linux/smc.h
linux/smc_diag.h
linux/stm.h
linux/userio.h
linux/virtio_mmio.h
linux/wil6210_uapi.h
rdma/bnxt_re-abi.h

Note that I have removed from this list the files which are generated in every
exported directories (like .install or .install.cmd).

Thanks to Julien Floret <julien.flo...@6wind.com> for the tip to get all
subdirs with a pure makefile command.

For the record, note that exported files for asm directories are a mix of
files listed by:
 - include/uapi/asm-generic/Kbuild.asm;
 - arch//include/uapi/asm/Kbuild;
 - arch//include/asm/Kbuild.

Signed-off-by: Nicolas Dichtel <nicolas.dich...@6wind.com>
Acked-by: Daniel Vetter <daniel.vet...@ffwll.ch>
Acked-by: Russell King <rmk+ker...@armlinux.org.uk>
Acked-by: Mark Salter <msal...@redhat.com>
Acked-by: Michael Ellerman <m...@ellerman.id.au> (powerpc)
---
 Documentation/kbuild/makefiles.txt  |  66 ++--
 arch/alpha/include/uapi/asm/Kbuild  |  41 ---
 arch/arc/include/uapi/asm/Kbuild|   3 -
 arch/arm/include/uapi/asm/Kbuild|  17 -
 arch/arm64/include/uapi/asm/Kbuild  |  18 -
 arch/avr32/include/uapi/asm/Kbuild  |  20 --
 arch/blackfin/include/uapi/asm/Kbuild   |  17 -
 arch/c6x/include/uapi/asm/Kbuild|   8 -
 arch/cris/include/uapi/arch-v10/arch/Kbuild |   5 -
 arch/cris/include/uapi/arch-v32/arch/Kbuild |   3 -
 arch/cris/include/uapi/asm/Kbuild   |  43 +--
 arch/frv/include/uapi/asm/Kbuild|  33 --
 arch/h8300/include/uapi/asm/Kbuild  |  28 --
 arch/hexagon/include/asm/Kbuild |   3 -
 arch/hexagon/include/uapi/asm/Kbuild|  13 -
 arch/ia64/include/uapi/asm/Kbuild   |  45 ---
 arch/m32r/include/uapi/asm/Kbuild   |  31 --
 arch/m68k/include/uapi/asm/Kbuild   |  24 --
 arch/metag/include/uapi/asm/Kbuild  |   8 -
 arch/microblaze/include/uapi/asm/Kbuild |  32 --
 arch/mips/include/uapi/asm/Kbuild   |  37 ---
 arch/mn10300/include/uapi/asm/Kbuild|  32 --
 arch/nios2/include/uapi/asm/Kbuild  |   3 +-
 arch/openrisc/include/asm/Kbuild|   3 -
 arch/openrisc/include/uapi/asm/Kbuild   |   8 -
 arch/parisc/include/uapi/asm/Kbuild |  28 --
 arch/powerpc/include/uapi/asm/Kbuild|  45 ---
 arch/s390/include/uapi/asm/Kbuild   |  53 ---
 arch/score/include/asm/Kbuild   |   3 -
 arch/score/include/uapi/asm/Kbuild  |  32 --
 arch/sh/include/uapi/asm/Kbuild |  23 --
 arch/sparc/include/uapi/asm/Kbuild  |  48 ---
 arch/tile/include/asm/Kbuild|   3 -
 arch/tile/include/uapi/arch/Kbuild  |  17 -
 arch/tile/include/uapi/asm/Kbuild   |  19 +-
 arch/unicore32/include/uapi/asm/Kbuild  |   6 -
 arch/x86/include/uapi/asm/Kbuild|  58 
 arch/xtensa/include/uapi/asm/Kbuild |  23 --
 include/Kbuild  |   2 -
 include/asm-generic/Kbuild.asm  |   1 -
 include/scsi/fc/Kbuild  |   0
 include/uapi/Kbuild |  15 -
 include/uapi/asm-generic/Kbuild |  36 --
 include/uapi/asm-generic/Kbuild.asm |  76 ++---
 include/uapi/drm/Kbuild |  23 --
 include/uapi/linux/Kbuild   | 491 +---
 include/uapi/linux/android/Kbuild   |   2 -
 include/uapi/linux/byteorder/Kbuild |   3 -
 include/uapi/linux/caif/

[PATCH v11 02/12] nios2: put setup.h in uapi

2017-03-27 Thread Nicolas Dichtel
This header file is exported, but from a userland pov, it's just a wrapper
to asm-generic/setup.h.

Signed-off-by: Nicolas Dichtel 
Reviewed-by: Tobias Klauser 
---
 arch/nios2/include/uapi/asm/Kbuild | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/nios2/include/uapi/asm/Kbuild 
b/arch/nios2/include/uapi/asm/Kbuild
index e0bb972a50d7..69c965304146 100644
--- a/arch/nios2/include/uapi/asm/Kbuild
+++ b/arch/nios2/include/uapi/asm/Kbuild
@@ -2,4 +2,5 @@ include include/uapi/asm-generic/Kbuild.asm
 
 header-y += elf.h
 
+generic-y += setup.h
 generic-y += ucontext.h
-- 
2.8.1



[PATCH v11 09/12] smc_diag.h: fix include from userland

2017-03-27 Thread Nicolas Dichtel
This patch prepares the uapi export by fixing the following error:

.../linux/smc_diag.h:6:27: fatal error: rdma/ib_verbs.h: No such file or 
directory
 #include 

Signed-off-by: Nicolas Dichtel 
---
 include/rdma/ib_verbs.h   | 3 +--
 include/uapi/linux/smc_diag.h | 2 +-
 include/uapi/rdma/ib_user_verbs.h | 2 ++
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 0f1813c13687..50f276a4afdc 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -61,6 +61,7 @@
 #include 
 #include 
 #include 
+#include 
 
 extern struct workqueue_struct *ib_wq;
 extern struct workqueue_struct *ib_comp_wq;
@@ -1838,8 +1839,6 @@ enum ib_mad_result {
IB_MAD_RESULT_CONSUMED = 1 << 2  /* Packet consumed: stop processing */
 };
 
-#define IB_DEVICE_NAME_MAX 64
-
 struct ib_port_cache {
struct ib_pkey_cache  *pkey;
struct ib_gid_table   *gid;
diff --git a/include/uapi/linux/smc_diag.h b/include/uapi/linux/smc_diag.h
index 0063919fea34..87712bfaa9dd 100644
--- a/include/uapi/linux/smc_diag.h
+++ b/include/uapi/linux/smc_diag.h
@@ -3,7 +3,7 @@
 
 #include 
 #include 
-#include 
+#include 
 
 /* Request structure */
 struct smc_diag_req {
diff --git a/include/uapi/rdma/ib_user_verbs.h 
b/include/uapi/rdma/ib_user_verbs.h
index 997f904c7692..8edce2b65903 100644
--- a/include/uapi/rdma/ib_user_verbs.h
+++ b/include/uapi/rdma/ib_user_verbs.h
@@ -1124,4 +1124,6 @@ struct ib_uverbs_ex_destroy_rwq_ind_table  {
__u32 ind_tbl_handle;
 };
 
+#define IB_DEVICE_NAME_MAX 64
+
 #endif /* IB_USER_VERBS_H */
-- 
2.8.1



[PATCH v11 10/12] uapi: export all headers under uapi directories

2017-03-27 Thread Nicolas Dichtel
Regularly, when a new header is created in include/uapi/, the developer
forgets to add it in the corresponding Kbuild file. This error is usually
detected after the release is out.

In fact, all headers under uapi directories should be exported, thus it's
useless to have an exhaustive list.

After this patch, the following files, which were not exported, are now
exported (with make headers_install_all):
asm-arc/kvm_para.h
asm-arc/ucontext.h
asm-avr32/kvm_para.h
asm-blackfin/shmparam.h
asm-blackfin/ucontext.h
asm-c6x/shmparam.h
asm-c6x/ucontext.h
asm-cris/kvm_para.h
asm-h8300/shmparam.h
asm-h8300/ucontext.h
asm-hexagon/shmparam.h
asm-m32r/kvm_para.h
asm-m68k/kvm_para.h
asm-m68k/shmparam.h
asm-metag/kvm_para.h
asm-metag/shmparam.h
asm-metag/ucontext.h
asm-mips/hwcap.h
asm-mips/reg.h
asm-mips/ucontext.h
asm-nios2/kvm_para.h
asm-nios2/ucontext.h
asm-openrisc/shmparam.h
asm-parisc/kvm_para.h
asm-powerpc/perf_regs.h
asm-sh/kvm_para.h
asm-sh/ucontext.h
asm-tile/shmparam.h
asm-unicore32/shmparam.h
asm-unicore32/ucontext.h
asm-x86/hwcap2.h
asm-xtensa/kvm_para.h
drm/armada_drm.h
drm/etnaviv_drm.h
drm/vgem_drm.h
linux/auto_dev-ioctl.h
linux/bcache.h
linux/btrfs_tree.h
linux/cifs/cifs_mount.h
linux/coresight-stm.h
linux/crypto.h
linux/cryptouser.h
linux/genwqe/genwqe_card.h
linux/hash_info.h
linux/kcm.h
linux/kcov.h
linux/kfd_ioctl.h
linux/lightnvm.h
linux/module.h
linux/nilfs2_api.h
linux/nilfs2_ondisk.h
linux/nsfs.h
linux/pr.h
linux/qrtr.h
linux/rpmsg.h
linux/sched/types.h
linux/sed-opal.h
linux/smc.h
linux/smc_diag.h
linux/stm.h
linux/userio.h
linux/virtio_mmio.h
linux/wil6210_uapi.h
rdma/bnxt_re-abi.h

Note that I have removed from this list the files which are generated in every
exported directories (like .install or .install.cmd).

Thanks to Julien Floret  for the tip to get all
subdirs with a pure makefile command.

For the record, note that exported files for asm directories are a mix of
files listed by:
 - include/uapi/asm-generic/Kbuild.asm;
 - arch//include/uapi/asm/Kbuild;
 - arch//include/asm/Kbuild.

Signed-off-by: Nicolas Dichtel 
Acked-by: Daniel Vetter 
Acked-by: Russell King 
Acked-by: Mark Salter 
Acked-by: Michael Ellerman  (powerpc)
---
 Documentation/kbuild/makefiles.txt  |  66 ++--
 arch/alpha/include/uapi/asm/Kbuild  |  41 ---
 arch/arc/include/uapi/asm/Kbuild|   3 -
 arch/arm/include/uapi/asm/Kbuild|  17 -
 arch/arm64/include/uapi/asm/Kbuild  |  18 -
 arch/avr32/include/uapi/asm/Kbuild  |  20 --
 arch/blackfin/include/uapi/asm/Kbuild   |  17 -
 arch/c6x/include/uapi/asm/Kbuild|   8 -
 arch/cris/include/uapi/arch-v10/arch/Kbuild |   5 -
 arch/cris/include/uapi/arch-v32/arch/Kbuild |   3 -
 arch/cris/include/uapi/asm/Kbuild   |  43 +--
 arch/frv/include/uapi/asm/Kbuild|  33 --
 arch/h8300/include/uapi/asm/Kbuild  |  28 --
 arch/hexagon/include/asm/Kbuild |   3 -
 arch/hexagon/include/uapi/asm/Kbuild|  13 -
 arch/ia64/include/uapi/asm/Kbuild   |  45 ---
 arch/m32r/include/uapi/asm/Kbuild   |  31 --
 arch/m68k/include/uapi/asm/Kbuild   |  24 --
 arch/metag/include/uapi/asm/Kbuild  |   8 -
 arch/microblaze/include/uapi/asm/Kbuild |  32 --
 arch/mips/include/uapi/asm/Kbuild   |  37 ---
 arch/mn10300/include/uapi/asm/Kbuild|  32 --
 arch/nios2/include/uapi/asm/Kbuild  |   3 +-
 arch/openrisc/include/asm/Kbuild|   3 -
 arch/openrisc/include/uapi/asm/Kbuild   |   8 -
 arch/parisc/include/uapi/asm/Kbuild |  28 --
 arch/powerpc/include/uapi/asm/Kbuild|  45 ---
 arch/s390/include/uapi/asm/Kbuild   |  53 ---
 arch/score/include/asm/Kbuild   |   3 -
 arch/score/include/uapi/asm/Kbuild  |  32 --
 arch/sh/include/uapi/asm/Kbuild |  23 --
 arch/sparc/include/uapi/asm/Kbuild  |  48 ---
 arch/tile/include/asm/Kbuild|   3 -
 arch/tile/include/uapi/arch/Kbuild  |  17 -
 arch/tile/include/uapi/asm/Kbuild   |  19 +-
 arch/unicore32/include/uapi/asm/Kbuild  |   6 -
 arch/x86/include/uapi/asm/Kbuild|  58 
 arch/xtensa/include/uapi/asm/Kbuild |  23 --
 include/Kbuild  |   2 -
 include/asm-generic/Kbuild.asm  |   1 -
 include/scsi/fc/Kbuild  |   0
 include/uapi/Kbuild |  15 -
 include/uapi/asm-generic/Kbuild |  36 --
 include/uapi/asm-generic/Kbuild.asm |  76 ++---
 include/uapi/drm/Kbuild |  23 --
 include/uapi/linux/Kbuild   | 491 +---
 include/uapi/linux/android/Kbuild   |   2 -
 include/uapi/linux/byteorder/Kbuild |   3 -
 include/uapi/linux/caif/Kbuild  |   3 -
 include/uapi/linux/can/Kbuild   |   6 -
 include/uapi/linux/dvb/Kbuild   |   9 -
 include/uapi/linux/hdlc/Kbuild

[PATCH v11 11/12] uapi: export all arch specifics directories

2017-03-27 Thread Nicolas Dichtel
This patch removes the need of subdir-y. Now all files/directories under
arch//include/uapi/ are exported.

The only change for userland is the layout of the command 'make
headers_install_all': directories asm- are replaced by arch-/.
Those new directories contains all files/directories of the specified arch.

Note that only cris and tile have more directories than only asm:
 - arch-v[10|32] for cris;
 - arch for tile.

Signed-off-by: Nicolas Dichtel <nicolas.dich...@6wind.com>
---
 Documentation/kbuild/makefiles.txt | 15 +--
 Makefile   |  6 +++---
 arch/cris/include/uapi/asm/Kbuild  |  3 ---
 arch/tile/include/uapi/asm/Kbuild  |  2 --
 scripts/Makefile.headersinst   |  3 +--
 5 files changed, 5 insertions(+), 24 deletions(-)

diff --git a/Documentation/kbuild/makefiles.txt 
b/Documentation/kbuild/makefiles.txt
index b9f7ca4e62ae..e18daca65ccd 100644
--- a/Documentation/kbuild/makefiles.txt
+++ b/Documentation/kbuild/makefiles.txt
@@ -49,7 +49,6 @@ This document describes the Linux kernel Makefiles.
--- 7.3 generic-y
--- 7.4 generated-y
--- 7.5 mandatory-y
-   --- 7.6 subdir-y
 
=== 8 Kbuild Variables
=== 9 Makefile language
@@ -1265,7 +1264,7 @@ The pre-processing does:
 - drop all sections that are kernel internal (guarded by ifdef __KERNEL__)
 
 All headers under include/uapi/, include/generated/uapi/,
-arch//include/uapi/asm/ and arch//include/generated/uapi/asm/
+arch//include/uapi/ and arch//include/generated/uapi/
 are exported.
 
 A Kbuild file may be defined under arch//include/uapi/asm/ and
@@ -1338,18 +1337,6 @@ See subsequent chapter for the syntax of the Kbuild file.
The convention is to list one subdir per line and
preferably in alphabetic order.
 
-   --- 7.6 subdir-y
-
-   subdir-y may be used to specify a subdirectory to be exported.
-
-   Example:
-   #arch/cris/include/uapi/asm/Kbuild
-   subdir-y += ../arch-v10/arch/
-   subdir-y += ../arch-v32/arch/
-
-   The convention is to list one subdir per line and
-   preferably in alphabetic order.
-
 === 8 Kbuild Variables
 
 The top Makefile exports the following variables:
diff --git a/Makefile b/Makefile
index 6ea27d9f1384..50547481ed5a 100644
--- a/Makefile
+++ b/Makefile
@@ -1131,7 +1131,7 @@ firmware_install:
 export INSTALL_HDR_PATH = $(objtree)/usr
 
 # If we do an all arch process set dst to asm-$(hdr-arch)
-hdr-dst = $(if $(KBUILD_HEADERS), dst=include/asm-$(hdr-arch), dst=include/asm)
+hdr-dst = $(if $(KBUILD_HEADERS), dst=include/arch-$(hdr-arch), dst=include)
 
 PHONY += archheaders
 archheaders:
@@ -1152,7 +1152,7 @@ headers_install: __headers
$(if $(wildcard $(srctree)/arch/$(hdr-arch)/include/uapi/asm/Kbuild),, \
  $(error Headers not exportable for the $(SRCARCH) architecture))
$(Q)$(MAKE) $(hdr-inst)=include/uapi
-   $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi/asm $(hdr-dst)
+   $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi $(hdr-dst)
 
 PHONY += headers_check_all
 headers_check_all: headers_install_all
@@ -1161,7 +1161,7 @@ headers_check_all: headers_install_all
 PHONY += headers_check
 headers_check: headers_install
$(Q)$(MAKE) $(hdr-inst)=include/uapi HDRCHECK=1
-   $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi/asm $(hdr-dst) 
HDRCHECK=1
+   $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi/ $(hdr-dst) 
HDRCHECK=1
 
 # ---
 # Kernel selftest
diff --git a/arch/cris/include/uapi/asm/Kbuild 
b/arch/cris/include/uapi/asm/Kbuild
index d0c5471856e0..b15bf6bc0e94 100644
--- a/arch/cris/include/uapi/asm/Kbuild
+++ b/arch/cris/include/uapi/asm/Kbuild
@@ -1,5 +1,2 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
-
-subdir-y += ../arch-v10/arch/
-subdir-y += ../arch-v32/arch/
diff --git a/arch/tile/include/uapi/asm/Kbuild 
b/arch/tile/include/uapi/asm/Kbuild
index e0a50111e07f..0c74c3c5ebfa 100644
--- a/arch/tile/include/uapi/asm/Kbuild
+++ b/arch/tile/include/uapi/asm/Kbuild
@@ -2,5 +2,3 @@
 include include/uapi/asm-generic/Kbuild.asm
 
 generic-y += ucontext.h
-
-subdir-y += ../arch
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index 20be1fbc19cc..6ba97a1f9c5a 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -2,7 +2,7 @@
 # Installing headers
 #
 # All headers under include/uapi, include/generated/uapi,
-# arch//include/uapi/asm and arch//include/generated/uapi/asm are
+# arch//include/uapi and arch//include/generated/uapi are
 # exported.
 # They are preprocessed to remove __KERNEL__ section of the file.
 #
@@ -30,7 +30,6 @@ installdir:= $(INSTALL_HDR_PATH)/$(subst uapi/,,$(_dst))
 srcdir:= $(srctree)/$(obj)
 gendir:= $(objtree)/$(gen)
 subdirs   := $(pa

[PATCH v11 11/12] uapi: export all arch specifics directories

2017-03-27 Thread Nicolas Dichtel
This patch removes the need of subdir-y. Now all files/directories under
arch//include/uapi/ are exported.

The only change for userland is the layout of the command 'make
headers_install_all': directories asm- are replaced by arch-/.
Those new directories contains all files/directories of the specified arch.

Note that only cris and tile have more directories than only asm:
 - arch-v[10|32] for cris;
 - arch for tile.

Signed-off-by: Nicolas Dichtel 
---
 Documentation/kbuild/makefiles.txt | 15 +--
 Makefile   |  6 +++---
 arch/cris/include/uapi/asm/Kbuild  |  3 ---
 arch/tile/include/uapi/asm/Kbuild  |  2 --
 scripts/Makefile.headersinst   |  3 +--
 5 files changed, 5 insertions(+), 24 deletions(-)

diff --git a/Documentation/kbuild/makefiles.txt 
b/Documentation/kbuild/makefiles.txt
index b9f7ca4e62ae..e18daca65ccd 100644
--- a/Documentation/kbuild/makefiles.txt
+++ b/Documentation/kbuild/makefiles.txt
@@ -49,7 +49,6 @@ This document describes the Linux kernel Makefiles.
--- 7.3 generic-y
--- 7.4 generated-y
--- 7.5 mandatory-y
-   --- 7.6 subdir-y
 
=== 8 Kbuild Variables
=== 9 Makefile language
@@ -1265,7 +1264,7 @@ The pre-processing does:
 - drop all sections that are kernel internal (guarded by ifdef __KERNEL__)
 
 All headers under include/uapi/, include/generated/uapi/,
-arch//include/uapi/asm/ and arch//include/generated/uapi/asm/
+arch//include/uapi/ and arch//include/generated/uapi/
 are exported.
 
 A Kbuild file may be defined under arch//include/uapi/asm/ and
@@ -1338,18 +1337,6 @@ See subsequent chapter for the syntax of the Kbuild file.
The convention is to list one subdir per line and
preferably in alphabetic order.
 
-   --- 7.6 subdir-y
-
-   subdir-y may be used to specify a subdirectory to be exported.
-
-   Example:
-   #arch/cris/include/uapi/asm/Kbuild
-   subdir-y += ../arch-v10/arch/
-   subdir-y += ../arch-v32/arch/
-
-   The convention is to list one subdir per line and
-   preferably in alphabetic order.
-
 === 8 Kbuild Variables
 
 The top Makefile exports the following variables:
diff --git a/Makefile b/Makefile
index 6ea27d9f1384..50547481ed5a 100644
--- a/Makefile
+++ b/Makefile
@@ -1131,7 +1131,7 @@ firmware_install:
 export INSTALL_HDR_PATH = $(objtree)/usr
 
 # If we do an all arch process set dst to asm-$(hdr-arch)
-hdr-dst = $(if $(KBUILD_HEADERS), dst=include/asm-$(hdr-arch), dst=include/asm)
+hdr-dst = $(if $(KBUILD_HEADERS), dst=include/arch-$(hdr-arch), dst=include)
 
 PHONY += archheaders
 archheaders:
@@ -1152,7 +1152,7 @@ headers_install: __headers
$(if $(wildcard $(srctree)/arch/$(hdr-arch)/include/uapi/asm/Kbuild),, \
  $(error Headers not exportable for the $(SRCARCH) architecture))
$(Q)$(MAKE) $(hdr-inst)=include/uapi
-   $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi/asm $(hdr-dst)
+   $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi $(hdr-dst)
 
 PHONY += headers_check_all
 headers_check_all: headers_install_all
@@ -1161,7 +1161,7 @@ headers_check_all: headers_install_all
 PHONY += headers_check
 headers_check: headers_install
$(Q)$(MAKE) $(hdr-inst)=include/uapi HDRCHECK=1
-   $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi/asm $(hdr-dst) 
HDRCHECK=1
+   $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi/ $(hdr-dst) 
HDRCHECK=1
 
 # ---
 # Kernel selftest
diff --git a/arch/cris/include/uapi/asm/Kbuild 
b/arch/cris/include/uapi/asm/Kbuild
index d0c5471856e0..b15bf6bc0e94 100644
--- a/arch/cris/include/uapi/asm/Kbuild
+++ b/arch/cris/include/uapi/asm/Kbuild
@@ -1,5 +1,2 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
-
-subdir-y += ../arch-v10/arch/
-subdir-y += ../arch-v32/arch/
diff --git a/arch/tile/include/uapi/asm/Kbuild 
b/arch/tile/include/uapi/asm/Kbuild
index e0a50111e07f..0c74c3c5ebfa 100644
--- a/arch/tile/include/uapi/asm/Kbuild
+++ b/arch/tile/include/uapi/asm/Kbuild
@@ -2,5 +2,3 @@
 include include/uapi/asm-generic/Kbuild.asm
 
 generic-y += ucontext.h
-
-subdir-y += ../arch
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index 20be1fbc19cc..6ba97a1f9c5a 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -2,7 +2,7 @@
 # Installing headers
 #
 # All headers under include/uapi, include/generated/uapi,
-# arch//include/uapi/asm and arch//include/generated/uapi/asm are
+# arch//include/uapi and arch//include/generated/uapi are
 # exported.
 # They are preprocessed to remove __KERNEL__ section of the file.
 #
@@ -30,7 +30,6 @@ installdir:= $(INSTALL_HDR_PATH)/$(subst uapi/,,$(_dst))
 srcdir:= $(srctree)/$(obj)
 gendir:= $(objtree)/$(gen)
 subdirs   := $(patsubst $(srcdir)/%/.,%,$(wildcard

[PATCH v11 06/12] uapi: includes linux/types.h before exporting files

2017-03-27 Thread Nicolas Dichtel
Some files will be exported after a following patch. 0-day tests report the
following warning/error:
./usr/include/linux/bcache.h:8: include of  is preferred over 

./usr/include/linux/bcache.h:11: found __[us]{8,16,32,64} type without #include 

./usr/include/linux/qrtr.h:8: found __[us]{8,16,32,64} type without #include 

./usr/include/linux/cryptouser.h:39: found __[us]{8,16,32,64} type without 
#include 
./usr/include/linux/pr.h:14: found __[us]{8,16,32,64} type without #include 

./usr/include/linux/btrfs_tree.h:337: found __[us]{8,16,32,64} type without 
#include 
./usr/include/rdma/bnxt_re-abi.h:45: found __[us]{8,16,32,64} type without 
#include 

Signed-off-by: Nicolas Dichtel <nicolas.dich...@6wind.com>
---
 include/uapi/linux/bcache.h | 2 +-
 include/uapi/linux/btrfs_tree.h | 2 ++
 include/uapi/linux/cryptouser.h | 2 ++
 include/uapi/linux/pr.h | 2 ++
 include/uapi/linux/qrtr.h   | 1 +
 include/uapi/rdma/bnxt_re-abi.h | 2 ++
 6 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/bcache.h b/include/uapi/linux/bcache.h
index 22b6ad31c706..e3bb0635e94a 100644
--- a/include/uapi/linux/bcache.h
+++ b/include/uapi/linux/bcache.h
@@ -5,7 +5,7 @@
  * Bcache on disk data structures
  */
 
-#include 
+#include 
 
 #define BITMASK(name, type, field, offset, size)   \
 static inline __u64 name(const type *k)\
diff --git a/include/uapi/linux/btrfs_tree.h b/include/uapi/linux/btrfs_tree.h
index d5ad15a106a7..6a261cb52d95 100644
--- a/include/uapi/linux/btrfs_tree.h
+++ b/include/uapi/linux/btrfs_tree.h
@@ -1,6 +1,8 @@
 #ifndef _BTRFS_CTREE_H_
 #define _BTRFS_CTREE_H_
 
+#include 
+
 /*
  * This header contains the structure definitions and constants used
  * by file system objects that can be retrieved using
diff --git a/include/uapi/linux/cryptouser.h b/include/uapi/linux/cryptouser.h
index 11d21fce14d6..c6a09c5261e7 100644
--- a/include/uapi/linux/cryptouser.h
+++ b/include/uapi/linux/cryptouser.h
@@ -18,6 +18,8 @@
  * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+#include 
+
 /* Netlink configuration messages.  */
 enum {
CRYPTO_MSG_BASE = 0x10,
diff --git a/include/uapi/linux/pr.h b/include/uapi/linux/pr.h
index 57d7c0f916b6..645ef3cf3dd0 100644
--- a/include/uapi/linux/pr.h
+++ b/include/uapi/linux/pr.h
@@ -1,6 +1,8 @@
 #ifndef _UAPI_PR_H
 #define _UAPI_PR_H
 
+#include 
+
 enum pr_type {
PR_WRITE_EXCLUSIVE  = 1,
PR_EXCLUSIVE_ACCESS = 2,
diff --git a/include/uapi/linux/qrtr.h b/include/uapi/linux/qrtr.h
index 66c0748d26e2..9d76c566f66e 100644
--- a/include/uapi/linux/qrtr.h
+++ b/include/uapi/linux/qrtr.h
@@ -2,6 +2,7 @@
 #define _LINUX_QRTR_H
 
 #include 
+#include 
 
 struct sockaddr_qrtr {
__kernel_sa_family_t sq_family;
diff --git a/include/uapi/rdma/bnxt_re-abi.h b/include/uapi/rdma/bnxt_re-abi.h
index e2c8a3f0ccec..74018bd18d72 100644
--- a/include/uapi/rdma/bnxt_re-abi.h
+++ b/include/uapi/rdma/bnxt_re-abi.h
@@ -39,6 +39,8 @@
 #ifndef __BNXT_RE_UVERBS_ABI_H__
 #define __BNXT_RE_UVERBS_ABI_H__
 
+#include 
+
 #define BNXT_RE_ABI_VERSION1
 
 struct bnxt_re_uctx_resp {
-- 
2.8.1



[PATCH v11 07/12] btrfs_tree.h: fix include from userland

2017-03-27 Thread Nicolas Dichtel
This patch prepares the uapi export by fixing the following errors:

.../linux/btrfs_tree.h:283:2: error: #error "UUID items require BTRFS_UUID_SIZE 
== 16!"
 #error "UUID items require BTRFS_UUID_SIZE == 16!"

.../linux/btrfs_tree.h:390:12: error: ‘BTRFS_UUID_SIZE’ undeclared here (not in 
a function)
  __u8 uuid[BTRFS_UUID_SIZE];
^
.../linux/btrfs_tree.h:796:16: error: ‘BTRFS_DEV_STAT_VALUES_MAX’ undeclared 
here (not in a function)
  __le64 values[BTRFS_DEV_STAT_VALUES_MAX];

Signed-off-by: Nicolas Dichtel <nicolas.dich...@6wind.com>
---
 include/uapi/linux/btrfs_tree.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/uapi/linux/btrfs_tree.h b/include/uapi/linux/btrfs_tree.h
index 6a261cb52d95..10689e1fdf11 100644
--- a/include/uapi/linux/btrfs_tree.h
+++ b/include/uapi/linux/btrfs_tree.h
@@ -1,6 +1,7 @@
 #ifndef _BTRFS_CTREE_H_
 #define _BTRFS_CTREE_H_
 
+#include 
 #include 
 
 /*
-- 
2.8.1



[PATCH v11 04/12] Makefile.headersinst: cleanup input files

2017-03-27 Thread Nicolas Dichtel
After the last three patches, all exported headers are under uapi/, thus
input-files2 are not needed anymore.
The side effect is that input-files1-name is exactly header-y.

Note also that input-files3-name is genhdr-y.

Signed-off-by: Nicolas Dichtel <nicolas.dich...@6wind.com>
---
 scripts/Makefile.headersinst | 38 ++
 1 file changed, 14 insertions(+), 24 deletions(-)

diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index 1106d6ca3a38..7bd9df6efe2f 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -40,31 +40,20 @@ wrapper-files := $(filter $(header-y), $(generic-y))
 srcdir:= $(srctree)/$(obj)
 gendir:= $(objtree)/$(gen)
 
-oldsrcdir := $(srctree)/$(subst /uapi,,$(obj))
-
 # all headers files for this dir
 header-y  := $(filter-out $(generic-y), $(header-y))
 all-files := $(header-y) $(genhdr-y) $(wrapper-files)
 output-files  := $(addprefix $(installdir)/, $(all-files))
 
-input-files1  := $(foreach hdr, $(header-y), \
-  $(if $(wildcard $(srcdir)/$(hdr)), \
-   $(wildcard $(srcdir)/$(hdr))) \
-  )
-input-files1-name := $(notdir $(input-files1))
-input-files2  := $(foreach hdr, $(header-y), \
-  $(if  $(wildcard $(srcdir)/$(hdr)),, \
-   $(if $(wildcard $(oldsrcdir)/$(hdr)), \
-   $(wildcard $(oldsrcdir)/$(hdr)), \
-   $(error Missing UAPI file $(srcdir)/$(hdr))) \
-  ))
-input-files2-name := $(notdir $(input-files2))
-input-files3  := $(foreach hdr, $(genhdr-y), \
-  $(if $(wildcard $(gendir)/$(hdr)), \
-   $(wildcard $(gendir)/$(hdr)), \
-   $(error Missing generated UAPI file $(gendir)/$(hdr)) \
-  ))
-input-files3-name := $(notdir $(input-files3))
+# Check that all expected files exist
+$(foreach hdr, $(header-y), \
+  $(if $(wildcard $(srcdir)/$(hdr)),, \
+   $(error Missing UAPI file $(srcdir)/$(hdr)) \
+   ))
+$(foreach hdr, $(genhdr-y), \
+  $(if $(wildcard $(gendir)/$(hdr)),, \
+   $(error Missing generated UAPI file $(gendir)/$(hdr)) \
+  ))
 
 # Work out what needs to be removed
 oldheaders:= $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h))
@@ -78,9 +67,8 @@ printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@))
 quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\
 file$(if $(word 2, $(all-files)),s))
   cmd_install = \
-$(CONFIG_SHELL) $< $(installdir) $(srcdir) $(input-files1-name); \
-$(CONFIG_SHELL) $< $(installdir) $(oldsrcdir) $(input-files2-name); \
-$(CONFIG_SHELL) $< $(installdir) $(gendir) $(input-files3-name); \
+$(CONFIG_SHELL) $< $(installdir) $(srcdir) $(header-y); \
+$(CONFIG_SHELL) $< $(installdir) $(gendir) $(genhdr-y); \
 for F in $(wrapper-files); do   \
 echo "\#include " > $(installdir)/$$F;\
 done;   \
@@ -106,7 +94,9 @@ __headersinst: $(subdirs) $(install-file)
@:
 
 targets += $(install-file)
-$(install-file): scripts/headers_install.sh $(input-files1) $(input-files2) 
$(input-files3) FORCE
+$(install-file): scripts/headers_install.sh \
+$(addprefix $(srcdir)/,$(header-y)) \
+$(addprefix $(gendir)/,$(genhdr-y)) FORCE
$(if $(unwanted),$(call cmd,remove),)
$(if $(wildcard $(dir $@)),,$(shell mkdir -p $(dir $@)))
$(call if_changed,install)
-- 
2.8.1



[PATCH v11 06/12] uapi: includes linux/types.h before exporting files

2017-03-27 Thread Nicolas Dichtel
Some files will be exported after a following patch. 0-day tests report the
following warning/error:
./usr/include/linux/bcache.h:8: include of  is preferred over 

./usr/include/linux/bcache.h:11: found __[us]{8,16,32,64} type without #include 

./usr/include/linux/qrtr.h:8: found __[us]{8,16,32,64} type without #include 

./usr/include/linux/cryptouser.h:39: found __[us]{8,16,32,64} type without 
#include 
./usr/include/linux/pr.h:14: found __[us]{8,16,32,64} type without #include 

./usr/include/linux/btrfs_tree.h:337: found __[us]{8,16,32,64} type without 
#include 
./usr/include/rdma/bnxt_re-abi.h:45: found __[us]{8,16,32,64} type without 
#include 

Signed-off-by: Nicolas Dichtel 
---
 include/uapi/linux/bcache.h | 2 +-
 include/uapi/linux/btrfs_tree.h | 2 ++
 include/uapi/linux/cryptouser.h | 2 ++
 include/uapi/linux/pr.h | 2 ++
 include/uapi/linux/qrtr.h   | 1 +
 include/uapi/rdma/bnxt_re-abi.h | 2 ++
 6 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/bcache.h b/include/uapi/linux/bcache.h
index 22b6ad31c706..e3bb0635e94a 100644
--- a/include/uapi/linux/bcache.h
+++ b/include/uapi/linux/bcache.h
@@ -5,7 +5,7 @@
  * Bcache on disk data structures
  */
 
-#include 
+#include 
 
 #define BITMASK(name, type, field, offset, size)   \
 static inline __u64 name(const type *k)\
diff --git a/include/uapi/linux/btrfs_tree.h b/include/uapi/linux/btrfs_tree.h
index d5ad15a106a7..6a261cb52d95 100644
--- a/include/uapi/linux/btrfs_tree.h
+++ b/include/uapi/linux/btrfs_tree.h
@@ -1,6 +1,8 @@
 #ifndef _BTRFS_CTREE_H_
 #define _BTRFS_CTREE_H_
 
+#include 
+
 /*
  * This header contains the structure definitions and constants used
  * by file system objects that can be retrieved using
diff --git a/include/uapi/linux/cryptouser.h b/include/uapi/linux/cryptouser.h
index 11d21fce14d6..c6a09c5261e7 100644
--- a/include/uapi/linux/cryptouser.h
+++ b/include/uapi/linux/cryptouser.h
@@ -18,6 +18,8 @@
  * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+#include 
+
 /* Netlink configuration messages.  */
 enum {
CRYPTO_MSG_BASE = 0x10,
diff --git a/include/uapi/linux/pr.h b/include/uapi/linux/pr.h
index 57d7c0f916b6..645ef3cf3dd0 100644
--- a/include/uapi/linux/pr.h
+++ b/include/uapi/linux/pr.h
@@ -1,6 +1,8 @@
 #ifndef _UAPI_PR_H
 #define _UAPI_PR_H
 
+#include 
+
 enum pr_type {
PR_WRITE_EXCLUSIVE  = 1,
PR_EXCLUSIVE_ACCESS = 2,
diff --git a/include/uapi/linux/qrtr.h b/include/uapi/linux/qrtr.h
index 66c0748d26e2..9d76c566f66e 100644
--- a/include/uapi/linux/qrtr.h
+++ b/include/uapi/linux/qrtr.h
@@ -2,6 +2,7 @@
 #define _LINUX_QRTR_H
 
 #include 
+#include 
 
 struct sockaddr_qrtr {
__kernel_sa_family_t sq_family;
diff --git a/include/uapi/rdma/bnxt_re-abi.h b/include/uapi/rdma/bnxt_re-abi.h
index e2c8a3f0ccec..74018bd18d72 100644
--- a/include/uapi/rdma/bnxt_re-abi.h
+++ b/include/uapi/rdma/bnxt_re-abi.h
@@ -39,6 +39,8 @@
 #ifndef __BNXT_RE_UVERBS_ABI_H__
 #define __BNXT_RE_UVERBS_ABI_H__
 
+#include 
+
 #define BNXT_RE_ABI_VERSION1
 
 struct bnxt_re_uctx_resp {
-- 
2.8.1



[PATCH v11 07/12] btrfs_tree.h: fix include from userland

2017-03-27 Thread Nicolas Dichtel
This patch prepares the uapi export by fixing the following errors:

.../linux/btrfs_tree.h:283:2: error: #error "UUID items require BTRFS_UUID_SIZE 
== 16!"
 #error "UUID items require BTRFS_UUID_SIZE == 16!"

.../linux/btrfs_tree.h:390:12: error: ‘BTRFS_UUID_SIZE’ undeclared here (not in 
a function)
  __u8 uuid[BTRFS_UUID_SIZE];
^
.../linux/btrfs_tree.h:796:16: error: ‘BTRFS_DEV_STAT_VALUES_MAX’ undeclared 
here (not in a function)
  __le64 values[BTRFS_DEV_STAT_VALUES_MAX];

Signed-off-by: Nicolas Dichtel 
---
 include/uapi/linux/btrfs_tree.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/uapi/linux/btrfs_tree.h b/include/uapi/linux/btrfs_tree.h
index 6a261cb52d95..10689e1fdf11 100644
--- a/include/uapi/linux/btrfs_tree.h
+++ b/include/uapi/linux/btrfs_tree.h
@@ -1,6 +1,7 @@
 #ifndef _BTRFS_CTREE_H_
 #define _BTRFS_CTREE_H_
 
+#include 
 #include 
 
 /*
-- 
2.8.1



[PATCH v11 04/12] Makefile.headersinst: cleanup input files

2017-03-27 Thread Nicolas Dichtel
After the last three patches, all exported headers are under uapi/, thus
input-files2 are not needed anymore.
The side effect is that input-files1-name is exactly header-y.

Note also that input-files3-name is genhdr-y.

Signed-off-by: Nicolas Dichtel 
---
 scripts/Makefile.headersinst | 38 ++
 1 file changed, 14 insertions(+), 24 deletions(-)

diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index 1106d6ca3a38..7bd9df6efe2f 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -40,31 +40,20 @@ wrapper-files := $(filter $(header-y), $(generic-y))
 srcdir:= $(srctree)/$(obj)
 gendir:= $(objtree)/$(gen)
 
-oldsrcdir := $(srctree)/$(subst /uapi,,$(obj))
-
 # all headers files for this dir
 header-y  := $(filter-out $(generic-y), $(header-y))
 all-files := $(header-y) $(genhdr-y) $(wrapper-files)
 output-files  := $(addprefix $(installdir)/, $(all-files))
 
-input-files1  := $(foreach hdr, $(header-y), \
-  $(if $(wildcard $(srcdir)/$(hdr)), \
-   $(wildcard $(srcdir)/$(hdr))) \
-  )
-input-files1-name := $(notdir $(input-files1))
-input-files2  := $(foreach hdr, $(header-y), \
-  $(if  $(wildcard $(srcdir)/$(hdr)),, \
-   $(if $(wildcard $(oldsrcdir)/$(hdr)), \
-   $(wildcard $(oldsrcdir)/$(hdr)), \
-   $(error Missing UAPI file $(srcdir)/$(hdr))) \
-  ))
-input-files2-name := $(notdir $(input-files2))
-input-files3  := $(foreach hdr, $(genhdr-y), \
-  $(if $(wildcard $(gendir)/$(hdr)), \
-   $(wildcard $(gendir)/$(hdr)), \
-   $(error Missing generated UAPI file $(gendir)/$(hdr)) \
-  ))
-input-files3-name := $(notdir $(input-files3))
+# Check that all expected files exist
+$(foreach hdr, $(header-y), \
+  $(if $(wildcard $(srcdir)/$(hdr)),, \
+   $(error Missing UAPI file $(srcdir)/$(hdr)) \
+   ))
+$(foreach hdr, $(genhdr-y), \
+  $(if $(wildcard $(gendir)/$(hdr)),, \
+   $(error Missing generated UAPI file $(gendir)/$(hdr)) \
+  ))
 
 # Work out what needs to be removed
 oldheaders:= $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h))
@@ -78,9 +67,8 @@ printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@))
 quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\
 file$(if $(word 2, $(all-files)),s))
   cmd_install = \
-$(CONFIG_SHELL) $< $(installdir) $(srcdir) $(input-files1-name); \
-$(CONFIG_SHELL) $< $(installdir) $(oldsrcdir) $(input-files2-name); \
-$(CONFIG_SHELL) $< $(installdir) $(gendir) $(input-files3-name); \
+$(CONFIG_SHELL) $< $(installdir) $(srcdir) $(header-y); \
+$(CONFIG_SHELL) $< $(installdir) $(gendir) $(genhdr-y); \
 for F in $(wrapper-files); do   \
 echo "\#include " > $(installdir)/$$F;\
 done;   \
@@ -106,7 +94,9 @@ __headersinst: $(subdirs) $(install-file)
@:
 
 targets += $(install-file)
-$(install-file): scripts/headers_install.sh $(input-files1) $(input-files2) 
$(input-files3) FORCE
+$(install-file): scripts/headers_install.sh \
+$(addprefix $(srcdir)/,$(header-y)) \
+$(addprefix $(gendir)/,$(genhdr-y)) FORCE
$(if $(unwanted),$(call cmd,remove),)
$(if $(wildcard $(dir $@)),,$(shell mkdir -p $(dir $@)))
$(call if_changed,install)
-- 
2.8.1



[PATCH v11 05/12] Makefile.headersinst: remove destination-y option

2017-03-27 Thread Nicolas Dichtel
This option was added in commit c7bb349e7c25 ("kbuild: introduce destination-y
for exported headers") but never used in-tree.

Signed-off-by: Nicolas Dichtel <nicolas.dich...@6wind.com>
Acked-by: Paul Bolle <pebo...@tiscali.nl>
---
 Documentation/kbuild/makefiles.txt | 23 ---
 scripts/Makefile.headersinst   |  2 +-
 2 files changed, 5 insertions(+), 20 deletions(-)

diff --git a/Documentation/kbuild/makefiles.txt 
b/Documentation/kbuild/makefiles.txt
index 9b9c4797fc55..37b525d329ae 100644
--- a/Documentation/kbuild/makefiles.txt
+++ b/Documentation/kbuild/makefiles.txt
@@ -46,9 +46,8 @@ This document describes the Linux kernel Makefiles.
=== 7 Kbuild syntax for exported headers
--- 7.1 header-y
--- 7.2 genhdr-y
-   --- 7.3 destination-y
-   --- 7.4 generic-y
-   --- 7.5 generated-y
+   --- 7.3 generic-y
+   --- 7.4 generated-y
 
=== 8 Kbuild Variables
=== 9 Makefile language
@@ -1295,21 +1294,7 @@ See subsequent chapter for the syntax of the Kbuild file.
#include/linux/Kbuild
genhdr-y += version.h
 
-   --- 7.3 destination-y
-
-   When an architecture has a set of exported headers that needs to be
-   exported to a different directory destination-y is used.
-   destination-y specifies the destination directory for all exported
-   headers in the file where it is present.
-
-   Example:
-   #arch/xtensa/platforms/s6105/include/platform/Kbuild
-   destination-y := include/linux
-
-   In the example above all exported headers in the Kbuild file
-   will be located in the directory "include/linux" when exported.
-
-   --- 7.4 generic-y
+   --- 7.3 generic-y
 
If an architecture uses a verbatim copy of a header from
include/asm-generic then this is listed in the file
@@ -1336,7 +1321,7 @@ See subsequent chapter for the syntax of the Kbuild file.
Example: termios.h
#include 
 
-   --- 7.5 generated-y
+   --- 7.4 generated-y
 
If an architecture generates other header files alongside generic-y
wrappers, and not included in genhdr-y, then generated-y specifies
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index 7bd9df6efe2f..ca5d439c9abf 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -14,7 +14,7 @@ kbuild-file := $(srctree)/$(obj)/Kbuild
 include $(kbuild-file)
 
 # called may set destination dir (when installing to asm/)
-_dst := $(if $(destination-y),$(destination-y),$(if $(dst),$(dst),$(obj)))
+_dst := $(if $(dst),$(dst),$(obj))
 
 old-kbuild-file := $(srctree)/$(subst uapi/,,$(obj))/Kbuild
 ifneq ($(wildcard $(old-kbuild-file)),)
-- 
2.8.1



[PATCH v11 05/12] Makefile.headersinst: remove destination-y option

2017-03-27 Thread Nicolas Dichtel
This option was added in commit c7bb349e7c25 ("kbuild: introduce destination-y
for exported headers") but never used in-tree.

Signed-off-by: Nicolas Dichtel 
Acked-by: Paul Bolle 
---
 Documentation/kbuild/makefiles.txt | 23 ---
 scripts/Makefile.headersinst   |  2 +-
 2 files changed, 5 insertions(+), 20 deletions(-)

diff --git a/Documentation/kbuild/makefiles.txt 
b/Documentation/kbuild/makefiles.txt
index 9b9c4797fc55..37b525d329ae 100644
--- a/Documentation/kbuild/makefiles.txt
+++ b/Documentation/kbuild/makefiles.txt
@@ -46,9 +46,8 @@ This document describes the Linux kernel Makefiles.
=== 7 Kbuild syntax for exported headers
--- 7.1 header-y
--- 7.2 genhdr-y
-   --- 7.3 destination-y
-   --- 7.4 generic-y
-   --- 7.5 generated-y
+   --- 7.3 generic-y
+   --- 7.4 generated-y
 
=== 8 Kbuild Variables
=== 9 Makefile language
@@ -1295,21 +1294,7 @@ See subsequent chapter for the syntax of the Kbuild file.
#include/linux/Kbuild
genhdr-y += version.h
 
-   --- 7.3 destination-y
-
-   When an architecture has a set of exported headers that needs to be
-   exported to a different directory destination-y is used.
-   destination-y specifies the destination directory for all exported
-   headers in the file where it is present.
-
-   Example:
-   #arch/xtensa/platforms/s6105/include/platform/Kbuild
-   destination-y := include/linux
-
-   In the example above all exported headers in the Kbuild file
-   will be located in the directory "include/linux" when exported.
-
-   --- 7.4 generic-y
+   --- 7.3 generic-y
 
If an architecture uses a verbatim copy of a header from
include/asm-generic then this is listed in the file
@@ -1336,7 +1321,7 @@ See subsequent chapter for the syntax of the Kbuild file.
Example: termios.h
#include 
 
-   --- 7.5 generated-y
+   --- 7.4 generated-y
 
If an architecture generates other header files alongside generic-y
wrappers, and not included in genhdr-y, then generated-y specifies
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index 7bd9df6efe2f..ca5d439c9abf 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -14,7 +14,7 @@ kbuild-file := $(srctree)/$(obj)/Kbuild
 include $(kbuild-file)
 
 # called may set destination dir (when installing to asm/)
-_dst := $(if $(destination-y),$(destination-y),$(if $(dst),$(dst),$(obj)))
+_dst := $(if $(dst),$(dst),$(obj))
 
 old-kbuild-file := $(srctree)/$(subst uapi/,,$(obj))/Kbuild
 ifneq ($(wildcard $(old-kbuild-file)),)
-- 
2.8.1



[PATCH v11 03/12] x86: stop exporting msr-index.h to userland

2017-03-27 Thread Nicolas Dichtel
Even if this file was not in an uapi directory, it was exported because
it was listed in the Kbuild file.

Fixes: b72e7464e4cf ("x86/uapi: Do not export  as part of the 
user API headers")
Suggested-by: Borislav Petkov <b...@alien8.de>
CC: Ingo Molnar <mi...@kernel.org>
Signed-off-by: Nicolas Dichtel <nicolas.dich...@6wind.com>
Acked-by: Ingo Molnar <mi...@kernel.org>
Acked-by: Thomas Gleixner <t...@linutronix.de>
---
 arch/x86/include/uapi/asm/Kbuild | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/x86/include/uapi/asm/Kbuild b/arch/x86/include/uapi/asm/Kbuild
index 3dec769cadf7..1c532b3f18ea 100644
--- a/arch/x86/include/uapi/asm/Kbuild
+++ b/arch/x86/include/uapi/asm/Kbuild
@@ -27,7 +27,6 @@ header-y += ldt.h
 header-y += mce.h
 header-y += mman.h
 header-y += msgbuf.h
-header-y += msr-index.h
 header-y += msr.h
 header-y += mtrr.h
 header-y += param.h
-- 
2.8.1



[PATCH v11 00/12] uapi: export all headers under uapi directories

2017-03-27 Thread Nicolas Dichtel


Patches #1 and #2 are just cleanup: some exported headers were still under
a non-uapi directory. Patch #3 is a fix to avoid exporting a file that was
not under an uapi directory.
After these three patches, all exported headers are under an uapi directory:
path #4 stops searching files in non uapi directories.
The patch #5 was spotted by code review: there is no in-tree user of this
functionality.
Patch #6 fixes some warnings/errors reported by 0-day tests.
Patch #7 to #9 fix some errors when the corresponding files are included by
userland.
Patches #10 and #11 remove the need to list explicitly headers. Now all files
under an uapi directory are exported.
Patch #12 is also a small cleanup.

This series has been tested with a 'make headers_install' on x86 and a
'make headers_install_all'. I've checked the result of both commands.

This patch is built on top of masahiroy/linux-kbuild.git#for-next (v4.11-rc1).
I didn't find any conflict with v4.11-rc4.

v10 -> v11:
  - patch #1: restore the double '_' in the header guard
  - patch #6, #7, #8: order '#include' in alphabetical order 
  - patch #10: rename header-n to no-export-headers
   cleanup management of kvm.h, kvm_para.h and a.out.h
  - patch #12: add it
  - rebase on top of masahiroy/linux-kbuild.git#for-next

v9 -> v10:
  - rebase on top of masahiroy/linux-kbuild.git#for-next
  - patch #4 & #10: fix dependency check
  - fix some typos in commits logs

v8 -> v9:
  - rebase on top of linus tree
  - patch #8: add include/uapi/linux/crypto.h

v7 -> v8:
  - rebase on top of linus tree
  - add patch #7, #8 and #9

v6 -> v7:
  - rebase on top of linus tree
  - patch #7: remove autogenerated files from the list in the commit log

v5 -> v6:
  - patch #6: remove change of include/uapi/linux/media.h
  - patch #7: fix hdr export when 'make O=' is used (look for genhdr files in
  the right directory)
  - patch #8: fix 'make headers_check'

v4 -> v5:
  - patch #3: get back to v3 (don't export msr-index.h)
  - patch #6: new in this version
  - patch #7: fix compilation by introducing header-n

v3 -> v4:
 - first patch has been included
 - patch #4: get back to v2 and remove arch/x86/include/asm/msr-index.h

v2 -> v3:
 - patch #1: remove arch/arm/include/asm/types.h
 - patch #2: remove arch/h8300/include/asm/bitsperlong.h
 - patch #3: remove arch/nios2/include/uapi/asm/setup.h
 - patch #4: don't export msr-index.h
 - patch #5: fix a typo: s/unput-files3-name/input-files3-name
 - patch #6: no change
 - patch #7: fix include/uapi/asm-generic/Kbuild.asm by introducing mandatory-y
 - add patch #8

v1 -> v2:
 - add patch #1 to #6
 - patch #7: remove use of header-y

Comments are welcomed,
Nicolas


[PATCH v11 01/12] h8300: put bitsperlong.h in uapi

2017-03-27 Thread Nicolas Dichtel
This header file is exported, thus move it to uapi.

Signed-off-by: Nicolas Dichtel <nicolas.dich...@6wind.com>
---
 arch/h8300/include/asm/bitsperlong.h  | 14 --
 arch/h8300/include/uapi/asm/bitsperlong.h | 14 ++
 2 files changed, 14 insertions(+), 14 deletions(-)
 delete mode 100644 arch/h8300/include/asm/bitsperlong.h
 create mode 100644 arch/h8300/include/uapi/asm/bitsperlong.h

diff --git a/arch/h8300/include/asm/bitsperlong.h 
b/arch/h8300/include/asm/bitsperlong.h
deleted file mode 100644
index e140e46729ac..
--- a/arch/h8300/include/asm/bitsperlong.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef __ASM_H8300_BITS_PER_LONG
-#define __ASM_H8300_BITS_PER_LONG
-
-#include 
-
-#if !defined(__ASSEMBLY__)
-/* h8300-unknown-linux required long */
-#define __kernel_size_t __kernel_size_t
-typedef unsigned long  __kernel_size_t;
-typedef long   __kernel_ssize_t;
-typedef long   __kernel_ptrdiff_t;
-#endif
-
-#endif /* __ASM_H8300_BITS_PER_LONG */
diff --git a/arch/h8300/include/uapi/asm/bitsperlong.h 
b/arch/h8300/include/uapi/asm/bitsperlong.h
new file mode 100644
index ..34212608371e
--- /dev/null
+++ b/arch/h8300/include/uapi/asm/bitsperlong.h
@@ -0,0 +1,14 @@
+#ifndef _UAPI__ASM_H8300_BITS_PER_LONG
+#define _UAPI__ASM_H8300_BITS_PER_LONG
+
+#include 
+
+#if !defined(__ASSEMBLY__)
+/* h8300-unknown-linux required long */
+#define __kernel_size_t __kernel_size_t
+typedef unsigned long  __kernel_size_t;
+typedef long   __kernel_ssize_t;
+typedef long   __kernel_ptrdiff_t;
+#endif
+
+#endif /* _UAPI__ASM_H8300_BITS_PER_LONG */
-- 
2.8.1



[PATCH v11 03/12] x86: stop exporting msr-index.h to userland

2017-03-27 Thread Nicolas Dichtel
Even if this file was not in an uapi directory, it was exported because
it was listed in the Kbuild file.

Fixes: b72e7464e4cf ("x86/uapi: Do not export  as part of the 
user API headers")
Suggested-by: Borislav Petkov 
CC: Ingo Molnar 
Signed-off-by: Nicolas Dichtel 
Acked-by: Ingo Molnar 
Acked-by: Thomas Gleixner 
---
 arch/x86/include/uapi/asm/Kbuild | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/x86/include/uapi/asm/Kbuild b/arch/x86/include/uapi/asm/Kbuild
index 3dec769cadf7..1c532b3f18ea 100644
--- a/arch/x86/include/uapi/asm/Kbuild
+++ b/arch/x86/include/uapi/asm/Kbuild
@@ -27,7 +27,6 @@ header-y += ldt.h
 header-y += mce.h
 header-y += mman.h
 header-y += msgbuf.h
-header-y += msr-index.h
 header-y += msr.h
 header-y += mtrr.h
 header-y += param.h
-- 
2.8.1



[PATCH v11 00/12] uapi: export all headers under uapi directories

2017-03-27 Thread Nicolas Dichtel


Patches #1 and #2 are just cleanup: some exported headers were still under
a non-uapi directory. Patch #3 is a fix to avoid exporting a file that was
not under an uapi directory.
After these three patches, all exported headers are under an uapi directory:
path #4 stops searching files in non uapi directories.
The patch #5 was spotted by code review: there is no in-tree user of this
functionality.
Patch #6 fixes some warnings/errors reported by 0-day tests.
Patch #7 to #9 fix some errors when the corresponding files are included by
userland.
Patches #10 and #11 remove the need to list explicitly headers. Now all files
under an uapi directory are exported.
Patch #12 is also a small cleanup.

This series has been tested with a 'make headers_install' on x86 and a
'make headers_install_all'. I've checked the result of both commands.

This patch is built on top of masahiroy/linux-kbuild.git#for-next (v4.11-rc1).
I didn't find any conflict with v4.11-rc4.

v10 -> v11:
  - patch #1: restore the double '_' in the header guard
  - patch #6, #7, #8: order '#include' in alphabetical order 
  - patch #10: rename header-n to no-export-headers
   cleanup management of kvm.h, kvm_para.h and a.out.h
  - patch #12: add it
  - rebase on top of masahiroy/linux-kbuild.git#for-next

v9 -> v10:
  - rebase on top of masahiroy/linux-kbuild.git#for-next
  - patch #4 & #10: fix dependency check
  - fix some typos in commits logs

v8 -> v9:
  - rebase on top of linus tree
  - patch #8: add include/uapi/linux/crypto.h

v7 -> v8:
  - rebase on top of linus tree
  - add patch #7, #8 and #9

v6 -> v7:
  - rebase on top of linus tree
  - patch #7: remove autogenerated files from the list in the commit log

v5 -> v6:
  - patch #6: remove change of include/uapi/linux/media.h
  - patch #7: fix hdr export when 'make O=' is used (look for genhdr files in
  the right directory)
  - patch #8: fix 'make headers_check'

v4 -> v5:
  - patch #3: get back to v3 (don't export msr-index.h)
  - patch #6: new in this version
  - patch #7: fix compilation by introducing header-n

v3 -> v4:
 - first patch has been included
 - patch #4: get back to v2 and remove arch/x86/include/asm/msr-index.h

v2 -> v3:
 - patch #1: remove arch/arm/include/asm/types.h
 - patch #2: remove arch/h8300/include/asm/bitsperlong.h
 - patch #3: remove arch/nios2/include/uapi/asm/setup.h
 - patch #4: don't export msr-index.h
 - patch #5: fix a typo: s/unput-files3-name/input-files3-name
 - patch #6: no change
 - patch #7: fix include/uapi/asm-generic/Kbuild.asm by introducing mandatory-y
 - add patch #8

v1 -> v2:
 - add patch #1 to #6
 - patch #7: remove use of header-y

Comments are welcomed,
Nicolas


[PATCH v11 01/12] h8300: put bitsperlong.h in uapi

2017-03-27 Thread Nicolas Dichtel
This header file is exported, thus move it to uapi.

Signed-off-by: Nicolas Dichtel 
---
 arch/h8300/include/asm/bitsperlong.h  | 14 --
 arch/h8300/include/uapi/asm/bitsperlong.h | 14 ++
 2 files changed, 14 insertions(+), 14 deletions(-)
 delete mode 100644 arch/h8300/include/asm/bitsperlong.h
 create mode 100644 arch/h8300/include/uapi/asm/bitsperlong.h

diff --git a/arch/h8300/include/asm/bitsperlong.h 
b/arch/h8300/include/asm/bitsperlong.h
deleted file mode 100644
index e140e46729ac..
--- a/arch/h8300/include/asm/bitsperlong.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef __ASM_H8300_BITS_PER_LONG
-#define __ASM_H8300_BITS_PER_LONG
-
-#include 
-
-#if !defined(__ASSEMBLY__)
-/* h8300-unknown-linux required long */
-#define __kernel_size_t __kernel_size_t
-typedef unsigned long  __kernel_size_t;
-typedef long   __kernel_ssize_t;
-typedef long   __kernel_ptrdiff_t;
-#endif
-
-#endif /* __ASM_H8300_BITS_PER_LONG */
diff --git a/arch/h8300/include/uapi/asm/bitsperlong.h 
b/arch/h8300/include/uapi/asm/bitsperlong.h
new file mode 100644
index ..34212608371e
--- /dev/null
+++ b/arch/h8300/include/uapi/asm/bitsperlong.h
@@ -0,0 +1,14 @@
+#ifndef _UAPI__ASM_H8300_BITS_PER_LONG
+#define _UAPI__ASM_H8300_BITS_PER_LONG
+
+#include 
+
+#if !defined(__ASSEMBLY__)
+/* h8300-unknown-linux required long */
+#define __kernel_size_t __kernel_size_t
+typedef unsigned long  __kernel_size_t;
+typedef long   __kernel_ssize_t;
+typedef long   __kernel_ptrdiff_t;
+#endif
+
+#endif /* _UAPI__ASM_H8300_BITS_PER_LONG */
-- 
2.8.1



[PATCH v11 08/12] cryptouser.h: fix include from userland

2017-03-27 Thread Nicolas Dichtel
This patch prepares the uapi export by fixing the following error:

.../linux/cryptouser.h:58:16: error: ‘CRYPTO_MAX_ALG_NAME’ undeclared here (not 
in a function)
  char cru_name[CRYPTO_MAX_ALG_NAME];

Signed-off-by: Nicolas Dichtel <nicolas.dich...@6wind.com>
Acked-by: Herbert Xu <herb...@gondor.apana.org.au>
---
 include/linux/crypto.h  |  2 +-
 include/uapi/linux/crypto.h | 14 ++
 include/uapi/linux/cryptouser.h |  6 ++
 3 files changed, 21 insertions(+), 1 deletion(-)
 create mode 100644 include/uapi/linux/crypto.h

diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index c0b0cf3d2d2f..cc2425ba8527 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /*
  * Autoloaded crypto modules should only use a prefixed name to avoid allowing
@@ -123,7 +124,6 @@
 /*
  * Miscellaneous stuff.
  */
-#define CRYPTO_MAX_ALG_NAME64
 
 /*
  * The macro CRYPTO_MINALIGN_ATTR (along with the void * type in the actual
diff --git a/include/uapi/linux/crypto.h b/include/uapi/linux/crypto.h
new file mode 100644
index ..e342c5a5ac50
--- /dev/null
+++ b/include/uapi/linux/crypto.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright (c) 2017 Nicolas Dichtel <nicolas.dich...@6wind.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ */
+
+#ifndef _UAPI_CRYPTO_H
+#define _UAPI_CRYPTO_H
+
+#define CRYPTO_MAX_ALG_NAME64
+
+#endif /* _UAPI_CRYPTO_H */
diff --git a/include/uapi/linux/cryptouser.h b/include/uapi/linux/cryptouser.h
index c6a09c5261e7..751e7daef54a 100644
--- a/include/uapi/linux/cryptouser.h
+++ b/include/uapi/linux/cryptouser.h
@@ -18,6 +18,10 @@
  * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+#ifndef _UAPI_CRYPTOUSER_H
+#define _UAPI_CRYPTOUSER_H
+
+#include 
 #include 
 
 /* Netlink configuration messages.  */
@@ -121,3 +125,5 @@ struct crypto_report_acomp {
 
 #define CRYPTO_REPORT_MAXSIZE (sizeof(struct crypto_user_alg) + \
   sizeof(struct crypto_report_blkcipher))
+
+#endif /* _UAPI_CRYPTOUSER_H */
-- 
2.8.1



[PATCH v11 08/12] cryptouser.h: fix include from userland

2017-03-27 Thread Nicolas Dichtel
This patch prepares the uapi export by fixing the following error:

.../linux/cryptouser.h:58:16: error: ‘CRYPTO_MAX_ALG_NAME’ undeclared here (not 
in a function)
  char cru_name[CRYPTO_MAX_ALG_NAME];

Signed-off-by: Nicolas Dichtel 
Acked-by: Herbert Xu 
---
 include/linux/crypto.h  |  2 +-
 include/uapi/linux/crypto.h | 14 ++
 include/uapi/linux/cryptouser.h |  6 ++
 3 files changed, 21 insertions(+), 1 deletion(-)
 create mode 100644 include/uapi/linux/crypto.h

diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index c0b0cf3d2d2f..cc2425ba8527 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /*
  * Autoloaded crypto modules should only use a prefixed name to avoid allowing
@@ -123,7 +124,6 @@
 /*
  * Miscellaneous stuff.
  */
-#define CRYPTO_MAX_ALG_NAME64
 
 /*
  * The macro CRYPTO_MINALIGN_ATTR (along with the void * type in the actual
diff --git a/include/uapi/linux/crypto.h b/include/uapi/linux/crypto.h
new file mode 100644
index ..e342c5a5ac50
--- /dev/null
+++ b/include/uapi/linux/crypto.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright (c) 2017 Nicolas Dichtel 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ */
+
+#ifndef _UAPI_CRYPTO_H
+#define _UAPI_CRYPTO_H
+
+#define CRYPTO_MAX_ALG_NAME64
+
+#endif /* _UAPI_CRYPTO_H */
diff --git a/include/uapi/linux/cryptouser.h b/include/uapi/linux/cryptouser.h
index c6a09c5261e7..751e7daef54a 100644
--- a/include/uapi/linux/cryptouser.h
+++ b/include/uapi/linux/cryptouser.h
@@ -18,6 +18,10 @@
  * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+#ifndef _UAPI_CRYPTOUSER_H
+#define _UAPI_CRYPTOUSER_H
+
+#include 
 #include 
 
 /* Netlink configuration messages.  */
@@ -121,3 +125,5 @@ struct crypto_report_acomp {
 
 #define CRYPTO_REPORT_MAXSIZE (sizeof(struct crypto_user_alg) + \
   sizeof(struct crypto_report_blkcipher))
+
+#endif /* _UAPI_CRYPTOUSER_H */
-- 
2.8.1



Re: [PATCH v10 11/11] uapi: export all arch specifics directories

2017-03-27 Thread Nicolas Dichtel
Hi Masahiro,

Le 27/03/2017 à 07:27, Masahiro Yamada a écrit :
> Hi Nicolas,
> 
> 
> 2017-03-14 21:54 GMT+09:00 Nicolas Dichtel <nicolas.dich...@6wind.com>:
>> diff --git a/arch/cris/include/uapi/asm/Kbuild 
>> b/arch/cris/include/uapi/asm/Kbuild
>> index d0c5471856e0..b15bf6bc0e94 100644
>> --- a/arch/cris/include/uapi/asm/Kbuild
>> +++ b/arch/cris/include/uapi/asm/Kbuild
>> @@ -1,5 +1,2 @@
>>  # UAPI Header export list
>>  include include/uapi/asm-generic/Kbuild.asm
>> -
>> -subdir-y += ../arch-v10/arch/
>> -subdir-y += ../arch-v32/arch/
> 
> 
> Can you remove
> arch/cris/include/arch-v32/arch/Kbuild
> arch/cris/include/arch-v10/arch/Kbuild
> as well?
Ok.

> 
> Or, not sure if they are still needed?
I don't think so. Have a look to 77c8006d8df4 ("UAPI: Fix up empty files in
arch/cris/") for more details.

> 
> 
> 
>> diff --git a/arch/tile/include/uapi/asm/Kbuild 
>> b/arch/tile/include/uapi/asm/Kbuild
>> index e0a50111e07f..0c74c3c5ebfa 100644
>> --- a/arch/tile/include/uapi/asm/Kbuild
>> +++ b/arch/tile/include/uapi/asm/Kbuild
>> @@ -2,5 +2,3 @@
>>  include include/uapi/asm-generic/Kbuild.asm
>>
>>  generic-y += ucontext.h
>> -
>> -subdir-y += ../arch
> 
> Can you remove  arch/tile/include/arch/Kbuild as well?
Ok.

Because this removal is not directly related to this patch, I will add another
patch in the series.

Regards,
Nicolas


Re: [PATCH v10 11/11] uapi: export all arch specifics directories

2017-03-27 Thread Nicolas Dichtel
Hi Masahiro,

Le 27/03/2017 à 07:27, Masahiro Yamada a écrit :
> Hi Nicolas,
> 
> 
> 2017-03-14 21:54 GMT+09:00 Nicolas Dichtel :
>> diff --git a/arch/cris/include/uapi/asm/Kbuild 
>> b/arch/cris/include/uapi/asm/Kbuild
>> index d0c5471856e0..b15bf6bc0e94 100644
>> --- a/arch/cris/include/uapi/asm/Kbuild
>> +++ b/arch/cris/include/uapi/asm/Kbuild
>> @@ -1,5 +1,2 @@
>>  # UAPI Header export list
>>  include include/uapi/asm-generic/Kbuild.asm
>> -
>> -subdir-y += ../arch-v10/arch/
>> -subdir-y += ../arch-v32/arch/
> 
> 
> Can you remove
> arch/cris/include/arch-v32/arch/Kbuild
> arch/cris/include/arch-v10/arch/Kbuild
> as well?
Ok.

> 
> Or, not sure if they are still needed?
I don't think so. Have a look to 77c8006d8df4 ("UAPI: Fix up empty files in
arch/cris/") for more details.

> 
> 
> 
>> diff --git a/arch/tile/include/uapi/asm/Kbuild 
>> b/arch/tile/include/uapi/asm/Kbuild
>> index e0a50111e07f..0c74c3c5ebfa 100644
>> --- a/arch/tile/include/uapi/asm/Kbuild
>> +++ b/arch/tile/include/uapi/asm/Kbuild
>> @@ -2,5 +2,3 @@
>>  include include/uapi/asm-generic/Kbuild.asm
>>
>>  generic-y += ucontext.h
>> -
>> -subdir-y += ../arch
> 
> Can you remove  arch/tile/include/arch/Kbuild as well?
Ok.

Because this removal is not directly related to this patch, I will add another
patch in the series.

Regards,
Nicolas


Re: [PATCH v10 01/11] h8300: put bitsperlong.h in uapi

2017-03-27 Thread Nicolas Dichtel
Le 27/03/2017 à 07:31, Masahiro Yamada a écrit :
[snip]
>> -#endif /* __ASM_H8300_BITS_PER_LONG */
>> diff --git a/arch/h8300/include/uapi/asm/bitsperlong.h 
>> b/arch/h8300/include/uapi/asm/bitsperlong.h
>> new file mode 100644
>> index ..e56cf72369b6
>> --- /dev/null
>> +++ b/arch/h8300/include/uapi/asm/bitsperlong.h
>> @@ -0,0 +1,14 @@
>> +#ifndef _UAPI_ASM_H8300_BITS_PER_LONG
>> +#define _UAPI_ASM_H8300_BITS_PER_LONG
> 
> 
> Just a minor comment.
> 
> The include guard was originally __ASM_H8300_BITS_PER_LONG.
> This will change it into _ASM_H8300_BITS_PER_LONG
> (after _UAPI is stripped by headers_install.sh)
> 
> I just thought _UAPI__ASM_H8300_BITS_PER_LONG might be even safer,
> but I know I am nit-picking.  I can apply this as-is.
> I leave it to you.
I intentionnaly "clean" that, but I will restore it, no problem ;-)


Regards,
Nicolas


Re: [PATCH v10 01/11] h8300: put bitsperlong.h in uapi

2017-03-27 Thread Nicolas Dichtel
Le 27/03/2017 à 07:31, Masahiro Yamada a écrit :
[snip]
>> -#endif /* __ASM_H8300_BITS_PER_LONG */
>> diff --git a/arch/h8300/include/uapi/asm/bitsperlong.h 
>> b/arch/h8300/include/uapi/asm/bitsperlong.h
>> new file mode 100644
>> index ..e56cf72369b6
>> --- /dev/null
>> +++ b/arch/h8300/include/uapi/asm/bitsperlong.h
>> @@ -0,0 +1,14 @@
>> +#ifndef _UAPI_ASM_H8300_BITS_PER_LONG
>> +#define _UAPI_ASM_H8300_BITS_PER_LONG
> 
> 
> Just a minor comment.
> 
> The include guard was originally __ASM_H8300_BITS_PER_LONG.
> This will change it into _ASM_H8300_BITS_PER_LONG
> (after _UAPI is stripped by headers_install.sh)
> 
> I just thought _UAPI__ASM_H8300_BITS_PER_LONG might be even safer,
> but I know I am nit-picking.  I can apply this as-is.
> I leave it to you.
I intentionnaly "clean" that, but I will restore it, no problem ;-)


Regards,
Nicolas


Re: [PATCH v10 00/11] uapi: export all headers under uapi directories

2017-03-27 Thread Nicolas Dichtel
Hi Masahiro,

Le 27/03/2017 à 07:26, Masahiro Yamada a écrit :
> Hi Nocolas,
> 
> 
> 2017-03-24 18:03 GMT+09:00 Nicolas Dichtel <nicolas.dich...@6wind.com>:
[snip]
> 
> 
> As a whole, this series is amazing.  Thanks for your great work!
Thank you. And thank you for taking time to review it.

> 
> 
> I added some comments, but they are trivial.
> 
> 
> 
> 
> I wanted to leave comments/questions on 10/11,
> but I could not find 10/11 in my mailbox.  I do not know why.
Note that you can download the mail from the kbuild patchwork, open it with your
email client and do a reply ;-)

> 
> 
> I am leaving comments on the cover-letter,
> the following are related to 10/11.
> 
> 
> 
> [1]
> 
>> mandatory-y += $(foreach hdr,$(opt-header), \
>>  $(if \
>>$(wildcard \
>>$(srctree)/arch/$(SRCARCH)/include/uapi/asm/$(hdr) \
>>$(srctree)/arch/$(SRCARCH)/include/asm/$(hdr) \
>>), \
>>$(hdr) \
>>))
> 
> What is this actually checking?
> 
> If ARCH has its own (uapi/)asm/{kvm.h,kvm_para.h,a.out.h},
> they are added to mandatory-y, then they are checked if they exist.
> But, we know they exist.
Yes, you're right. With english words : 'those files are mandatory only if they
exist', thus they are not mandatory at all :)

> 
> 
> This check reminds us only when we added asm/*.h
> but forgot to add uapi/asm/*.h
> 
> $(srctree)/arch/$(SRCARCH)/include/uapi/asm/$(hdr) seems unneeded at least.
> (perhaps, the whole hunk might be unneeded.)
I think we can remove the whole hunk (see also [2]).

> 
> 
> 
> [2]
> 
>> ifeq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/a.out.h \
>> $(srctree)/arch/$(SRCARCH)/include/asm/a.out.h),)
>> header-n += a.out.h
>> endif
>>
>> ifeq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/kvm.h \
>> $(srctree)/arch/$(SRCARCH)/include/asm/kvm.h),)
>> header-n += kvm.h
>> endif
>>
>> ifeq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/kvm_para.h \
>> $(srctree)/arch/$(SRCARCH)/include/asm/kvm_para.h),)
>> header-n += kvm_para.h
>> endif
> 
> This series intends all headers are exported from uapi/, correct?
> Do we still need to check $(srctree)/arch/$(SRCARCH)/include/asm/*.h ?
> (related to [1])
No you're right, uapi/asm/*.h is enough. Those files should be exported only if
the uapi/asm/ counterpart exists.

> 
> 
> 
> [3]
> 
>> --- 7.1 header-n
>>
>> header-n is essentially used by include/uapi/linux/Kbuild to avoid
>> exporting specific headers (e.g. kvm.h) on architectures that do not
>> support it. It should be avoided as much as possible.
> 
> 
> Going forward, header-y will be never used
> because uapi/ is exported by default.
> 
> So, I wonder if we could rename this into something clearer.
> 
> Kbuild supports "no-clean-files".
> (Please see ./Kbuild for its usage)
> I guess this notation seems clearer
> when we want to negate the default behavior.
> 
> Can you consider "no-export", "no-export-files", "no-export-headers"
> or whatever you like?
No problem, let's use no-export-headers.


Thank you,
Nicolas


Re: [PATCH v10 07/11] btrfs_tree.h: fix include from userland

2017-03-27 Thread Nicolas Dichtel
Hi Masahiro,

Le 27/03/2017 à 07:53, Masahiro Yamada a écrit :
> Hi Nicolas,
> 
> 
> 2017-03-14 21:54 GMT+09:00 Nicolas Dichtel <nicolas.dich...@6wind.com>:
[snip]
>> diff --git a/include/uapi/linux/btrfs_tree.h 
>> b/include/uapi/linux/btrfs_tree.h
>> index 6a261cb52d95..6a754ada59af 100644
>> --- a/include/uapi/linux/btrfs_tree.h
>> +++ b/include/uapi/linux/btrfs_tree.h
>> @@ -2,6 +2,7 @@
>>  #define _BTRFS_CTREE_H_
>>
>>  #include 
>> +#include 
>>
> 
> Can you move  below 
> to sort the includes alphabetically?
Ok.

> 
> This also applies to:
> 
> include/uapi/linux/qrtr.h in 06/11
> include/uapi/linux/cryptouser.h  in 08/11
Ok.


Regards,
Nicolas


Re: [PATCH v10 00/11] uapi: export all headers under uapi directories

2017-03-27 Thread Nicolas Dichtel
Hi Masahiro,

Le 27/03/2017 à 07:26, Masahiro Yamada a écrit :
> Hi Nocolas,
> 
> 
> 2017-03-24 18:03 GMT+09:00 Nicolas Dichtel :
[snip]
> 
> 
> As a whole, this series is amazing.  Thanks for your great work!
Thank you. And thank you for taking time to review it.

> 
> 
> I added some comments, but they are trivial.
> 
> 
> 
> 
> I wanted to leave comments/questions on 10/11,
> but I could not find 10/11 in my mailbox.  I do not know why.
Note that you can download the mail from the kbuild patchwork, open it with your
email client and do a reply ;-)

> 
> 
> I am leaving comments on the cover-letter,
> the following are related to 10/11.
> 
> 
> 
> [1]
> 
>> mandatory-y += $(foreach hdr,$(opt-header), \
>>  $(if \
>>$(wildcard \
>>$(srctree)/arch/$(SRCARCH)/include/uapi/asm/$(hdr) \
>>$(srctree)/arch/$(SRCARCH)/include/asm/$(hdr) \
>>), \
>>$(hdr) \
>>))
> 
> What is this actually checking?
> 
> If ARCH has its own (uapi/)asm/{kvm.h,kvm_para.h,a.out.h},
> they are added to mandatory-y, then they are checked if they exist.
> But, we know they exist.
Yes, you're right. With english words : 'those files are mandatory only if they
exist', thus they are not mandatory at all :)

> 
> 
> This check reminds us only when we added asm/*.h
> but forgot to add uapi/asm/*.h
> 
> $(srctree)/arch/$(SRCARCH)/include/uapi/asm/$(hdr) seems unneeded at least.
> (perhaps, the whole hunk might be unneeded.)
I think we can remove the whole hunk (see also [2]).

> 
> 
> 
> [2]
> 
>> ifeq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/a.out.h \
>> $(srctree)/arch/$(SRCARCH)/include/asm/a.out.h),)
>> header-n += a.out.h
>> endif
>>
>> ifeq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/kvm.h \
>> $(srctree)/arch/$(SRCARCH)/include/asm/kvm.h),)
>> header-n += kvm.h
>> endif
>>
>> ifeq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/kvm_para.h \
>> $(srctree)/arch/$(SRCARCH)/include/asm/kvm_para.h),)
>> header-n += kvm_para.h
>> endif
> 
> This series intends all headers are exported from uapi/, correct?
> Do we still need to check $(srctree)/arch/$(SRCARCH)/include/asm/*.h ?
> (related to [1])
No you're right, uapi/asm/*.h is enough. Those files should be exported only if
the uapi/asm/ counterpart exists.

> 
> 
> 
> [3]
> 
>> --- 7.1 header-n
>>
>> header-n is essentially used by include/uapi/linux/Kbuild to avoid
>> exporting specific headers (e.g. kvm.h) on architectures that do not
>> support it. It should be avoided as much as possible.
> 
> 
> Going forward, header-y will be never used
> because uapi/ is exported by default.
> 
> So, I wonder if we could rename this into something clearer.
> 
> Kbuild supports "no-clean-files".
> (Please see ./Kbuild for its usage)
> I guess this notation seems clearer
> when we want to negate the default behavior.
> 
> Can you consider "no-export", "no-export-files", "no-export-headers"
> or whatever you like?
No problem, let's use no-export-headers.


Thank you,
Nicolas


Re: [PATCH v10 07/11] btrfs_tree.h: fix include from userland

2017-03-27 Thread Nicolas Dichtel
Hi Masahiro,

Le 27/03/2017 à 07:53, Masahiro Yamada a écrit :
> Hi Nicolas,
> 
> 
> 2017-03-14 21:54 GMT+09:00 Nicolas Dichtel :
[snip]
>> diff --git a/include/uapi/linux/btrfs_tree.h 
>> b/include/uapi/linux/btrfs_tree.h
>> index 6a261cb52d95..6a754ada59af 100644
>> --- a/include/uapi/linux/btrfs_tree.h
>> +++ b/include/uapi/linux/btrfs_tree.h
>> @@ -2,6 +2,7 @@
>>  #define _BTRFS_CTREE_H_
>>
>>  #include 
>> +#include 
>>
> 
> Can you move  below 
> to sort the includes alphabetically?
Ok.

> 
> This also applies to:
> 
> include/uapi/linux/qrtr.h in 06/11
> include/uapi/linux/cryptouser.h  in 08/11
Ok.


Regards,
Nicolas


Re: [PATCH v10 00/11] uapi: export all headers under uapi directories

2017-03-24 Thread Nicolas Dichtel
Le 24/03/2017 à 09:42, Masahiro Yamada a écrit :
> Hi Nicolas,
> 
> 
> 2017-03-24 17:32 GMT+09:00 Nicolas Dichtel <nicolas.dich...@6wind.com>:
>> Le 14/03/2017 à 13:54, Nicolas Dichtel a écrit :
>>> Patches #1 and #2 are just cleanup: some exported headers were still under
>>> a non-uapi directory. Patch #3 is a fix to avoid exporting a file that was
>>> not under an uapi directory.
>>> After these three patches, all exported headers are under an uapi directory:
>>> path #4 stops searching files in non uapi directories.
>>> The patch #5 was spotted by code review: there is no in-tree user of this
>>> functionality.
>>> Patch #6 fixes some warnings/errors reported by 0-day tests.
>>> Patch #7 to #9 fix some errors when the corresponding files are included by
>>> userland.
>>> Patches #10 and #11 remove the need to list explicitly headers. Now all 
>>> files
>>> under an uapi directory are exported.
>>>
>>> This series has been tested with a 'make headers_install' on x86 and a
>>> 'make headers_install_all'. I've checked the result of both commands.
>>>
>>> This patch is built on top of masahiroy/linux-kbuild.git#for-next 
>>> (v4.11-rc1).
>>> I didn't find any conflict with v4.11-rc2.
>> Masahiro, is this series under review or do you expect something else on my 
>> side?
>>
> 
> Under review.
> Please give me time to take a closer look.
> Sorry for the delay.
No problem, take your time. I just wanted to be sure to not miss something ;-)


Thank you,
Nicolas


Re: [PATCH v10 00/11] uapi: export all headers under uapi directories

2017-03-24 Thread Nicolas Dichtel
Le 24/03/2017 à 09:42, Masahiro Yamada a écrit :
> Hi Nicolas,
> 
> 
> 2017-03-24 17:32 GMT+09:00 Nicolas Dichtel :
>> Le 14/03/2017 à 13:54, Nicolas Dichtel a écrit :
>>> Patches #1 and #2 are just cleanup: some exported headers were still under
>>> a non-uapi directory. Patch #3 is a fix to avoid exporting a file that was
>>> not under an uapi directory.
>>> After these three patches, all exported headers are under an uapi directory:
>>> path #4 stops searching files in non uapi directories.
>>> The patch #5 was spotted by code review: there is no in-tree user of this
>>> functionality.
>>> Patch #6 fixes some warnings/errors reported by 0-day tests.
>>> Patch #7 to #9 fix some errors when the corresponding files are included by
>>> userland.
>>> Patches #10 and #11 remove the need to list explicitly headers. Now all 
>>> files
>>> under an uapi directory are exported.
>>>
>>> This series has been tested with a 'make headers_install' on x86 and a
>>> 'make headers_install_all'. I've checked the result of both commands.
>>>
>>> This patch is built on top of masahiroy/linux-kbuild.git#for-next 
>>> (v4.11-rc1).
>>> I didn't find any conflict with v4.11-rc2.
>> Masahiro, is this series under review or do you expect something else on my 
>> side?
>>
> 
> Under review.
> Please give me time to take a closer look.
> Sorry for the delay.
No problem, take your time. I just wanted to be sure to not miss something ;-)


Thank you,
Nicolas


Re: [PATCH v10 00/11] uapi: export all headers under uapi directories

2017-03-24 Thread Nicolas Dichtel
Le 14/03/2017 à 13:54, Nicolas Dichtel a écrit :
> Patches #1 and #2 are just cleanup: some exported headers were still under
> a non-uapi directory. Patch #3 is a fix to avoid exporting a file that was
> not under an uapi directory.
> After these three patches, all exported headers are under an uapi directory:
> path #4 stops searching files in non uapi directories.
> The patch #5 was spotted by code review: there is no in-tree user of this
> functionality.
> Patch #6 fixes some warnings/errors reported by 0-day tests.
> Patch #7 to #9 fix some errors when the corresponding files are included by
> userland.
> Patches #10 and #11 remove the need to list explicitly headers. Now all files
> under an uapi directory are exported.
> 
> This series has been tested with a 'make headers_install' on x86 and a
> 'make headers_install_all'. I've checked the result of both commands.
> 
> This patch is built on top of masahiroy/linux-kbuild.git#for-next (v4.11-rc1).
> I didn't find any conflict with v4.11-rc2.
Masahiro, is this series under review or do you expect something else on my 
side?


Regards,
Nicolas


Re: [PATCH v10 00/11] uapi: export all headers under uapi directories

2017-03-24 Thread Nicolas Dichtel
Le 14/03/2017 à 13:54, Nicolas Dichtel a écrit :
> Patches #1 and #2 are just cleanup: some exported headers were still under
> a non-uapi directory. Patch #3 is a fix to avoid exporting a file that was
> not under an uapi directory.
> After these three patches, all exported headers are under an uapi directory:
> path #4 stops searching files in non uapi directories.
> The patch #5 was spotted by code review: there is no in-tree user of this
> functionality.
> Patch #6 fixes some warnings/errors reported by 0-day tests.
> Patch #7 to #9 fix some errors when the corresponding files are included by
> userland.
> Patches #10 and #11 remove the need to list explicitly headers. Now all files
> under an uapi directory are exported.
> 
> This series has been tested with a 'make headers_install' on x86 and a
> 'make headers_install_all'. I've checked the result of both commands.
> 
> This patch is built on top of masahiroy/linux-kbuild.git#for-next (v4.11-rc1).
> I didn't find any conflict with v4.11-rc2.
Masahiro, is this series under review or do you expect something else on my 
side?


Regards,
Nicolas


[PATCH v10 10/11] uapi: export all headers under uapi directories

2017-03-14 Thread Nicolas Dichtel
Regularly, when a new header is created in include/uapi/, the developer
forgets to add it in the corresponding Kbuild file. This error is usually
detected after the release is out.

In fact, all headers under uapi directories should be exported, thus it's
useless to have an exhaustive list.

After this patch, the following files, which were not exported, are now
exported (with make headers_install_all):
asm-arc/kvm_para.h
asm-arc/ucontext.h
asm-avr32/kvm_para.h
asm-blackfin/shmparam.h
asm-blackfin/ucontext.h
asm-c6x/shmparam.h
asm-c6x/ucontext.h
asm-cris/kvm_para.h
asm-h8300/shmparam.h
asm-h8300/ucontext.h
asm-hexagon/shmparam.h
asm-m32r/kvm_para.h
asm-m68k/kvm_para.h
asm-m68k/shmparam.h
asm-metag/kvm_para.h
asm-metag/shmparam.h
asm-metag/ucontext.h
asm-mips/hwcap.h
asm-mips/reg.h
asm-mips/ucontext.h
asm-nios2/kvm_para.h
asm-nios2/ucontext.h
asm-openrisc/shmparam.h
asm-parisc/kvm_para.h
asm-powerpc/perf_regs.h
asm-sh/kvm_para.h
asm-sh/ucontext.h
asm-tile/shmparam.h
asm-unicore32/shmparam.h
asm-unicore32/ucontext.h
asm-x86/hwcap2.h
asm-xtensa/kvm_para.h
drm/armada_drm.h
drm/etnaviv_drm.h
drm/vgem_drm.h
linux/auto_dev-ioctl.h
linux/bcache.h
linux/btrfs_tree.h
linux/cifs/cifs_mount.h
linux/coresight-stm.h
linux/crypto.h
linux/cryptouser.h
linux/genwqe/genwqe_card.h
linux/hash_info.h
linux/kcm.h
linux/kcov.h
linux/kfd_ioctl.h
linux/lightnvm.h
linux/module.h
linux/nilfs2_api.h
linux/nilfs2_ondisk.h
linux/nsfs.h
linux/pr.h
linux/qrtr.h
linux/rpmsg.h
linux/sched/types.h
linux/sed-opal.h
linux/smc.h
linux/smc_diag.h
linux/stm.h
linux/userio.h
linux/virtio_mmio.h
linux/wil6210_uapi.h
rdma/bnxt_re-abi.h

Note that I have removed from this list the files which are generated in every
exported directories (like .install or .install.cmd).

Thanks to Julien Floret <julien.flo...@6wind.com> for the tip to get all
subdirs with a pure makefile command.

For the record, note that exported files for asm directories are a mix of
files listed by:
 - include/uapi/asm-generic/Kbuild.asm;
 - arch//include/uapi/asm/Kbuild;
 - arch//include/asm/Kbuild.

Signed-off-by: Nicolas Dichtel <nicolas.dich...@6wind.com>
Acked-by: Daniel Vetter <daniel.vet...@ffwll.ch>
Acked-by: Russell King <rmk+ker...@armlinux.org.uk>
Acked-by: Mark Salter <msal...@redhat.com>
Acked-by: Michael Ellerman <m...@ellerman.id.au> (powerpc)
---
 Documentation/kbuild/makefiles.txt  |  66 ++--
 arch/alpha/include/uapi/asm/Kbuild  |  41 ---
 arch/arc/include/uapi/asm/Kbuild|   3 -
 arch/arm/include/uapi/asm/Kbuild|  17 -
 arch/arm64/include/uapi/asm/Kbuild  |  18 -
 arch/avr32/include/uapi/asm/Kbuild  |  20 --
 arch/blackfin/include/uapi/asm/Kbuild   |  17 -
 arch/c6x/include/uapi/asm/Kbuild|   8 -
 arch/cris/include/uapi/arch-v10/arch/Kbuild |   5 -
 arch/cris/include/uapi/arch-v32/arch/Kbuild |   3 -
 arch/cris/include/uapi/asm/Kbuild   |  43 +--
 arch/frv/include/uapi/asm/Kbuild|  33 --
 arch/h8300/include/uapi/asm/Kbuild  |  28 --
 arch/hexagon/include/asm/Kbuild |   3 -
 arch/hexagon/include/uapi/asm/Kbuild|  13 -
 arch/ia64/include/uapi/asm/Kbuild   |  45 ---
 arch/m32r/include/uapi/asm/Kbuild   |  31 --
 arch/m68k/include/uapi/asm/Kbuild   |  24 --
 arch/metag/include/uapi/asm/Kbuild  |   8 -
 arch/microblaze/include/uapi/asm/Kbuild |  32 --
 arch/mips/include/uapi/asm/Kbuild   |  37 ---
 arch/mn10300/include/uapi/asm/Kbuild|  32 --
 arch/nios2/include/uapi/asm/Kbuild  |   3 +-
 arch/openrisc/include/asm/Kbuild|   3 -
 arch/openrisc/include/uapi/asm/Kbuild   |   8 -
 arch/parisc/include/uapi/asm/Kbuild |  28 --
 arch/powerpc/include/uapi/asm/Kbuild|  45 ---
 arch/s390/include/uapi/asm/Kbuild   |  53 ---
 arch/score/include/asm/Kbuild   |   3 -
 arch/score/include/uapi/asm/Kbuild  |  32 --
 arch/sh/include/uapi/asm/Kbuild |  23 --
 arch/sparc/include/uapi/asm/Kbuild  |  48 ---
 arch/tile/include/asm/Kbuild|   3 -
 arch/tile/include/uapi/arch/Kbuild  |  17 -
 arch/tile/include/uapi/asm/Kbuild   |  19 +-
 arch/unicore32/include/uapi/asm/Kbuild  |   6 -
 arch/x86/include/uapi/asm/Kbuild|  58 
 arch/xtensa/include/uapi/asm/Kbuild |  23 --
 include/Kbuild  |   2 -
 include/asm-generic/Kbuild.asm  |   1 -
 include/scsi/fc/Kbuild  |   0
 include/uapi/Kbuild |  15 -
 include/uapi/asm-generic/Kbuild |  36 --
 include/uapi/asm-generic/Kbuild.asm |  62 ++--
 include/uapi/drm/Kbuild |  23 --
 include/uapi/linux/Kbuild   | 494 +---
 include/uapi/linux/android/Kbuild   |   2 -
 include/uapi/linux/byteorder/Kbuild |   3 -
 include/uapi/linux/caif/

[PATCH v10 10/11] uapi: export all headers under uapi directories

2017-03-14 Thread Nicolas Dichtel
Regularly, when a new header is created in include/uapi/, the developer
forgets to add it in the corresponding Kbuild file. This error is usually
detected after the release is out.

In fact, all headers under uapi directories should be exported, thus it's
useless to have an exhaustive list.

After this patch, the following files, which were not exported, are now
exported (with make headers_install_all):
asm-arc/kvm_para.h
asm-arc/ucontext.h
asm-avr32/kvm_para.h
asm-blackfin/shmparam.h
asm-blackfin/ucontext.h
asm-c6x/shmparam.h
asm-c6x/ucontext.h
asm-cris/kvm_para.h
asm-h8300/shmparam.h
asm-h8300/ucontext.h
asm-hexagon/shmparam.h
asm-m32r/kvm_para.h
asm-m68k/kvm_para.h
asm-m68k/shmparam.h
asm-metag/kvm_para.h
asm-metag/shmparam.h
asm-metag/ucontext.h
asm-mips/hwcap.h
asm-mips/reg.h
asm-mips/ucontext.h
asm-nios2/kvm_para.h
asm-nios2/ucontext.h
asm-openrisc/shmparam.h
asm-parisc/kvm_para.h
asm-powerpc/perf_regs.h
asm-sh/kvm_para.h
asm-sh/ucontext.h
asm-tile/shmparam.h
asm-unicore32/shmparam.h
asm-unicore32/ucontext.h
asm-x86/hwcap2.h
asm-xtensa/kvm_para.h
drm/armada_drm.h
drm/etnaviv_drm.h
drm/vgem_drm.h
linux/auto_dev-ioctl.h
linux/bcache.h
linux/btrfs_tree.h
linux/cifs/cifs_mount.h
linux/coresight-stm.h
linux/crypto.h
linux/cryptouser.h
linux/genwqe/genwqe_card.h
linux/hash_info.h
linux/kcm.h
linux/kcov.h
linux/kfd_ioctl.h
linux/lightnvm.h
linux/module.h
linux/nilfs2_api.h
linux/nilfs2_ondisk.h
linux/nsfs.h
linux/pr.h
linux/qrtr.h
linux/rpmsg.h
linux/sched/types.h
linux/sed-opal.h
linux/smc.h
linux/smc_diag.h
linux/stm.h
linux/userio.h
linux/virtio_mmio.h
linux/wil6210_uapi.h
rdma/bnxt_re-abi.h

Note that I have removed from this list the files which are generated in every
exported directories (like .install or .install.cmd).

Thanks to Julien Floret  for the tip to get all
subdirs with a pure makefile command.

For the record, note that exported files for asm directories are a mix of
files listed by:
 - include/uapi/asm-generic/Kbuild.asm;
 - arch//include/uapi/asm/Kbuild;
 - arch//include/asm/Kbuild.

Signed-off-by: Nicolas Dichtel 
Acked-by: Daniel Vetter 
Acked-by: Russell King 
Acked-by: Mark Salter 
Acked-by: Michael Ellerman  (powerpc)
---
 Documentation/kbuild/makefiles.txt  |  66 ++--
 arch/alpha/include/uapi/asm/Kbuild  |  41 ---
 arch/arc/include/uapi/asm/Kbuild|   3 -
 arch/arm/include/uapi/asm/Kbuild|  17 -
 arch/arm64/include/uapi/asm/Kbuild  |  18 -
 arch/avr32/include/uapi/asm/Kbuild  |  20 --
 arch/blackfin/include/uapi/asm/Kbuild   |  17 -
 arch/c6x/include/uapi/asm/Kbuild|   8 -
 arch/cris/include/uapi/arch-v10/arch/Kbuild |   5 -
 arch/cris/include/uapi/arch-v32/arch/Kbuild |   3 -
 arch/cris/include/uapi/asm/Kbuild   |  43 +--
 arch/frv/include/uapi/asm/Kbuild|  33 --
 arch/h8300/include/uapi/asm/Kbuild  |  28 --
 arch/hexagon/include/asm/Kbuild |   3 -
 arch/hexagon/include/uapi/asm/Kbuild|  13 -
 arch/ia64/include/uapi/asm/Kbuild   |  45 ---
 arch/m32r/include/uapi/asm/Kbuild   |  31 --
 arch/m68k/include/uapi/asm/Kbuild   |  24 --
 arch/metag/include/uapi/asm/Kbuild  |   8 -
 arch/microblaze/include/uapi/asm/Kbuild |  32 --
 arch/mips/include/uapi/asm/Kbuild   |  37 ---
 arch/mn10300/include/uapi/asm/Kbuild|  32 --
 arch/nios2/include/uapi/asm/Kbuild  |   3 +-
 arch/openrisc/include/asm/Kbuild|   3 -
 arch/openrisc/include/uapi/asm/Kbuild   |   8 -
 arch/parisc/include/uapi/asm/Kbuild |  28 --
 arch/powerpc/include/uapi/asm/Kbuild|  45 ---
 arch/s390/include/uapi/asm/Kbuild   |  53 ---
 arch/score/include/asm/Kbuild   |   3 -
 arch/score/include/uapi/asm/Kbuild  |  32 --
 arch/sh/include/uapi/asm/Kbuild |  23 --
 arch/sparc/include/uapi/asm/Kbuild  |  48 ---
 arch/tile/include/asm/Kbuild|   3 -
 arch/tile/include/uapi/arch/Kbuild  |  17 -
 arch/tile/include/uapi/asm/Kbuild   |  19 +-
 arch/unicore32/include/uapi/asm/Kbuild  |   6 -
 arch/x86/include/uapi/asm/Kbuild|  58 
 arch/xtensa/include/uapi/asm/Kbuild |  23 --
 include/Kbuild  |   2 -
 include/asm-generic/Kbuild.asm  |   1 -
 include/scsi/fc/Kbuild  |   0
 include/uapi/Kbuild |  15 -
 include/uapi/asm-generic/Kbuild |  36 --
 include/uapi/asm-generic/Kbuild.asm |  62 ++--
 include/uapi/drm/Kbuild |  23 --
 include/uapi/linux/Kbuild   | 494 +---
 include/uapi/linux/android/Kbuild   |   2 -
 include/uapi/linux/byteorder/Kbuild |   3 -
 include/uapi/linux/caif/Kbuild  |   3 -
 include/uapi/linux/can/Kbuild   |   6 -
 include/uapi/linux/dvb/Kbuild   |   9 -
 include/uapi/linux/hdlc/Kbuild

[PATCH v10 03/11] x86: stop exporting msr-index.h to userland

2017-03-14 Thread Nicolas Dichtel
Even if this file was not in an uapi directory, it was exported because
it was listed in the Kbuild file.

Fixes: b72e7464e4cf ("x86/uapi: Do not export  as part of the 
user API headers")
Suggested-by: Borislav Petkov <b...@alien8.de>
CC: Ingo Molnar <mi...@kernel.org>
Signed-off-by: Nicolas Dichtel <nicolas.dich...@6wind.com>
Acked-by: Ingo Molnar <mi...@kernel.org>
Acked-by: Thomas Gleixner <t...@linutronix.de>
---
 arch/x86/include/uapi/asm/Kbuild | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/x86/include/uapi/asm/Kbuild b/arch/x86/include/uapi/asm/Kbuild
index 3dec769cadf7..1c532b3f18ea 100644
--- a/arch/x86/include/uapi/asm/Kbuild
+++ b/arch/x86/include/uapi/asm/Kbuild
@@ -27,7 +27,6 @@ header-y += ldt.h
 header-y += mce.h
 header-y += mman.h
 header-y += msgbuf.h
-header-y += msr-index.h
 header-y += msr.h
 header-y += mtrr.h
 header-y += param.h
-- 
2.8.1



[PATCH v10 03/11] x86: stop exporting msr-index.h to userland

2017-03-14 Thread Nicolas Dichtel
Even if this file was not in an uapi directory, it was exported because
it was listed in the Kbuild file.

Fixes: b72e7464e4cf ("x86/uapi: Do not export  as part of the 
user API headers")
Suggested-by: Borislav Petkov 
CC: Ingo Molnar 
Signed-off-by: Nicolas Dichtel 
Acked-by: Ingo Molnar 
Acked-by: Thomas Gleixner 
---
 arch/x86/include/uapi/asm/Kbuild | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/x86/include/uapi/asm/Kbuild b/arch/x86/include/uapi/asm/Kbuild
index 3dec769cadf7..1c532b3f18ea 100644
--- a/arch/x86/include/uapi/asm/Kbuild
+++ b/arch/x86/include/uapi/asm/Kbuild
@@ -27,7 +27,6 @@ header-y += ldt.h
 header-y += mce.h
 header-y += mman.h
 header-y += msgbuf.h
-header-y += msr-index.h
 header-y += msr.h
 header-y += mtrr.h
 header-y += param.h
-- 
2.8.1



[PATCH v10 05/11] Makefile.headersinst: remove destination-y option

2017-03-14 Thread Nicolas Dichtel
This option was added in commit c7bb349e7c25 ("kbuild: introduce destination-y
for exported headers") but never used in-tree.

Signed-off-by: Nicolas Dichtel <nicolas.dich...@6wind.com>
Acked-by: Paul Bolle <pebo...@tiscali.nl>
---
 Documentation/kbuild/makefiles.txt | 23 ---
 scripts/Makefile.headersinst   |  2 +-
 2 files changed, 5 insertions(+), 20 deletions(-)

diff --git a/Documentation/kbuild/makefiles.txt 
b/Documentation/kbuild/makefiles.txt
index 9b9c4797fc55..37b525d329ae 100644
--- a/Documentation/kbuild/makefiles.txt
+++ b/Documentation/kbuild/makefiles.txt
@@ -46,9 +46,8 @@ This document describes the Linux kernel Makefiles.
=== 7 Kbuild syntax for exported headers
--- 7.1 header-y
--- 7.2 genhdr-y
-   --- 7.3 destination-y
-   --- 7.4 generic-y
-   --- 7.5 generated-y
+   --- 7.3 generic-y
+   --- 7.4 generated-y
 
=== 8 Kbuild Variables
=== 9 Makefile language
@@ -1295,21 +1294,7 @@ See subsequent chapter for the syntax of the Kbuild file.
#include/linux/Kbuild
genhdr-y += version.h
 
-   --- 7.3 destination-y
-
-   When an architecture has a set of exported headers that needs to be
-   exported to a different directory destination-y is used.
-   destination-y specifies the destination directory for all exported
-   headers in the file where it is present.
-
-   Example:
-   #arch/xtensa/platforms/s6105/include/platform/Kbuild
-   destination-y := include/linux
-
-   In the example above all exported headers in the Kbuild file
-   will be located in the directory "include/linux" when exported.
-
-   --- 7.4 generic-y
+   --- 7.3 generic-y
 
If an architecture uses a verbatim copy of a header from
include/asm-generic then this is listed in the file
@@ -1336,7 +1321,7 @@ See subsequent chapter for the syntax of the Kbuild file.
Example: termios.h
#include 
 
-   --- 7.5 generated-y
+   --- 7.4 generated-y
 
If an architecture generates other header files alongside generic-y
wrappers, and not included in genhdr-y, then generated-y specifies
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index 7bd9df6efe2f..ca5d439c9abf 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -14,7 +14,7 @@ kbuild-file := $(srctree)/$(obj)/Kbuild
 include $(kbuild-file)
 
 # called may set destination dir (when installing to asm/)
-_dst := $(if $(destination-y),$(destination-y),$(if $(dst),$(dst),$(obj)))
+_dst := $(if $(dst),$(dst),$(obj))
 
 old-kbuild-file := $(srctree)/$(subst uapi/,,$(obj))/Kbuild
 ifneq ($(wildcard $(old-kbuild-file)),)
-- 
2.8.1



[PATCH v10 05/11] Makefile.headersinst: remove destination-y option

2017-03-14 Thread Nicolas Dichtel
This option was added in commit c7bb349e7c25 ("kbuild: introduce destination-y
for exported headers") but never used in-tree.

Signed-off-by: Nicolas Dichtel 
Acked-by: Paul Bolle 
---
 Documentation/kbuild/makefiles.txt | 23 ---
 scripts/Makefile.headersinst   |  2 +-
 2 files changed, 5 insertions(+), 20 deletions(-)

diff --git a/Documentation/kbuild/makefiles.txt 
b/Documentation/kbuild/makefiles.txt
index 9b9c4797fc55..37b525d329ae 100644
--- a/Documentation/kbuild/makefiles.txt
+++ b/Documentation/kbuild/makefiles.txt
@@ -46,9 +46,8 @@ This document describes the Linux kernel Makefiles.
=== 7 Kbuild syntax for exported headers
--- 7.1 header-y
--- 7.2 genhdr-y
-   --- 7.3 destination-y
-   --- 7.4 generic-y
-   --- 7.5 generated-y
+   --- 7.3 generic-y
+   --- 7.4 generated-y
 
=== 8 Kbuild Variables
=== 9 Makefile language
@@ -1295,21 +1294,7 @@ See subsequent chapter for the syntax of the Kbuild file.
#include/linux/Kbuild
genhdr-y += version.h
 
-   --- 7.3 destination-y
-
-   When an architecture has a set of exported headers that needs to be
-   exported to a different directory destination-y is used.
-   destination-y specifies the destination directory for all exported
-   headers in the file where it is present.
-
-   Example:
-   #arch/xtensa/platforms/s6105/include/platform/Kbuild
-   destination-y := include/linux
-
-   In the example above all exported headers in the Kbuild file
-   will be located in the directory "include/linux" when exported.
-
-   --- 7.4 generic-y
+   --- 7.3 generic-y
 
If an architecture uses a verbatim copy of a header from
include/asm-generic then this is listed in the file
@@ -1336,7 +1321,7 @@ See subsequent chapter for the syntax of the Kbuild file.
Example: termios.h
#include 
 
-   --- 7.5 generated-y
+   --- 7.4 generated-y
 
If an architecture generates other header files alongside generic-y
wrappers, and not included in genhdr-y, then generated-y specifies
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index 7bd9df6efe2f..ca5d439c9abf 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -14,7 +14,7 @@ kbuild-file := $(srctree)/$(obj)/Kbuild
 include $(kbuild-file)
 
 # called may set destination dir (when installing to asm/)
-_dst := $(if $(destination-y),$(destination-y),$(if $(dst),$(dst),$(obj)))
+_dst := $(if $(dst),$(dst),$(obj))
 
 old-kbuild-file := $(srctree)/$(subst uapi/,,$(obj))/Kbuild
 ifneq ($(wildcard $(old-kbuild-file)),)
-- 
2.8.1



[PATCH v10 09/11] smc_diag.h: fix include from userland

2017-03-14 Thread Nicolas Dichtel
This patch prepares the uapi export by fixing the following error:

.../linux/smc_diag.h:6:27: fatal error: rdma/ib_verbs.h: No such file or 
directory
 #include 

Signed-off-by: Nicolas Dichtel <nicolas.dich...@6wind.com>
---
 include/rdma/ib_verbs.h   | 3 +--
 include/uapi/linux/smc_diag.h | 2 +-
 include/uapi/rdma/ib_user_verbs.h | 2 ++
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 0f1813c13687..50f276a4afdc 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -61,6 +61,7 @@
 #include 
 #include 
 #include 
+#include 
 
 extern struct workqueue_struct *ib_wq;
 extern struct workqueue_struct *ib_comp_wq;
@@ -1838,8 +1839,6 @@ enum ib_mad_result {
IB_MAD_RESULT_CONSUMED = 1 << 2  /* Packet consumed: stop processing */
 };
 
-#define IB_DEVICE_NAME_MAX 64
-
 struct ib_port_cache {
struct ib_pkey_cache  *pkey;
struct ib_gid_table   *gid;
diff --git a/include/uapi/linux/smc_diag.h b/include/uapi/linux/smc_diag.h
index 0063919fea34..87712bfaa9dd 100644
--- a/include/uapi/linux/smc_diag.h
+++ b/include/uapi/linux/smc_diag.h
@@ -3,7 +3,7 @@
 
 #include 
 #include 
-#include 
+#include 
 
 /* Request structure */
 struct smc_diag_req {
diff --git a/include/uapi/rdma/ib_user_verbs.h 
b/include/uapi/rdma/ib_user_verbs.h
index 997f904c7692..8edce2b65903 100644
--- a/include/uapi/rdma/ib_user_verbs.h
+++ b/include/uapi/rdma/ib_user_verbs.h
@@ -1124,4 +1124,6 @@ struct ib_uverbs_ex_destroy_rwq_ind_table  {
__u32 ind_tbl_handle;
 };
 
+#define IB_DEVICE_NAME_MAX 64
+
 #endif /* IB_USER_VERBS_H */
-- 
2.8.1



[PATCH v10 09/11] smc_diag.h: fix include from userland

2017-03-14 Thread Nicolas Dichtel
This patch prepares the uapi export by fixing the following error:

.../linux/smc_diag.h:6:27: fatal error: rdma/ib_verbs.h: No such file or 
directory
 #include 

Signed-off-by: Nicolas Dichtel 
---
 include/rdma/ib_verbs.h   | 3 +--
 include/uapi/linux/smc_diag.h | 2 +-
 include/uapi/rdma/ib_user_verbs.h | 2 ++
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 0f1813c13687..50f276a4afdc 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -61,6 +61,7 @@
 #include 
 #include 
 #include 
+#include 
 
 extern struct workqueue_struct *ib_wq;
 extern struct workqueue_struct *ib_comp_wq;
@@ -1838,8 +1839,6 @@ enum ib_mad_result {
IB_MAD_RESULT_CONSUMED = 1 << 2  /* Packet consumed: stop processing */
 };
 
-#define IB_DEVICE_NAME_MAX 64
-
 struct ib_port_cache {
struct ib_pkey_cache  *pkey;
struct ib_gid_table   *gid;
diff --git a/include/uapi/linux/smc_diag.h b/include/uapi/linux/smc_diag.h
index 0063919fea34..87712bfaa9dd 100644
--- a/include/uapi/linux/smc_diag.h
+++ b/include/uapi/linux/smc_diag.h
@@ -3,7 +3,7 @@
 
 #include 
 #include 
-#include 
+#include 
 
 /* Request structure */
 struct smc_diag_req {
diff --git a/include/uapi/rdma/ib_user_verbs.h 
b/include/uapi/rdma/ib_user_verbs.h
index 997f904c7692..8edce2b65903 100644
--- a/include/uapi/rdma/ib_user_verbs.h
+++ b/include/uapi/rdma/ib_user_verbs.h
@@ -1124,4 +1124,6 @@ struct ib_uverbs_ex_destroy_rwq_ind_table  {
__u32 ind_tbl_handle;
 };
 
+#define IB_DEVICE_NAME_MAX 64
+
 #endif /* IB_USER_VERBS_H */
-- 
2.8.1



[PATCH v10 07/11] btrfs_tree.h: fix include from userland

2017-03-14 Thread Nicolas Dichtel
This patch prepares the uapi export by fixing the following errors:

.../linux/btrfs_tree.h:283:2: error: #error "UUID items require BTRFS_UUID_SIZE 
== 16!"
 #error "UUID items require BTRFS_UUID_SIZE == 16!"

.../linux/btrfs_tree.h:390:12: error: ‘BTRFS_UUID_SIZE’ undeclared here (not in 
a function)
  __u8 uuid[BTRFS_UUID_SIZE];
^
.../linux/btrfs_tree.h:796:16: error: ‘BTRFS_DEV_STAT_VALUES_MAX’ undeclared 
here (not in a function)
  __le64 values[BTRFS_DEV_STAT_VALUES_MAX];

Signed-off-by: Nicolas Dichtel <nicolas.dich...@6wind.com>
---
 include/uapi/linux/btrfs_tree.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/uapi/linux/btrfs_tree.h b/include/uapi/linux/btrfs_tree.h
index 6a261cb52d95..6a754ada59af 100644
--- a/include/uapi/linux/btrfs_tree.h
+++ b/include/uapi/linux/btrfs_tree.h
@@ -2,6 +2,7 @@
 #define _BTRFS_CTREE_H_
 
 #include 
+#include 
 
 /*
  * This header contains the structure definitions and constants used
-- 
2.8.1



[PATCH v10 07/11] btrfs_tree.h: fix include from userland

2017-03-14 Thread Nicolas Dichtel
This patch prepares the uapi export by fixing the following errors:

.../linux/btrfs_tree.h:283:2: error: #error "UUID items require BTRFS_UUID_SIZE 
== 16!"
 #error "UUID items require BTRFS_UUID_SIZE == 16!"

.../linux/btrfs_tree.h:390:12: error: ‘BTRFS_UUID_SIZE’ undeclared here (not in 
a function)
  __u8 uuid[BTRFS_UUID_SIZE];
^
.../linux/btrfs_tree.h:796:16: error: ‘BTRFS_DEV_STAT_VALUES_MAX’ undeclared 
here (not in a function)
  __le64 values[BTRFS_DEV_STAT_VALUES_MAX];

Signed-off-by: Nicolas Dichtel 
---
 include/uapi/linux/btrfs_tree.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/uapi/linux/btrfs_tree.h b/include/uapi/linux/btrfs_tree.h
index 6a261cb52d95..6a754ada59af 100644
--- a/include/uapi/linux/btrfs_tree.h
+++ b/include/uapi/linux/btrfs_tree.h
@@ -2,6 +2,7 @@
 #define _BTRFS_CTREE_H_
 
 #include 
+#include 
 
 /*
  * This header contains the structure definitions and constants used
-- 
2.8.1



[PATCH v10 06/11] uapi: includes linux/types.h before exporting files

2017-03-14 Thread Nicolas Dichtel
Some files will be exported after a following patch. 0-day tests report the
following warning/error:
./usr/include/linux/bcache.h:8: include of  is preferred over 

./usr/include/linux/bcache.h:11: found __[us]{8,16,32,64} type without #include 

./usr/include/linux/qrtr.h:8: found __[us]{8,16,32,64} type without #include 

./usr/include/linux/cryptouser.h:39: found __[us]{8,16,32,64} type without 
#include 
./usr/include/linux/pr.h:14: found __[us]{8,16,32,64} type without #include 

./usr/include/linux/btrfs_tree.h:337: found __[us]{8,16,32,64} type without 
#include 
./usr/include/rdma/bnxt_re-abi.h:45: found __[us]{8,16,32,64} type without 
#include 

Signed-off-by: Nicolas Dichtel <nicolas.dich...@6wind.com>
---
 include/uapi/linux/bcache.h | 2 +-
 include/uapi/linux/btrfs_tree.h | 2 ++
 include/uapi/linux/cryptouser.h | 2 ++
 include/uapi/linux/pr.h | 2 ++
 include/uapi/linux/qrtr.h   | 1 +
 include/uapi/rdma/bnxt_re-abi.h | 2 ++
 6 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/bcache.h b/include/uapi/linux/bcache.h
index 22b6ad31c706..e3bb0635e94a 100644
--- a/include/uapi/linux/bcache.h
+++ b/include/uapi/linux/bcache.h
@@ -5,7 +5,7 @@
  * Bcache on disk data structures
  */
 
-#include 
+#include 
 
 #define BITMASK(name, type, field, offset, size)   \
 static inline __u64 name(const type *k)\
diff --git a/include/uapi/linux/btrfs_tree.h b/include/uapi/linux/btrfs_tree.h
index d5ad15a106a7..6a261cb52d95 100644
--- a/include/uapi/linux/btrfs_tree.h
+++ b/include/uapi/linux/btrfs_tree.h
@@ -1,6 +1,8 @@
 #ifndef _BTRFS_CTREE_H_
 #define _BTRFS_CTREE_H_
 
+#include 
+
 /*
  * This header contains the structure definitions and constants used
  * by file system objects that can be retrieved using
diff --git a/include/uapi/linux/cryptouser.h b/include/uapi/linux/cryptouser.h
index 11d21fce14d6..c6a09c5261e7 100644
--- a/include/uapi/linux/cryptouser.h
+++ b/include/uapi/linux/cryptouser.h
@@ -18,6 +18,8 @@
  * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+#include 
+
 /* Netlink configuration messages.  */
 enum {
CRYPTO_MSG_BASE = 0x10,
diff --git a/include/uapi/linux/pr.h b/include/uapi/linux/pr.h
index 57d7c0f916b6..645ef3cf3dd0 100644
--- a/include/uapi/linux/pr.h
+++ b/include/uapi/linux/pr.h
@@ -1,6 +1,8 @@
 #ifndef _UAPI_PR_H
 #define _UAPI_PR_H
 
+#include 
+
 enum pr_type {
PR_WRITE_EXCLUSIVE  = 1,
PR_EXCLUSIVE_ACCESS = 2,
diff --git a/include/uapi/linux/qrtr.h b/include/uapi/linux/qrtr.h
index 66c0748d26e2..b14ee91ec387 100644
--- a/include/uapi/linux/qrtr.h
+++ b/include/uapi/linux/qrtr.h
@@ -1,6 +1,7 @@
 #ifndef _LINUX_QRTR_H
 #define _LINUX_QRTR_H
 
+#include 
 #include 
 
 struct sockaddr_qrtr {
diff --git a/include/uapi/rdma/bnxt_re-abi.h b/include/uapi/rdma/bnxt_re-abi.h
index e2c8a3f0ccec..74018bd18d72 100644
--- a/include/uapi/rdma/bnxt_re-abi.h
+++ b/include/uapi/rdma/bnxt_re-abi.h
@@ -39,6 +39,8 @@
 #ifndef __BNXT_RE_UVERBS_ABI_H__
 #define __BNXT_RE_UVERBS_ABI_H__
 
+#include 
+
 #define BNXT_RE_ABI_VERSION1
 
 struct bnxt_re_uctx_resp {
-- 
2.8.1



[PATCH v10 06/11] uapi: includes linux/types.h before exporting files

2017-03-14 Thread Nicolas Dichtel
Some files will be exported after a following patch. 0-day tests report the
following warning/error:
./usr/include/linux/bcache.h:8: include of  is preferred over 

./usr/include/linux/bcache.h:11: found __[us]{8,16,32,64} type without #include 

./usr/include/linux/qrtr.h:8: found __[us]{8,16,32,64} type without #include 

./usr/include/linux/cryptouser.h:39: found __[us]{8,16,32,64} type without 
#include 
./usr/include/linux/pr.h:14: found __[us]{8,16,32,64} type without #include 

./usr/include/linux/btrfs_tree.h:337: found __[us]{8,16,32,64} type without 
#include 
./usr/include/rdma/bnxt_re-abi.h:45: found __[us]{8,16,32,64} type without 
#include 

Signed-off-by: Nicolas Dichtel 
---
 include/uapi/linux/bcache.h | 2 +-
 include/uapi/linux/btrfs_tree.h | 2 ++
 include/uapi/linux/cryptouser.h | 2 ++
 include/uapi/linux/pr.h | 2 ++
 include/uapi/linux/qrtr.h   | 1 +
 include/uapi/rdma/bnxt_re-abi.h | 2 ++
 6 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/bcache.h b/include/uapi/linux/bcache.h
index 22b6ad31c706..e3bb0635e94a 100644
--- a/include/uapi/linux/bcache.h
+++ b/include/uapi/linux/bcache.h
@@ -5,7 +5,7 @@
  * Bcache on disk data structures
  */
 
-#include 
+#include 
 
 #define BITMASK(name, type, field, offset, size)   \
 static inline __u64 name(const type *k)\
diff --git a/include/uapi/linux/btrfs_tree.h b/include/uapi/linux/btrfs_tree.h
index d5ad15a106a7..6a261cb52d95 100644
--- a/include/uapi/linux/btrfs_tree.h
+++ b/include/uapi/linux/btrfs_tree.h
@@ -1,6 +1,8 @@
 #ifndef _BTRFS_CTREE_H_
 #define _BTRFS_CTREE_H_
 
+#include 
+
 /*
  * This header contains the structure definitions and constants used
  * by file system objects that can be retrieved using
diff --git a/include/uapi/linux/cryptouser.h b/include/uapi/linux/cryptouser.h
index 11d21fce14d6..c6a09c5261e7 100644
--- a/include/uapi/linux/cryptouser.h
+++ b/include/uapi/linux/cryptouser.h
@@ -18,6 +18,8 @@
  * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+#include 
+
 /* Netlink configuration messages.  */
 enum {
CRYPTO_MSG_BASE = 0x10,
diff --git a/include/uapi/linux/pr.h b/include/uapi/linux/pr.h
index 57d7c0f916b6..645ef3cf3dd0 100644
--- a/include/uapi/linux/pr.h
+++ b/include/uapi/linux/pr.h
@@ -1,6 +1,8 @@
 #ifndef _UAPI_PR_H
 #define _UAPI_PR_H
 
+#include 
+
 enum pr_type {
PR_WRITE_EXCLUSIVE  = 1,
PR_EXCLUSIVE_ACCESS = 2,
diff --git a/include/uapi/linux/qrtr.h b/include/uapi/linux/qrtr.h
index 66c0748d26e2..b14ee91ec387 100644
--- a/include/uapi/linux/qrtr.h
+++ b/include/uapi/linux/qrtr.h
@@ -1,6 +1,7 @@
 #ifndef _LINUX_QRTR_H
 #define _LINUX_QRTR_H
 
+#include 
 #include 
 
 struct sockaddr_qrtr {
diff --git a/include/uapi/rdma/bnxt_re-abi.h b/include/uapi/rdma/bnxt_re-abi.h
index e2c8a3f0ccec..74018bd18d72 100644
--- a/include/uapi/rdma/bnxt_re-abi.h
+++ b/include/uapi/rdma/bnxt_re-abi.h
@@ -39,6 +39,8 @@
 #ifndef __BNXT_RE_UVERBS_ABI_H__
 #define __BNXT_RE_UVERBS_ABI_H__
 
+#include 
+
 #define BNXT_RE_ABI_VERSION1
 
 struct bnxt_re_uctx_resp {
-- 
2.8.1



[PATCH v10 02/11] nios2: put setup.h in uapi

2017-03-14 Thread Nicolas Dichtel
This header file is exported, but from a userland pov, it's just a wrapper
to asm-generic/setup.h.

Signed-off-by: Nicolas Dichtel <nicolas.dich...@6wind.com>
Reviewed-by: Tobias Klauser <tklau...@distanz.ch>
---
 arch/nios2/include/uapi/asm/Kbuild | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/nios2/include/uapi/asm/Kbuild 
b/arch/nios2/include/uapi/asm/Kbuild
index e0bb972a50d7..69c965304146 100644
--- a/arch/nios2/include/uapi/asm/Kbuild
+++ b/arch/nios2/include/uapi/asm/Kbuild
@@ -2,4 +2,5 @@ include include/uapi/asm-generic/Kbuild.asm
 
 header-y += elf.h
 
+generic-y += setup.h
 generic-y += ucontext.h
-- 
2.8.1



[PATCH v10 02/11] nios2: put setup.h in uapi

2017-03-14 Thread Nicolas Dichtel
This header file is exported, but from a userland pov, it's just a wrapper
to asm-generic/setup.h.

Signed-off-by: Nicolas Dichtel 
Reviewed-by: Tobias Klauser 
---
 arch/nios2/include/uapi/asm/Kbuild | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/nios2/include/uapi/asm/Kbuild 
b/arch/nios2/include/uapi/asm/Kbuild
index e0bb972a50d7..69c965304146 100644
--- a/arch/nios2/include/uapi/asm/Kbuild
+++ b/arch/nios2/include/uapi/asm/Kbuild
@@ -2,4 +2,5 @@ include include/uapi/asm-generic/Kbuild.asm
 
 header-y += elf.h
 
+generic-y += setup.h
 generic-y += ucontext.h
-- 
2.8.1



[PATCH v10 08/11] cryptouser.h: fix include from userland

2017-03-14 Thread Nicolas Dichtel
This patch prepares the uapi export by fixing the following error:

.../linux/cryptouser.h:58:16: error: ‘CRYPTO_MAX_ALG_NAME’ undeclared here (not 
in a function)
  char cru_name[CRYPTO_MAX_ALG_NAME];

Signed-off-by: Nicolas Dichtel <nicolas.dich...@6wind.com>
Acked-by: Herbert Xu <herb...@gondor.apana.org.au>
---
 include/linux/crypto.h  |  2 +-
 include/uapi/linux/crypto.h | 14 ++
 include/uapi/linux/cryptouser.h |  6 ++
 3 files changed, 21 insertions(+), 1 deletion(-)
 create mode 100644 include/uapi/linux/crypto.h

diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index c0b0cf3d2d2f..cc2425ba8527 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /*
  * Autoloaded crypto modules should only use a prefixed name to avoid allowing
@@ -123,7 +124,6 @@
 /*
  * Miscellaneous stuff.
  */
-#define CRYPTO_MAX_ALG_NAME64
 
 /*
  * The macro CRYPTO_MINALIGN_ATTR (along with the void * type in the actual
diff --git a/include/uapi/linux/crypto.h b/include/uapi/linux/crypto.h
new file mode 100644
index ..e342c5a5ac50
--- /dev/null
+++ b/include/uapi/linux/crypto.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright (c) 2017 Nicolas Dichtel <nicolas.dich...@6wind.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ */
+
+#ifndef _UAPI_CRYPTO_H
+#define _UAPI_CRYPTO_H
+
+#define CRYPTO_MAX_ALG_NAME64
+
+#endif /* _UAPI_CRYPTO_H */
diff --git a/include/uapi/linux/cryptouser.h b/include/uapi/linux/cryptouser.h
index c6a09c5261e7..ce3c64fb89e1 100644
--- a/include/uapi/linux/cryptouser.h
+++ b/include/uapi/linux/cryptouser.h
@@ -18,7 +18,11 @@
  * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+#ifndef _UAPI_CRYPTOUSER_H
+#define _UAPI_CRYPTOUSER_H
+
 #include 
+#include 
 
 /* Netlink configuration messages.  */
 enum {
@@ -121,3 +125,5 @@ struct crypto_report_acomp {
 
 #define CRYPTO_REPORT_MAXSIZE (sizeof(struct crypto_user_alg) + \
   sizeof(struct crypto_report_blkcipher))
+
+#endif /* _UAPI_CRYPTOUSER_H */
-- 
2.8.1



[PATCH v10 08/11] cryptouser.h: fix include from userland

2017-03-14 Thread Nicolas Dichtel
This patch prepares the uapi export by fixing the following error:

.../linux/cryptouser.h:58:16: error: ‘CRYPTO_MAX_ALG_NAME’ undeclared here (not 
in a function)
  char cru_name[CRYPTO_MAX_ALG_NAME];

Signed-off-by: Nicolas Dichtel 
Acked-by: Herbert Xu 
---
 include/linux/crypto.h  |  2 +-
 include/uapi/linux/crypto.h | 14 ++
 include/uapi/linux/cryptouser.h |  6 ++
 3 files changed, 21 insertions(+), 1 deletion(-)
 create mode 100644 include/uapi/linux/crypto.h

diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index c0b0cf3d2d2f..cc2425ba8527 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /*
  * Autoloaded crypto modules should only use a prefixed name to avoid allowing
@@ -123,7 +124,6 @@
 /*
  * Miscellaneous stuff.
  */
-#define CRYPTO_MAX_ALG_NAME64
 
 /*
  * The macro CRYPTO_MINALIGN_ATTR (along with the void * type in the actual
diff --git a/include/uapi/linux/crypto.h b/include/uapi/linux/crypto.h
new file mode 100644
index ..e342c5a5ac50
--- /dev/null
+++ b/include/uapi/linux/crypto.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright (c) 2017 Nicolas Dichtel 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ */
+
+#ifndef _UAPI_CRYPTO_H
+#define _UAPI_CRYPTO_H
+
+#define CRYPTO_MAX_ALG_NAME64
+
+#endif /* _UAPI_CRYPTO_H */
diff --git a/include/uapi/linux/cryptouser.h b/include/uapi/linux/cryptouser.h
index c6a09c5261e7..ce3c64fb89e1 100644
--- a/include/uapi/linux/cryptouser.h
+++ b/include/uapi/linux/cryptouser.h
@@ -18,7 +18,11 @@
  * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+#ifndef _UAPI_CRYPTOUSER_H
+#define _UAPI_CRYPTOUSER_H
+
 #include 
+#include 
 
 /* Netlink configuration messages.  */
 enum {
@@ -121,3 +125,5 @@ struct crypto_report_acomp {
 
 #define CRYPTO_REPORT_MAXSIZE (sizeof(struct crypto_user_alg) + \
   sizeof(struct crypto_report_blkcipher))
+
+#endif /* _UAPI_CRYPTOUSER_H */
-- 
2.8.1



[PATCH v10 01/11] h8300: put bitsperlong.h in uapi

2017-03-14 Thread Nicolas Dichtel
This header file is exported, thus move it to uapi.

Signed-off-by: Nicolas Dichtel <nicolas.dich...@6wind.com>
---
 arch/h8300/include/asm/bitsperlong.h  | 14 --
 arch/h8300/include/uapi/asm/bitsperlong.h | 14 ++
 2 files changed, 14 insertions(+), 14 deletions(-)
 delete mode 100644 arch/h8300/include/asm/bitsperlong.h
 create mode 100644 arch/h8300/include/uapi/asm/bitsperlong.h

diff --git a/arch/h8300/include/asm/bitsperlong.h 
b/arch/h8300/include/asm/bitsperlong.h
deleted file mode 100644
index e140e46729ac..
--- a/arch/h8300/include/asm/bitsperlong.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef __ASM_H8300_BITS_PER_LONG
-#define __ASM_H8300_BITS_PER_LONG
-
-#include 
-
-#if !defined(__ASSEMBLY__)
-/* h8300-unknown-linux required long */
-#define __kernel_size_t __kernel_size_t
-typedef unsigned long  __kernel_size_t;
-typedef long   __kernel_ssize_t;
-typedef long   __kernel_ptrdiff_t;
-#endif
-
-#endif /* __ASM_H8300_BITS_PER_LONG */
diff --git a/arch/h8300/include/uapi/asm/bitsperlong.h 
b/arch/h8300/include/uapi/asm/bitsperlong.h
new file mode 100644
index ..e56cf72369b6
--- /dev/null
+++ b/arch/h8300/include/uapi/asm/bitsperlong.h
@@ -0,0 +1,14 @@
+#ifndef _UAPI_ASM_H8300_BITS_PER_LONG
+#define _UAPI_ASM_H8300_BITS_PER_LONG
+
+#include 
+
+#if !defined(__ASSEMBLY__)
+/* h8300-unknown-linux required long */
+#define __kernel_size_t __kernel_size_t
+typedef unsigned long  __kernel_size_t;
+typedef long   __kernel_ssize_t;
+typedef long   __kernel_ptrdiff_t;
+#endif
+
+#endif /* _UAPI_ASM_H8300_BITS_PER_LONG */
-- 
2.8.1



[PATCH v10 01/11] h8300: put bitsperlong.h in uapi

2017-03-14 Thread Nicolas Dichtel
This header file is exported, thus move it to uapi.

Signed-off-by: Nicolas Dichtel 
---
 arch/h8300/include/asm/bitsperlong.h  | 14 --
 arch/h8300/include/uapi/asm/bitsperlong.h | 14 ++
 2 files changed, 14 insertions(+), 14 deletions(-)
 delete mode 100644 arch/h8300/include/asm/bitsperlong.h
 create mode 100644 arch/h8300/include/uapi/asm/bitsperlong.h

diff --git a/arch/h8300/include/asm/bitsperlong.h 
b/arch/h8300/include/asm/bitsperlong.h
deleted file mode 100644
index e140e46729ac..
--- a/arch/h8300/include/asm/bitsperlong.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef __ASM_H8300_BITS_PER_LONG
-#define __ASM_H8300_BITS_PER_LONG
-
-#include 
-
-#if !defined(__ASSEMBLY__)
-/* h8300-unknown-linux required long */
-#define __kernel_size_t __kernel_size_t
-typedef unsigned long  __kernel_size_t;
-typedef long   __kernel_ssize_t;
-typedef long   __kernel_ptrdiff_t;
-#endif
-
-#endif /* __ASM_H8300_BITS_PER_LONG */
diff --git a/arch/h8300/include/uapi/asm/bitsperlong.h 
b/arch/h8300/include/uapi/asm/bitsperlong.h
new file mode 100644
index ..e56cf72369b6
--- /dev/null
+++ b/arch/h8300/include/uapi/asm/bitsperlong.h
@@ -0,0 +1,14 @@
+#ifndef _UAPI_ASM_H8300_BITS_PER_LONG
+#define _UAPI_ASM_H8300_BITS_PER_LONG
+
+#include 
+
+#if !defined(__ASSEMBLY__)
+/* h8300-unknown-linux required long */
+#define __kernel_size_t __kernel_size_t
+typedef unsigned long  __kernel_size_t;
+typedef long   __kernel_ssize_t;
+typedef long   __kernel_ptrdiff_t;
+#endif
+
+#endif /* _UAPI_ASM_H8300_BITS_PER_LONG */
-- 
2.8.1



[PATCH v10 11/11] uapi: export all arch specifics directories

2017-03-14 Thread Nicolas Dichtel
This patch removes the need of subdir-y. Now all files/directories under
arch//include/uapi/ are exported.

The only change for userland is the layout of the command 'make
headers_install_all': directories asm- are replaced by arch-/.
Those new directories contains all files/directories of the specified arch.

Note that only cris and tile have more directories than only asm:
 - arch-v[10|32] for cris;
 - arch for tile.

Signed-off-by: Nicolas Dichtel <nicolas.dich...@6wind.com>
---
 Documentation/kbuild/makefiles.txt | 15 +--
 Makefile   |  6 +++---
 arch/cris/include/uapi/asm/Kbuild  |  3 ---
 arch/tile/include/uapi/asm/Kbuild  |  2 --
 scripts/Makefile.headersinst   |  3 +--
 5 files changed, 5 insertions(+), 24 deletions(-)

diff --git a/Documentation/kbuild/makefiles.txt 
b/Documentation/kbuild/makefiles.txt
index 91ffb391ed54..223b33d5195a 100644
--- a/Documentation/kbuild/makefiles.txt
+++ b/Documentation/kbuild/makefiles.txt
@@ -49,7 +49,6 @@ This document describes the Linux kernel Makefiles.
--- 7.3 generic-y
--- 7.4 generated-y
--- 7.5 mandatory-y
-   --- 7.6 subdir-y
 
=== 8 Kbuild Variables
=== 9 Makefile language
@@ -1265,7 +1264,7 @@ The pre-processing does:
 - drop all sections that are kernel internal (guarded by ifdef __KERNEL__)
 
 All headers under include/uapi/, include/generated/uapi/,
-arch//include/uapi/asm/ and arch//include/generated/uapi/asm/
+arch//include/uapi/ and arch//include/generated/uapi/
 are exported.
 
 A Kbuild file may be defined under arch//include/uapi/asm/ and
@@ -1338,18 +1337,6 @@ See subsequent chapter for the syntax of the Kbuild file.
The convention is to list one subdir per line and
preferably in alphabetic order.
 
-   --- 7.6 subdir-y
-
-   subdir-y may be used to specify a subdirectory to be exported.
-
-   Example:
-   #arch/cris/include/uapi/asm/Kbuild
-   subdir-y += ../arch-v10/arch/
-   subdir-y += ../arch-v32/arch/
-
-   The convention is to list one subdir per line and
-   preferably in alphabetic order.
-
 === 8 Kbuild Variables
 
 The top Makefile exports the following variables:
diff --git a/Makefile b/Makefile
index 165cf9783a5d..954b20072c42 100644
--- a/Makefile
+++ b/Makefile
@@ -1128,7 +1128,7 @@ firmware_install:
 export INSTALL_HDR_PATH = $(objtree)/usr
 
 # If we do an all arch process set dst to asm-$(hdr-arch)
-hdr-dst = $(if $(KBUILD_HEADERS), dst=include/asm-$(hdr-arch), dst=include/asm)
+hdr-dst = $(if $(KBUILD_HEADERS), dst=include/arch-$(hdr-arch), dst=include)
 
 PHONY += archheaders
 archheaders:
@@ -1149,7 +1149,7 @@ headers_install: __headers
$(if $(wildcard $(srctree)/arch/$(hdr-arch)/include/uapi/asm/Kbuild),, \
  $(error Headers not exportable for the $(SRCARCH) architecture))
$(Q)$(MAKE) $(hdr-inst)=include/uapi
-   $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi/asm $(hdr-dst)
+   $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi $(hdr-dst)
 
 PHONY += headers_check_all
 headers_check_all: headers_install_all
@@ -1158,7 +1158,7 @@ headers_check_all: headers_install_all
 PHONY += headers_check
 headers_check: headers_install
$(Q)$(MAKE) $(hdr-inst)=include/uapi HDRCHECK=1
-   $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi/asm $(hdr-dst) 
HDRCHECK=1
+   $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi/ $(hdr-dst) 
HDRCHECK=1
 
 # ---
 # Kernel selftest
diff --git a/arch/cris/include/uapi/asm/Kbuild 
b/arch/cris/include/uapi/asm/Kbuild
index d0c5471856e0..b15bf6bc0e94 100644
--- a/arch/cris/include/uapi/asm/Kbuild
+++ b/arch/cris/include/uapi/asm/Kbuild
@@ -1,5 +1,2 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
-
-subdir-y += ../arch-v10/arch/
-subdir-y += ../arch-v32/arch/
diff --git a/arch/tile/include/uapi/asm/Kbuild 
b/arch/tile/include/uapi/asm/Kbuild
index e0a50111e07f..0c74c3c5ebfa 100644
--- a/arch/tile/include/uapi/asm/Kbuild
+++ b/arch/tile/include/uapi/asm/Kbuild
@@ -2,5 +2,3 @@
 include include/uapi/asm-generic/Kbuild.asm
 
 generic-y += ucontext.h
-
-subdir-y += ../arch
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index 6e56155579d8..3d692b650687 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -2,7 +2,7 @@
 # Installing headers
 #
 # All headers under include/uapi, include/generated/uapi,
-# arch//include/uapi/asm and arch//include/generated/uapi/asm are
+# arch//include/uapi and arch//include/generated/uapi are
 # exported.
 # They are preprocessed to remove __KERNEL__ section of the file.
 #
@@ -30,7 +30,6 @@ installdir:= $(INSTALL_HDR_PATH)/$(subst uapi/,,$(_dst))
 srcdir:= $(srctree)/$(obj)
 gendir:= $(objtree)/$(gen)
 subdirs   := $(pa

[PATCH v10 11/11] uapi: export all arch specifics directories

2017-03-14 Thread Nicolas Dichtel
This patch removes the need of subdir-y. Now all files/directories under
arch//include/uapi/ are exported.

The only change for userland is the layout of the command 'make
headers_install_all': directories asm- are replaced by arch-/.
Those new directories contains all files/directories of the specified arch.

Note that only cris and tile have more directories than only asm:
 - arch-v[10|32] for cris;
 - arch for tile.

Signed-off-by: Nicolas Dichtel 
---
 Documentation/kbuild/makefiles.txt | 15 +--
 Makefile   |  6 +++---
 arch/cris/include/uapi/asm/Kbuild  |  3 ---
 arch/tile/include/uapi/asm/Kbuild  |  2 --
 scripts/Makefile.headersinst   |  3 +--
 5 files changed, 5 insertions(+), 24 deletions(-)

diff --git a/Documentation/kbuild/makefiles.txt 
b/Documentation/kbuild/makefiles.txt
index 91ffb391ed54..223b33d5195a 100644
--- a/Documentation/kbuild/makefiles.txt
+++ b/Documentation/kbuild/makefiles.txt
@@ -49,7 +49,6 @@ This document describes the Linux kernel Makefiles.
--- 7.3 generic-y
--- 7.4 generated-y
--- 7.5 mandatory-y
-   --- 7.6 subdir-y
 
=== 8 Kbuild Variables
=== 9 Makefile language
@@ -1265,7 +1264,7 @@ The pre-processing does:
 - drop all sections that are kernel internal (guarded by ifdef __KERNEL__)
 
 All headers under include/uapi/, include/generated/uapi/,
-arch//include/uapi/asm/ and arch//include/generated/uapi/asm/
+arch//include/uapi/ and arch//include/generated/uapi/
 are exported.
 
 A Kbuild file may be defined under arch//include/uapi/asm/ and
@@ -1338,18 +1337,6 @@ See subsequent chapter for the syntax of the Kbuild file.
The convention is to list one subdir per line and
preferably in alphabetic order.
 
-   --- 7.6 subdir-y
-
-   subdir-y may be used to specify a subdirectory to be exported.
-
-   Example:
-   #arch/cris/include/uapi/asm/Kbuild
-   subdir-y += ../arch-v10/arch/
-   subdir-y += ../arch-v32/arch/
-
-   The convention is to list one subdir per line and
-   preferably in alphabetic order.
-
 === 8 Kbuild Variables
 
 The top Makefile exports the following variables:
diff --git a/Makefile b/Makefile
index 165cf9783a5d..954b20072c42 100644
--- a/Makefile
+++ b/Makefile
@@ -1128,7 +1128,7 @@ firmware_install:
 export INSTALL_HDR_PATH = $(objtree)/usr
 
 # If we do an all arch process set dst to asm-$(hdr-arch)
-hdr-dst = $(if $(KBUILD_HEADERS), dst=include/asm-$(hdr-arch), dst=include/asm)
+hdr-dst = $(if $(KBUILD_HEADERS), dst=include/arch-$(hdr-arch), dst=include)
 
 PHONY += archheaders
 archheaders:
@@ -1149,7 +1149,7 @@ headers_install: __headers
$(if $(wildcard $(srctree)/arch/$(hdr-arch)/include/uapi/asm/Kbuild),, \
  $(error Headers not exportable for the $(SRCARCH) architecture))
$(Q)$(MAKE) $(hdr-inst)=include/uapi
-   $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi/asm $(hdr-dst)
+   $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi $(hdr-dst)
 
 PHONY += headers_check_all
 headers_check_all: headers_install_all
@@ -1158,7 +1158,7 @@ headers_check_all: headers_install_all
 PHONY += headers_check
 headers_check: headers_install
$(Q)$(MAKE) $(hdr-inst)=include/uapi HDRCHECK=1
-   $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi/asm $(hdr-dst) 
HDRCHECK=1
+   $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi/ $(hdr-dst) 
HDRCHECK=1
 
 # ---
 # Kernel selftest
diff --git a/arch/cris/include/uapi/asm/Kbuild 
b/arch/cris/include/uapi/asm/Kbuild
index d0c5471856e0..b15bf6bc0e94 100644
--- a/arch/cris/include/uapi/asm/Kbuild
+++ b/arch/cris/include/uapi/asm/Kbuild
@@ -1,5 +1,2 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
-
-subdir-y += ../arch-v10/arch/
-subdir-y += ../arch-v32/arch/
diff --git a/arch/tile/include/uapi/asm/Kbuild 
b/arch/tile/include/uapi/asm/Kbuild
index e0a50111e07f..0c74c3c5ebfa 100644
--- a/arch/tile/include/uapi/asm/Kbuild
+++ b/arch/tile/include/uapi/asm/Kbuild
@@ -2,5 +2,3 @@
 include include/uapi/asm-generic/Kbuild.asm
 
 generic-y += ucontext.h
-
-subdir-y += ../arch
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index 6e56155579d8..3d692b650687 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -2,7 +2,7 @@
 # Installing headers
 #
 # All headers under include/uapi, include/generated/uapi,
-# arch//include/uapi/asm and arch//include/generated/uapi/asm are
+# arch//include/uapi and arch//include/generated/uapi are
 # exported.
 # They are preprocessed to remove __KERNEL__ section of the file.
 #
@@ -30,7 +30,6 @@ installdir:= $(INSTALL_HDR_PATH)/$(subst uapi/,,$(_dst))
 srcdir:= $(srctree)/$(obj)
 gendir:= $(objtree)/$(gen)
 subdirs   := $(patsubst $(srcdir)/%/.,%,$(wildcard

[PATCH v10 04/11] Makefile.headersinst: cleanup input files

2017-03-14 Thread Nicolas Dichtel
After the last three patches, all exported headers are under uapi/, thus
input-files2 are not needed anymore.
The side effect is that input-files1-name is exactly header-y.

Note also that input-files3-name is genhdr-y.

Signed-off-by: Nicolas Dichtel <nicolas.dich...@6wind.com>
---
 scripts/Makefile.headersinst | 38 ++
 1 file changed, 14 insertions(+), 24 deletions(-)

diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index 1106d6ca3a38..7bd9df6efe2f 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -40,31 +40,20 @@ wrapper-files := $(filter $(header-y), $(generic-y))
 srcdir:= $(srctree)/$(obj)
 gendir:= $(objtree)/$(gen)
 
-oldsrcdir := $(srctree)/$(subst /uapi,,$(obj))
-
 # all headers files for this dir
 header-y  := $(filter-out $(generic-y), $(header-y))
 all-files := $(header-y) $(genhdr-y) $(wrapper-files)
 output-files  := $(addprefix $(installdir)/, $(all-files))
 
-input-files1  := $(foreach hdr, $(header-y), \
-  $(if $(wildcard $(srcdir)/$(hdr)), \
-   $(wildcard $(srcdir)/$(hdr))) \
-  )
-input-files1-name := $(notdir $(input-files1))
-input-files2  := $(foreach hdr, $(header-y), \
-  $(if  $(wildcard $(srcdir)/$(hdr)),, \
-   $(if $(wildcard $(oldsrcdir)/$(hdr)), \
-   $(wildcard $(oldsrcdir)/$(hdr)), \
-   $(error Missing UAPI file $(srcdir)/$(hdr))) \
-  ))
-input-files2-name := $(notdir $(input-files2))
-input-files3  := $(foreach hdr, $(genhdr-y), \
-  $(if $(wildcard $(gendir)/$(hdr)), \
-   $(wildcard $(gendir)/$(hdr)), \
-   $(error Missing generated UAPI file $(gendir)/$(hdr)) \
-  ))
-input-files3-name := $(notdir $(input-files3))
+# Check that all expected files exist
+$(foreach hdr, $(header-y), \
+  $(if $(wildcard $(srcdir)/$(hdr)),, \
+   $(error Missing UAPI file $(srcdir)/$(hdr)) \
+   ))
+$(foreach hdr, $(genhdr-y), \
+  $(if $(wildcard $(gendir)/$(hdr)),, \
+   $(error Missing generated UAPI file $(gendir)/$(hdr)) \
+  ))
 
 # Work out what needs to be removed
 oldheaders:= $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h))
@@ -78,9 +67,8 @@ printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@))
 quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\
 file$(if $(word 2, $(all-files)),s))
   cmd_install = \
-$(CONFIG_SHELL) $< $(installdir) $(srcdir) $(input-files1-name); \
-$(CONFIG_SHELL) $< $(installdir) $(oldsrcdir) $(input-files2-name); \
-$(CONFIG_SHELL) $< $(installdir) $(gendir) $(input-files3-name); \
+$(CONFIG_SHELL) $< $(installdir) $(srcdir) $(header-y); \
+$(CONFIG_SHELL) $< $(installdir) $(gendir) $(genhdr-y); \
 for F in $(wrapper-files); do   \
 echo "\#include " > $(installdir)/$$F;\
 done;   \
@@ -106,7 +94,9 @@ __headersinst: $(subdirs) $(install-file)
@:
 
 targets += $(install-file)
-$(install-file): scripts/headers_install.sh $(input-files1) $(input-files2) 
$(input-files3) FORCE
+$(install-file): scripts/headers_install.sh \
+$(addprefix $(srcdir)/,$(header-y)) \
+$(addprefix $(gendir)/,$(genhdr-y)) FORCE
$(if $(unwanted),$(call cmd,remove),)
$(if $(wildcard $(dir $@)),,$(shell mkdir -p $(dir $@)))
$(call if_changed,install)
-- 
2.8.1



  1   2   3   4   5   6   7   >