* [PATCH net-next 7/7] net: hns3: Cleanup for non-static function in hns3 driver
From: Yunsheng Lin @ 2017-10-09 7:44 UTC (permalink / raw)
To: davem
Cc: huangdaode, xuwei5, liguozhu, Yisen.Zhuang, gabriele.paoloni,
john.garry, linuxarm, yisen.zhuang, salil.mehta, lipeng321,
netdev, linux-kernel
In-Reply-To: <1507535041-204956-1-git-send-email-linyunsheng@huawei.com>
This patch fixes the following warning from sparse:
warning: symbol 'hns3_set_multicast_list' was not declared.
Should it be static.
hns3_set_multicast_list turns out to be not used, so delete it.
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
---
.../net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c | 4 ++--
.../net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 14 +++++++-------
.../net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c | 20 ++++----------------
.../ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c | 4 ++--
4 files changed, 15 insertions(+), 27 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c
index 05985d8..8ecd807 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c
@@ -276,8 +276,8 @@ int hclge_cmd_send(struct hclge_hw *hw, struct hclge_desc *desc, int num)
return retval;
}
-enum hclge_cmd_status hclge_cmd_query_firmware_version(struct hclge_hw *hw,
- u32 *version)
+static enum hclge_cmd_status hclge_cmd_query_firmware_version(
+ struct hclge_hw *hw, u32 *version)
{
struct hclge_query_version_cmd *resp;
struct hclge_desc desc;
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index 6115c2f..c91c779 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -1550,8 +1550,8 @@ static int hclge_tx_buffer_calc(struct hclge_dev *hdev,
* @buf_alloc: pointer to buffer calculation data
* @return: 0: calculate sucessful, negative: fail
*/
-int hclge_rx_buffer_calc(struct hclge_dev *hdev,
- struct hclge_pkt_buf_alloc *buf_alloc)
+static int hclge_rx_buffer_calc(struct hclge_dev *hdev,
+ struct hclge_pkt_buf_alloc *buf_alloc)
{
u32 rx_all = hdev->pkt_buf_size;
int no_pfc_priv_num, pfc_priv_num;
@@ -2828,9 +2828,9 @@ int hclge_map_vport_ring_to_vector(struct hclge_vport *vport, int vector_id,
return 0;
}
-int hclge_map_handle_ring_to_vector(struct hnae3_handle *handle,
- int vector,
- struct hnae3_ring_chain_node *ring_chain)
+static int hclge_map_handle_ring_to_vector(
+ struct hnae3_handle *handle, int vector,
+ struct hnae3_ring_chain_node *ring_chain)
{
struct hclge_vport *vport = hclge_get_vport(handle);
struct hclge_dev *hdev = vport->back;
@@ -3206,8 +3206,8 @@ static void hclge_prepare_mac_addr(struct hclge_mac_vlan_tbl_entry_cmd *new_req,
new_req->mac_addr_lo16 = cpu_to_le16(low_val & 0xffff);
}
-u16 hclge_get_mac_addr_to_mta_index(struct hclge_vport *vport,
- const u8 *addr)
+static u16 hclge_get_mac_addr_to_mta_index(struct hclge_vport *vport,
+ const u8 *addr)
{
u16 high_val = addr[1] | (addr[0] << 8);
struct hclge_dev *hdev = vport->back;
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c
index aa73855..26bbc91 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c
@@ -24,7 +24,7 @@
#include "hnae3.h"
#include "hns3_enet.h"
-const char hns3_driver_name[] = "hns3";
+static const char hns3_driver_name[] = "hns3";
const char hns3_driver_version[] = VERMAGIC_STRING;
static const char hns3_driver_string[] =
"Hisilicon Ethernet Network Driver for Hip08 Family";
@@ -304,18 +304,6 @@ static int hns3_nic_net_stop(struct net_device *netdev)
return 0;
}
-void hns3_set_multicast_list(struct net_device *netdev)
-{
- struct hnae3_handle *h = hns3_get_handle(netdev);
- struct netdev_hw_addr *ha = NULL;
-
- if (h->ae_algo->ops->set_mc_addr) {
- netdev_for_each_mc_addr(ha, netdev)
- if (h->ae_algo->ops->set_mc_addr(h, ha->addr))
- netdev_err(netdev, "set multicast fail\n");
- }
-}
-
static int hns3_nic_uc_sync(struct net_device *netdev,
const unsigned char *addr)
{
@@ -360,7 +348,7 @@ static int hns3_nic_mc_unsync(struct net_device *netdev,
return 0;
}
-void hns3_nic_set_rx_mode(struct net_device *netdev)
+static void hns3_nic_set_rx_mode(struct net_device *netdev)
{
struct hnae3_handle *h = hns3_get_handle(netdev);
@@ -2596,7 +2584,7 @@ static void hns3_fini_ring(struct hns3_enet_ring *ring)
ring->next_to_use = 0;
}
-int hns3_buf_size2type(u32 buf_size)
+static int hns3_buf_size2type(u32 buf_size)
{
int bd_size_type;
@@ -2908,7 +2896,7 @@ static int hns3_client_setup_tc(struct hnae3_handle *handle, u8 tc)
return ret;
}
-const struct hnae3_client_ops client_ops = {
+static const struct hnae3_client_ops client_ops = {
.init_instance = hns3_client_init,
.uninit_instance = hns3_client_uninit,
.link_status_change = hns3_link_status_change,
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c
index a892a15..060bace 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c
@@ -215,8 +215,8 @@ static u64 *hns3_get_stats_tqps(struct hnae3_handle *handle, u64 *data)
* @stats: statistics info.
* @data: statistics data.
*/
-void hns3_get_stats(struct net_device *netdev, struct ethtool_stats *stats,
- u64 *data)
+static void hns3_get_stats(struct net_device *netdev,
+ struct ethtool_stats *stats, u64 *data)
{
struct hnae3_handle *h = hns3_get_handle(netdev);
u64 *p = data;
--
1.9.1
^ permalink raw reply related
* Re: [PATCH] net/core: Fix BUG to BUG_ON conditionals.
From: kbuild test robot @ 2017-10-09 6:45 UTC (permalink / raw)
To: Tim Hansen
Cc: kbuild-all, davem, willemb, edumazet, soheil, elena.reshetova,
pabeni, tom, Jason, fw, netdev, linux-kernel, alexander.levin,
devtimhansen
In-Reply-To: <20171008191720.prewqllyazdstwkp@debian>
[-- Attachment #1: Type: text/plain, Size: 5990 bytes --]
Hi Tim,
[auto build test ERROR on net-next/master]
[also build test ERROR on v4.14-rc4 next-20170929]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Tim-Hansen/net-core-Fix-BUG-to-BUG_ON-conditionals/20171009-070451
config: x86_64-randconfig-s1-10091351 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All error/warnings (new ones prefixed by >>):
In file included from include/uapi/linux/stddef.h:1:0,
from include/linux/stddef.h:4,
from include/uapi/linux/posix_types.h:4,
from include/uapi/linux/types.h:13,
from include/linux/types.h:5,
from include/linux/list.h:4,
from include/linux/module.h:9,
from net//core/skbuff.c:41:
net//core/skbuff.c: In function '__pskb_pull_tail':
>> include/linux/compiler.h:156:2: error: expected ';' before 'if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
>> net//core/skbuff.c:1884:2: note: in expansion of macro 'if'
if (!skb_has_frag_list(skb))
^~
>> include/linux/compiler.h:170:3: error: expected statement before ')' token
}))
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
>> net//core/skbuff.c:1884:2: note: in expansion of macro 'if'
if (!skb_has_frag_list(skb))
^~
include/linux/compiler.h:170:4: error: expected statement before ')' token
}))
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
>> net//core/skbuff.c:1884:2: note: in expansion of macro 'if'
if (!skb_has_frag_list(skb))
^~
--
In file included from include/uapi/linux/stddef.h:1:0,
from include/linux/stddef.h:4,
from include/uapi/linux/posix_types.h:4,
from include/uapi/linux/types.h:13,
from include/linux/types.h:5,
from include/linux/list.h:4,
from include/linux/module.h:9,
from net/core/skbuff.c:41:
net/core/skbuff.c: In function '__pskb_pull_tail':
>> include/linux/compiler.h:156:2: error: expected ';' before 'if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
net/core/skbuff.c:1884:2: note: in expansion of macro 'if'
if (!skb_has_frag_list(skb))
^~
>> include/linux/compiler.h:170:3: error: expected statement before ')' token
}))
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
net/core/skbuff.c:1884:2: note: in expansion of macro 'if'
if (!skb_has_frag_list(skb))
^~
include/linux/compiler.h:170:4: error: expected statement before ')' token
}))
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
net/core/skbuff.c:1884:2: note: in expansion of macro 'if'
if (!skb_has_frag_list(skb))
^~
vim +156 include/linux/compiler.h
2bcd521a Steven Rostedt 2008-11-21 148
2bcd521a Steven Rostedt 2008-11-21 149 #ifdef CONFIG_PROFILE_ALL_BRANCHES
2bcd521a Steven Rostedt 2008-11-21 150 /*
2bcd521a Steven Rostedt 2008-11-21 151 * "Define 'is'", Bill Clinton
2bcd521a Steven Rostedt 2008-11-21 152 * "Define 'if'", Steven Rostedt
2bcd521a Steven Rostedt 2008-11-21 153 */
ab3c9c68 Linus Torvalds 2009-04-07 154 #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
ab3c9c68 Linus Torvalds 2009-04-07 155 #define __trace_if(cond) \
b33c8ff4 Arnd Bergmann 2016-02-12 @156 if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
2bcd521a Steven Rostedt 2008-11-21 157 ({ \
2bcd521a Steven Rostedt 2008-11-21 158 int ______r; \
2bcd521a Steven Rostedt 2008-11-21 159 static struct ftrace_branch_data \
2bcd521a Steven Rostedt 2008-11-21 160 __attribute__((__aligned__(4))) \
2bcd521a Steven Rostedt 2008-11-21 161 __attribute__((section("_ftrace_branch"))) \
2bcd521a Steven Rostedt 2008-11-21 162 ______f = { \
2bcd521a Steven Rostedt 2008-11-21 163 .func = __func__, \
2bcd521a Steven Rostedt 2008-11-21 164 .file = __FILE__, \
2bcd521a Steven Rostedt 2008-11-21 165 .line = __LINE__, \
2bcd521a Steven Rostedt 2008-11-21 166 }; \
2bcd521a Steven Rostedt 2008-11-21 167 ______r = !!(cond); \
97e7e4f3 Witold Baryluk 2009-03-17 168 ______f.miss_hit[______r]++; \
2bcd521a Steven Rostedt 2008-11-21 169 ______r; \
2bcd521a Steven Rostedt 2008-11-21 @170 }))
2bcd521a Steven Rostedt 2008-11-21 171 #endif /* CONFIG_PROFILE_ALL_BRANCHES */
2bcd521a Steven Rostedt 2008-11-21 172
:::::: The code at line 156 was first introduced by commit
:::::: b33c8ff4431a343561e2319f17c14286f2aa52e2 tracing: Fix freak link error caused by branch tracer
:::::: TO: Arnd Bergmann <arnd@arndb.de>
:::::: CC: Steven Rostedt <rostedt@goodmis.org>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 29136 bytes --]
^ permalink raw reply
* [PATCH net] ipv4: Fix traffic triggered IPsec connections.
From: Steffen Klassert @ 2017-10-09 6:43 UTC (permalink / raw)
To: David Miller; +Cc: Tobias Brunner, Wei Wang, netdev
A recent patch removed the dst_free() on the allocated
dst_entry in ipv4_blackhole_route(). The dst_free() marked the
dst_entry as dead and added it to the gc list. I.e. it was setup
for a one time usage. As a result we may now have a blackhole
route cached at a socket on some IPsec scenarios. This makes the
connection unusable.
Fix this by marking the dst_entry directly at allocation time
as 'dead', so it is used only once.
Fixes: b838d5e1c5b6 ("ipv4: mark DST_NOGC and remove the operation of dst_free()")
Reported-by: Tobias Brunner <tobias@strongswan.org>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
net/ipv4/route.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index ac6fde5..3d9f1c2 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2513,7 +2513,7 @@ struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_or
struct rtable *ort = (struct rtable *) dst_orig;
struct rtable *rt;
- rt = dst_alloc(&ipv4_dst_blackhole_ops, NULL, 1, DST_OBSOLETE_NONE, 0);
+ rt = dst_alloc(&ipv4_dst_blackhole_ops, NULL, 1, DST_OBSOLETE_DEAD, 0);
if (rt) {
struct dst_entry *new = &rt->dst;
--
2.7.4
^ permalink raw reply related
* [PATCH net] ipv6: Fix traffic triggered IPsec connections.
From: Steffen Klassert @ 2017-10-09 6:39 UTC (permalink / raw)
To: David Miller; +Cc: Tobias Brunner, Wei Wang, netdev
A recent patch removed the dst_free() on the allocated
dst_entry in ipv6_blackhole_route(). The dst_free() marked
the dst_entry as dead and added it to the gc list. I.e. it
was setup for a one time usage. As a result we may now have
a blackhole route cached at a socket on some IPsec scenarios.
This makes the connection unusable.
Fix this by marking the dst_entry directly at allocation time
as 'dead', so it is used only once.
Fixes: 587fea741134 ("ipv6: mark DST_NOGC and remove the operation of dst_free()")
Reported-by: Tobias Brunner <tobias@strongswan.org>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
net/ipv6/route.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 26cc9f4..a96d5b3 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1325,7 +1325,7 @@ struct dst_entry *ip6_blackhole_route(struct net *net, struct dst_entry *dst_ori
struct dst_entry *new = NULL;
rt = dst_alloc(&ip6_dst_blackhole_ops, loopback_dev, 1,
- DST_OBSOLETE_NONE, 0);
+ DST_OBSOLETE_DEAD, 0);
if (rt) {
rt6_info_init(rt);
--
2.7.4
^ permalink raw reply related
* Re: [PATCH 10/12] net/mlx4: replace <linux/radix-tree.h> with <linux/radix-tree-root.h>
From: Leon Romanovsky @ 2017-10-09 6:10 UTC (permalink / raw)
To: Masahiro Yamada
Cc: David Miller, Linux Kernel Mailing List, Thomas Gleixner,
Andrew Morton, Ian Abbott, Ingo Molnar, Linus Torvalds,
linux-rdma-u79uwXL29TY76Z2rM5mHXA, yishaih-VPRAkNaXOzVWk0Htik3J/w,
tariqt-VPRAkNaXOzVWk0Htik3J/w, netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <CAK7LNARAhAaO+YjqXyBbi=-udCu8zzGnLMsoVNdkSXtXPuMKsA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 1763 bytes --]
On Mon, Oct 09, 2017 at 02:56:56PM +0900, Masahiro Yamada wrote:
> 2017-10-09 3:55 GMT+09:00 Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>:
> > On Mon, Oct 09, 2017 at 02:29:15AM +0900, Masahiro Yamada wrote:
> >> 2017-10-09 2:00 GMT+09:00 David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>:
> >> > From: Masahiro Yamada <yamada.masahiro-uWyLwvC0a2jby3iVrkZq2A@public.gmane.org>
> >> > Date: Mon, 9 Oct 2017 01:10:11 +0900
> >> >
> >> >> The headers
> >> >> - include/linux/mlx4/device.h
> >> >> - drivers/net/ethernet/mellanox/mlx4/mlx4.h
> >> >> require the definition of struct radix_tree_root, but do not need to
> >> >> know anything about other radix tree stuff.
> >> >>
> >> >> Include <linux/radix-tree-root.h> instead of <linux/radix-tree.h> to
> >> >> reduce the header dependency.
> >> >>
> >> >> While we are here, let's add missing <linux/radix-tree.h> where
> >> >> radix tree accessors are used.
> >> >>
> >> >> Signed-off-by: Masahiro Yamada <yamada.masahiro-uWyLwvC0a2jby3iVrkZq2A@public.gmane.org>
> >> >
> >> > Honestly this makes things more complicated.
> >>
> >>
> >> The idea is simple; include necessary headers explicitly.
> >>
> >> Putting everything into one common header
> >> means most of C files are forced to parse unnecessary headers.
> >
> > It is neglected, only first caller will actually parse that header file,
> > other callers will check the #ifndef pragma without need to reparse the
> > whole file.
> >
>
>
> You completely neglected the point of the discussion.
>
> I am trying to not include unnecessary headers at all.
>
I understand it and have no issues with that, just have hard time to justify for
myself any benefit of doing it.
Thanks
>
>
>
> --
> Best Regards
> Masahiro Yamada
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply
* Re: [PATCH 00/12] radix-tree: split out struct radix_tree_root out to <linux/radix-tree-root.h>
From: Leon Romanovsky @ 2017-10-09 6:05 UTC (permalink / raw)
To: Masahiro Yamada
Cc: Linux Kernel Mailing List, Thomas Gleixner, Andrew Morton,
Ian Abbott, Ingo Molnar, Linus Torvalds, linux-cachefs, linux-sh,
Rodrigo Vivi, dri-devel, David Airlie, linux-rdma, Yoshinori Sato,
Tariq Toukan, Rich Felker, Jani Nikula, J. Bruce Fields,
David Howells, intel-gfx, Yishai Hadas, Joonas
In-Reply-To: <CAK7LNAQrtikienLa+HXtnXmwCrTEQSnqU0Ne-BrFvKpaFMUxqQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1031 bytes --]
On Mon, Oct 09, 2017 at 02:58:58PM +0900, Masahiro Yamada wrote:
> 2017-10-09 3:52 GMT+09:00 Leon Romanovsky <leonro@mellanox.com>:
> > On Mon, Oct 09, 2017 at 01:10:01AM +0900, Masahiro Yamada wrote:
> >
> > <...>
> >>
> >> By splitting out the radix_tree_root definition,
> >> we can reduce the header file dependency.
> >>
> >> Reducing the header dependency will help for speeding the kernel
> >> build, suppressing unnecessary recompile of objects during
> >> git-bisect'ing, etc.
> >
> > If we judge by the diffstat of this series, there won't be any
> > visible change in anything mentioned above.
>
>
> Of course, judging by the diffstat is wrong.
>
I'm more than happy to be wrong and you for sure can help me.
Can you provide any quantitative support of your claims?
Thanks
>
>
> --
> Best Regards
> Masahiro Yamada
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply
* Re: [PATCH 00/12] radix-tree: split out struct radix_tree_root out to <linux/radix-tree-root.h>
From: Masahiro Yamada @ 2017-10-09 5:58 UTC (permalink / raw)
To: Leon Romanovsky
Cc: Linux Kernel Mailing List, Thomas Gleixner, Andrew Morton,
Ian Abbott, Ingo Molnar, Linus Torvalds, linux-cachefs, linux-sh,
Rodrigo Vivi, dri-devel, David Airlie, linux-rdma, Yoshinori Sato,
Tariq Toukan, Rich Felker, Jani Nikula, J. Bruce Fields,
David Howells, intel-gfx, Yishai Hadas, Joonas
In-Reply-To: <20171008185233.GF25829@mtr-leonro.local>
2017-10-09 3:52 GMT+09:00 Leon Romanovsky <leonro@mellanox.com>:
> On Mon, Oct 09, 2017 at 01:10:01AM +0900, Masahiro Yamada wrote:
>
> <...>
>>
>> By splitting out the radix_tree_root definition,
>> we can reduce the header file dependency.
>>
>> Reducing the header dependency will help for speeding the kernel
>> build, suppressing unnecessary recompile of objects during
>> git-bisect'ing, etc.
>
> If we judge by the diffstat of this series, there won't be any
> visible change in anything mentioned above.
Of course, judging by the diffstat is wrong.
--
Best Regards
Masahiro Yamada
^ permalink raw reply
* Re: [PATCH 10/12] net/mlx4: replace <linux/radix-tree.h> with <linux/radix-tree-root.h>
From: Masahiro Yamada @ 2017-10-09 5:56 UTC (permalink / raw)
To: Leon Romanovsky
Cc: David Miller, Linux Kernel Mailing List, Thomas Gleixner,
Andrew Morton, Ian Abbott, Ingo Molnar, Linus Torvalds,
linux-rdma, yishaih, tariqt, netdev
In-Reply-To: <20171008185529.GG25829@mtr-leonro.local>
2017-10-09 3:55 GMT+09:00 Leon Romanovsky <leon@kernel.org>:
> On Mon, Oct 09, 2017 at 02:29:15AM +0900, Masahiro Yamada wrote:
>> 2017-10-09 2:00 GMT+09:00 David Miller <davem@davemloft.net>:
>> > From: Masahiro Yamada <yamada.masahiro@socionext.com>
>> > Date: Mon, 9 Oct 2017 01:10:11 +0900
>> >
>> >> The headers
>> >> - include/linux/mlx4/device.h
>> >> - drivers/net/ethernet/mellanox/mlx4/mlx4.h
>> >> require the definition of struct radix_tree_root, but do not need to
>> >> know anything about other radix tree stuff.
>> >>
>> >> Include <linux/radix-tree-root.h> instead of <linux/radix-tree.h> to
>> >> reduce the header dependency.
>> >>
>> >> While we are here, let's add missing <linux/radix-tree.h> where
>> >> radix tree accessors are used.
>> >>
>> >> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>> >
>> > Honestly this makes things more complicated.
>>
>>
>> The idea is simple; include necessary headers explicitly.
>>
>> Putting everything into one common header
>> means most of C files are forced to parse unnecessary headers.
>
> It is neglected, only first caller will actually parse that header file,
> other callers will check the #ifndef pragma without need to reparse the
> whole file.
>
You completely neglected the point of the discussion.
I am trying to not include unnecessary headers at all.
--
Best Regards
Masahiro Yamada
^ permalink raw reply
* Re: [PATCH 10/12] net/mlx4: replace <linux/radix-tree.h> with <linux/radix-tree-root.h>
From: Masahiro Yamada @ 2017-10-09 5:55 UTC (permalink / raw)
To: Joe Perches
Cc: David Miller, Linux Kernel Mailing List, Thomas Gleixner,
Andrew Morton, Ian Abbott, Ingo Molnar, Linus Torvalds,
linux-rdma-u79uwXL29TY76Z2rM5mHXA, yishaih-VPRAkNaXOzVWk0Htik3J/w,
tariqt-VPRAkNaXOzVWk0Htik3J/w, netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1507483942.11434.4.camel-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
2017-10-09 2:32 GMT+09:00 Joe Perches <joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>:
> On Mon, 2017-10-09 at 02:29 +0900, Masahiro Yamada wrote:
>> The idea is simple; include necessary headers explicitly.
>
> Try that for kernel.h
>
> There's a reason aggregation of #includes is useful.
>
We should use a common sense for the balance between
- aggregation of #includes
- reduce the number of parsed headers
As I had already said, if you do not like this change, you can just
throw it away.
That's fine because the impact is very limited.
Honestly, I am not so interested in this driver.
I changed sh, net/mlx4, net/mlx5, drm/i915 for bonus while I am here.
I assume your objection is addressed to this driver change,
not the whole series.
I am more interested in the global headers like
include/linux/{irqdomain.h, fs.h} etc.
radix-tree-root.h vs radix-tree.h
has a big difference in terms of parsed headers (17 vs 128).
For example, the following is the analysis on arm64.
<linux/radix-tree-root.h> include the following 17 headers:
include/linux/radix-tree-root.h \
include/linux/types.h \
include/uapi/linux/types.h \
arch/arm64/include/generated/uapi/asm/types.h \
include/uapi/asm-generic/types.h \
include/asm-generic/int-ll64.h \
include/uapi/asm-generic/int-ll64.h \
arch/arm64/include/uapi/asm/bitsperlong.h \
include/asm-generic/bitsperlong.h \
include/uapi/asm-generic/bitsperlong.h \
include/uapi/linux/posix_types.h \
include/linux/stddef.h \
include/uapi/linux/stddef.h \
include/linux/compiler.h \
include/linux/compiler-gcc.h \
arch/arm64/include/uapi/asm/posix_types.h \
include/uapi/asm-generic/posix_types.h \
<linux/radix-tree.h> include the following 128 headers:
include/linux/radix-tree.h \
include/linux/bitops.h \
arch/arm64/include/generated/uapi/asm/types.h \
include/uapi/asm-generic/types.h \
include/asm-generic/int-ll64.h \
include/uapi/asm-generic/int-ll64.h \
arch/arm64/include/uapi/asm/bitsperlong.h \
include/asm-generic/bitsperlong.h \
include/uapi/asm-generic/bitsperlong.h \
arch/arm64/include/asm/bitops.h \
include/linux/compiler.h \
include/linux/compiler-gcc.h \
include/uapi/linux/types.h \
include/uapi/linux/posix_types.h \
include/linux/stddef.h \
include/uapi/linux/stddef.h \
arch/arm64/include/uapi/asm/posix_types.h \
include/uapi/asm-generic/posix_types.h \
arch/arm64/include/asm/barrier.h \
include/asm-generic/barrier.h \
include/asm-generic/bitops/builtin-__ffs.h \
include/asm-generic/bitops/builtin-ffs.h \
include/asm-generic/bitops/builtin-__fls.h \
include/asm-generic/bitops/builtin-fls.h \
include/asm-generic/bitops/ffz.h \
include/asm-generic/bitops/fls64.h \
include/asm-generic/bitops/find.h \
include/asm-generic/bitops/sched.h \
include/asm-generic/bitops/hweight.h \
include/asm-generic/bitops/arch_hweight.h \
include/asm-generic/bitops/const_hweight.h \
include/asm-generic/bitops/lock.h \
include/asm-generic/bitops/non-atomic.h \
include/asm-generic/bitops/le.h \
arch/arm64/include/uapi/asm/byteorder.h \
include/linux/byteorder/big_endian.h \
include/uapi/linux/byteorder/big_endian.h \
include/linux/types.h \
include/linux/swab.h \
include/uapi/linux/swab.h \
arch/arm64/include/generated/uapi/asm/swab.h \
include/uapi/asm-generic/swab.h \
include/linux/byteorder/generic.h \
include/linux/bug.h \
arch/arm64/include/asm/bug.h \
include/linux/stringify.h \
arch/arm64/include/asm/asm-bug.h \
arch/arm64/include/asm/brk-imm.h \
include/asm-generic/bug.h \
include/linux/kernel.h \
/home/masahiro/toolchains/aarch64-linaro-4.9/gcc-linaro-4.9-2016.02-x86_64_aarch64-linux-gnu/lib/gcc/aarch64-linux-gnu/4.9.4/include/stdarg.h
\
include/linux/linkage.h \
include/linux/export.h \
arch/arm64/include/asm/linkage.h \
include/linux/log2.h \
include/linux/typecheck.h \
include/linux/printk.h \
include/linux/init.h \
include/linux/kern_levels.h \
include/linux/cache.h \
include/uapi/linux/kernel.h \
include/uapi/linux/sysinfo.h \
arch/arm64/include/asm/cache.h \
arch/arm64/include/asm/cputype.h \
arch/arm64/include/asm/sysreg.h \
include/linux/dynamic_debug.h \
include/linux/jump_label.h \
arch/arm64/include/asm/jump_label.h \
arch/arm64/include/asm/insn.h \
include/linux/build_bug.h \
include/linux/list.h \
include/linux/poison.h \
include/uapi/linux/const.h \
include/linux/preempt.h \
arch/arm64/include/generated/asm/preempt.h \
include/asm-generic/preempt.h \
include/linux/thread_info.h \
include/linux/restart_block.h \
arch/arm64/include/asm/current.h \
arch/arm64/include/asm/thread_info.h \
arch/arm64/include/asm/memory.h \
arch/arm64/include/asm/page-def.h \
arch/arm64/include/generated/asm/sizes.h \
include/asm-generic/sizes.h \
include/linux/sizes.h \
include/linux/mmdebug.h \
include/asm-generic/memory_model.h \
include/linux/pfn.h \
arch/arm64/include/asm/stack_pointer.h \
include/linux/radix-tree-root.h \
include/linux/rcupdate.h \
include/linux/atomic.h \
arch/arm64/include/asm/atomic.h \
arch/arm64/include/asm/lse.h \
arch/arm64/include/asm/atomic_ll_sc.h \
arch/arm64/include/asm/cmpxchg.h \
include/asm-generic/atomic-long.h \
include/linux/irqflags.h \
arch/arm64/include/asm/irqflags.h \
arch/arm64/include/asm/ptrace.h \
arch/arm64/include/uapi/asm/ptrace.h \
arch/arm64/include/asm/hwcap.h \
arch/arm64/include/uapi/asm/hwcap.h \
include/asm-generic/ptrace.h \
include/linux/bottom_half.h \
include/linux/lockdep.h \
include/linux/debug_locks.h \
include/linux/stacktrace.h \
arch/arm64/include/asm/processor.h \
include/linux/string.h \
include/uapi/linux/string.h \
arch/arm64/include/asm/string.h \
arch/arm64/include/asm/alternative.h \
arch/arm64/include/asm/cpucaps.h \
arch/arm64/include/asm/fpsimd.h \
arch/arm64/include/asm/hw_breakpoint.h \
arch/arm64/include/asm/cpufeature.h \
arch/arm64/include/asm/virt.h \
arch/arm64/include/asm/sections.h \
include/asm-generic/sections.h \
arch/arm64/include/asm/pgtable-hwdef.h \
include/linux/cpumask.h \
include/linux/threads.h \
include/linux/bitmap.h \
include/linux/rcutree.h \
include/linux/spinlock_types.h \
arch/arm64/include/asm/spinlock_types.h \
include/linux/rwlock_types.h \
--
Best Regards
Masahiro Yamada
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH 13/14] netfilter/ipvs: Use %pS printk format for direct addresses
From: Simon Horman @ 2017-10-09 5:52 UTC (permalink / raw)
To: Helge Deller
Cc: linux-kernel, Sergey Senozhatsky, Petr Mladek, Andrew Morton,
Wensong Zhang, netdev, lvs-devel, netfilter-devel,
Pablo Neira Ayuso
In-Reply-To: <1504729681-3504-14-git-send-email-deller@gmx.de>
On Wed, Sep 06, 2017 at 10:28:00PM +0200, Helge Deller wrote:
> The debug and error printk functions in ipvs uses wrongly the %pF instead of
> the %pS printk format specifier for printing symbols for the address returned
> by _builtin_return_address(0). Fix it for the ia64, ppc64 and parisc64
> architectures.
>
> Signed-off-by: Helge Deller <deller@gmx.de>
> Cc: Wensong Zhang <wensong@linux-vs.org>
> Cc: netdev@vger.kernel.org
> Cc: lvs-devel@vger.kernel.org
> Cc: netfilter-devel@vger.kernel.org
Sorry for the delay in processing this.
Acked-by: Simon Horman <horms@verge.net.au>
Pablo, could you take this through the nf-next tree directly?
^ permalink raw reply
* [PATCH v3] lib: fix multiple strlcpy definition
From: Baruch Siach @ 2017-10-09 5:49 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev, Phil Sutter, Baruch Siach
Some C libraries, like uClibc and musl, provide BSD compatible
strlcpy(). Add check_strlcpy() to configure, and avoid defining strlcpy
and strlcat when the C library provides them.
This fixes the following static link error with uClibc-ng:
.../sysroot/usr/lib/libc.a(strlcpy.os): In function `strlcpy':
strlcpy.c:(.text+0x0): multiple definition of `strlcpy'
../lib/libutil.a(utils.o):utils.c:(.text+0x1ddc): first defined here
collect2: error: ld returned 1 exit status
Acked-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
v3: Set CFLAGS directly in config.mk
v2: Fix the order of strlcpy parameters
---
configure | 24 ++++++++++++++++++++++++
lib/utils.c | 2 ++
2 files changed, 26 insertions(+)
diff --git a/configure b/configure
index 7be8fb113cc9..f0668ab3f7e9 100755
--- a/configure
+++ b/configure
@@ -326,6 +326,27 @@ EOF
rm -f $TMPDIR/dbtest.c $TMPDIR/dbtest
}
+check_strlcpy()
+{
+ cat >$TMPDIR/strtest.c <<EOF
+#include <string.h>
+int main(int argc, char **argv) {
+ char dst[10];
+ strlcpy(dst, "test", sizeof(dst));
+ return 0;
+}
+EOF
+ $CC -I$INCLUDE -o $TMPDIR/strtest $TMPDIR/strtest.c >/dev/null 2>&1
+ if [ $? -eq 0 ]
+ then
+ echo "no"
+ else
+ echo 'CFLAGS += -DNEED_STRLCPY' >>$CONFIG
+ echo "yes"
+ fi
+ rm -f $TMPDIR/strtest.c $TMPDIR/strtest
+}
+
quiet_config()
{
cat <<EOF
@@ -397,6 +418,9 @@ check_mnl
echo -n "Berkeley DB: "
check_berkeley_db
+echo -n "need for strlcpy: "
+check_strlcpy
+
echo
echo -n "docs:"
check_docs
diff --git a/lib/utils.c b/lib/utils.c
index 0cf99619c302..632fd0ddac82 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -1260,6 +1260,7 @@ int get_real_family(int rtm_type, int rtm_family)
return rtm_family;
}
+#ifdef NEED_STRLCPY
size_t strlcpy(char *dst, const char *src, size_t size)
{
size_t srclen = strlen(src);
@@ -1282,3 +1283,4 @@ size_t strlcat(char *dst, const char *src, size_t size)
return dlen + strlcpy(dst + dlen, src, size - dlen);
}
+#endif
--
2.14.2
^ permalink raw reply related
* IRREVOCABLE PAYMENT ORDER.pdf
From: Dr. Owen Douglas @ 2017-10-09 0:12 UTC (permalink / raw)
In-Reply-To: <34be7bb2e296579de8756eb7e5261ca2@incoming.mhcable.com>
[-- Attachment #1: IRREVOCABLE PAYMENT ORDER.pdf --]
[-- Type: application/pdf, Size: 181455 bytes --]
^ permalink raw reply
* Re: [PATCH net-next 0/2] net: defer cgroups init to accept()
From: Eric Dumazet @ 2017-10-09 4:47 UTC (permalink / raw)
To: David S . Miller
Cc: netdev, Eric Dumazet, Eric Dumazet, Johannes Weiner, Tejun Heo,
John Sperbeck
In-Reply-To: <20171009044452.20564-1-edumazet@google.com>
On Sun, Oct 8, 2017 at 9:44 PM, Eric Dumazet <edumazet@google.com> wrote:
> After TCP 3WHS became lockless, we should not attempt cgroup games
> from sk_clone_lock() since listener/cgroup might be already gone.
>
> Move this business to inet_csk_accept() where we have
> the guarantee both parent and child exist.
>
> Many thanks to John Sperbeck for spotting these issues
>
> Eric Dumazet (2):
> net: memcontrol: defer call to mem_cgroup_sk_alloc()
> net: defer call to cgroup_sk_alloc()
This was based on net tree, but I used the wrong script, and thus this
has the [PATCH net-next] tag.
Sorry for the confusion, but I guess this also can be applied to
net-next since this is not a recent regression.
^ permalink raw reply
* Re: netlink backwards compatibility in userspace tools
From: David Miller @ 2017-10-09 4:47 UTC (permalink / raw)
To: Jason; +Cc: netdev, linux-kernel, dkg
In-Reply-To: <CAHmME9oixZtPVdH24KJQ9NaTuf_ECAOoHwQhuA+Fy-BX+F_3dw@mail.gmail.com>
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
Date: Fri, 29 Sep 2017 12:22:42 +0200
> One handy aspect of Netlink is that it's backwards compatible. This
> means that you can run old userspace utilities on new kernels, even if
> the new kernel supports new features and netlink attributes. The wire
> format is stable enough that the data marshaled can be extended
> without breaking compat. Neat.
>
> I was wondering, though, what you think the best stance is toward
> these old userspace utilities. What should they do if the kernel sends
> it netlink attributes that it does not recognize? At the moment, I'm
> doing something like this:
>
> static void warn_unrecognized(void)
> {
> static bool once = false;
> if (once)
> return;
> once = true;
> fprintf(stderr,
> "Warning: this program received from your kernel one or more\n"
> "attributes that it did not recognize. It is possible that\n"
> "this version of wg(8) is older than your kernel. You may\n"
> "want to update this program.\n");
> }
>
> This seems like a somewhat sensible warning, but then I wonder about
> distributions like Debian, which has a long stable life cycle, so it
> frequently has very old tools (ancient iproute2 for example). Then,
> VPS providers have these Debian images run on top of newer kernels.
> People in this situation would undoubtedly see the above warning a lot
> and not be able to do anything about it. Not horrible, but a bit
> annoying. Is this an okay annoyance? Or is it advised to just have no
> warning at all? One idea would be to put it behind an environment
> variable flag, but I don't like too many nobs.
>
> I'm generally wondering about attitudes toward this kind of userspace
> program behavior in response to newer kernels.
Generally, yes you should simply ignore attributes you don't understand.
But we keep coming back to this issue, because it's not always the best
thing to do.
For example, let's say you have settings X and Y for object A.
User A has a newer tool and is able to set both X and Y, as well as
see them in dumps. And let's further assume that Y's setting has some
kind of influence on the behavior of X.
User B has an older tool, and sees X but not Y because Y is not
understood by the older tool. User B will not be able to figure out
why X is not behaving the way they expect it to, because of the loss
of information.
Similar, even more serious, issues arise when setting values. User B
can set X and wonder why it's not doing what they expect it to do
because of setting Y which they can't even see with their tools.
For this reason it might be beneficical to at least say to the user
"Warning, I've seen one or more unrecognized netlink attributes."
so that there is at least a chance for the user to figure out what
might be happening to them.
^ permalink raw reply
* Re: [PATCHv2 net-next] openvswitch: Add erspan tunnel support.
From: Pravin Shelar @ 2017-10-09 4:45 UTC (permalink / raw)
To: William Tu; +Cc: Linux Kernel Network Developers
In-Reply-To: <1507161792-18340-1-git-send-email-u9012063@gmail.com>
On Wed, Oct 4, 2017 at 5:03 PM, William Tu <u9012063@gmail.com> wrote:
> Add erspan netlink interface for OVS.
>
> Signed-off-by: William Tu <u9012063@gmail.com>
> Cc: Pravin B Shelar <pshelar@ovn.org>
> ---
> v1->v2: remove unnecessary compat code.
Looks good to me.
^ permalink raw reply
* [PATCH net-next 2/2] net: defer call to cgroup_sk_alloc()
From: Eric Dumazet @ 2017-10-09 4:44 UTC (permalink / raw)
To: David S . Miller
Cc: netdev, Eric Dumazet, Eric Dumazet, Johannes Weiner, Tejun Heo,
John Sperbeck
In-Reply-To: <20171009044452.20564-1-edumazet@google.com>
sk_clone_lock() might run while TCP/DCCP listener already vanished.
In order to prevent use after free, it is better to defer cgroup_sk_alloc()
to the point we know both parent and child exist, and from process context.
Fixes: e994b2f0fb92 ("tcp: do not lock listener to process SYN packets")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Tejun Heo <tj@kernel.org>
---
kernel/cgroup/cgroup.c | 11 -----------
net/core/sock.c | 3 +--
net/ipv4/inet_connection_sock.c | 5 +++++
3 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 44857278eb8aa6a2bbf27b7eb12137ef42628170..3380a3e49af501e457991b2823020494cf32af80 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -5709,17 +5709,6 @@ void cgroup_sk_alloc(struct sock_cgroup_data *skcd)
if (cgroup_sk_alloc_disabled)
return;
- /* Socket clone path */
- if (skcd->val) {
- /*
- * We might be cloning a socket which is left in an empty
- * cgroup and the cgroup might have already been rmdir'd.
- * Don't use cgroup_get_live().
- */
- cgroup_get(sock_cgroup_ptr(skcd));
- return;
- }
-
rcu_read_lock();
while (true) {
diff --git a/net/core/sock.c b/net/core/sock.c
index 70c6ccbdf49f2f8a5a0f7c41c7849ea01459be50..4499e31538132ed59a16d92e6f6b923e776df84e 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1680,6 +1680,7 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority)
/* sk->sk_memcg will be populated at accept() time */
newsk->sk_memcg = NULL;
+ memset(&newsk->sk_cgrp_data, 0, sizeof(newsk->sk_cgrp_data));
atomic_set(&newsk->sk_drops, 0);
newsk->sk_send_head = NULL;
@@ -1718,8 +1719,6 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority)
newsk->sk_incoming_cpu = raw_smp_processor_id();
atomic64_set(&newsk->sk_cookie, 0);
- cgroup_sk_alloc(&newsk->sk_cgrp_data);
-
/*
* Before updating sk_refcnt, we must commit prior changes to memory
* (Documentation/RCU/rculist_nulls.txt for details)
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 67aec7a106860b26c929fea1624d652c87972f04..d32c74507314cc4b91d040de8e877e4bd8204106 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -26,6 +26,8 @@
#include <net/tcp.h>
#include <net/sock_reuseport.h>
#include <net/addrconf.h>
+#include <net/cls_cgroup.h>
+#include <net/netprio_cgroup.h>
#ifdef INET_CSK_DEBUG
const char inet_csk_timer_bug_msg[] = "inet_csk BUG: unknown timer value\n";
@@ -476,6 +478,9 @@ struct sock *inet_csk_accept(struct sock *sk, int flags, int *err, bool kern)
spin_unlock_bh(&queue->fastopenq.lock);
}
mem_cgroup_sk_alloc(newsk);
+ cgroup_sk_alloc(&newsk->sk_cgrp_data);
+ sock_update_classid(&newsk->sk_cgrp_data);
+ sock_update_netprioidx(&newsk->sk_cgrp_data);
out:
release_sock(sk);
if (req)
--
2.14.2.920.gcf0c67979c-goog
^ permalink raw reply related
* [PATCH net-next 1/2] net: memcontrol: defer call to mem_cgroup_sk_alloc()
From: Eric Dumazet @ 2017-10-09 4:44 UTC (permalink / raw)
To: David S . Miller
Cc: netdev, Eric Dumazet, Eric Dumazet, Johannes Weiner, Tejun Heo,
John Sperbeck
In-Reply-To: <20171009044452.20564-1-edumazet@google.com>
Instead of calling mem_cgroup_sk_alloc() from BH context,
it is better to call it from inet_csk_accept() in process context.
Not only this removes code in mem_cgroup_sk_alloc(), but it also
fixes a bug since listener might have been dismantled and css_get()
might cause a use-after-free.
Fixes: e994b2f0fb92 ("tcp: do not lock listener to process SYN packets")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Tejun Heo <tj@kernel.org>
---
mm/memcontrol.c | 15 ---------------
net/core/sock.c | 5 ++++-
net/ipv4/inet_connection_sock.c | 1 +
3 files changed, 5 insertions(+), 16 deletions(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index d5f3a62887cf958f6b657c0f542f0cf2c3e86e8d..661f046ad3181f65eccfd9bf3832e395e27aa226 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5828,21 +5828,6 @@ void mem_cgroup_sk_alloc(struct sock *sk)
if (!mem_cgroup_sockets_enabled)
return;
- /*
- * Socket cloning can throw us here with sk_memcg already
- * filled. It won't however, necessarily happen from
- * process context. So the test for root memcg given
- * the current task's memcg won't help us in this case.
- *
- * Respecting the original socket's memcg is a better
- * decision in this case.
- */
- if (sk->sk_memcg) {
- BUG_ON(mem_cgroup_is_root(sk->sk_memcg));
- css_get(&sk->sk_memcg->css);
- return;
- }
-
rcu_read_lock();
memcg = mem_cgroup_from_task(current);
if (memcg == root_mem_cgroup)
diff --git a/net/core/sock.c b/net/core/sock.c
index 23953b741a41fbcf4a6ffb0dd5bf05bd5266b99d..70c6ccbdf49f2f8a5a0f7c41c7849ea01459be50 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1677,6 +1677,10 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority)
newsk->sk_dst_pending_confirm = 0;
newsk->sk_wmem_queued = 0;
newsk->sk_forward_alloc = 0;
+
+ /* sk->sk_memcg will be populated at accept() time */
+ newsk->sk_memcg = NULL;
+
atomic_set(&newsk->sk_drops, 0);
newsk->sk_send_head = NULL;
newsk->sk_userlocks = sk->sk_userlocks & ~SOCK_BINDPORT_LOCK;
@@ -1714,7 +1718,6 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority)
newsk->sk_incoming_cpu = raw_smp_processor_id();
atomic64_set(&newsk->sk_cookie, 0);
- mem_cgroup_sk_alloc(newsk);
cgroup_sk_alloc(&newsk->sk_cgrp_data);
/*
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index c039c937ba90c7aec39ba2687bceb8253ead70aa..67aec7a106860b26c929fea1624d652c87972f04 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -475,6 +475,7 @@ struct sock *inet_csk_accept(struct sock *sk, int flags, int *err, bool kern)
}
spin_unlock_bh(&queue->fastopenq.lock);
}
+ mem_cgroup_sk_alloc(newsk);
out:
release_sock(sk);
if (req)
--
2.14.2.920.gcf0c67979c-goog
^ permalink raw reply related
* [PATCH net-next 0/2] net: defer cgroups init to accept()
From: Eric Dumazet @ 2017-10-09 4:44 UTC (permalink / raw)
To: David S . Miller
Cc: netdev, Eric Dumazet, Eric Dumazet, Johannes Weiner, Tejun Heo,
John Sperbeck
After TCP 3WHS became lockless, we should not attempt cgroup games
from sk_clone_lock() since listener/cgroup might be already gone.
Move this business to inet_csk_accept() where we have
the guarantee both parent and child exist.
Many thanks to John Sperbeck for spotting these issues
Eric Dumazet (2):
net: memcontrol: defer call to mem_cgroup_sk_alloc()
net: defer call to cgroup_sk_alloc()
kernel/cgroup/cgroup.c | 11 -----------
mm/memcontrol.c | 15 ---------------
net/core/sock.c | 8 +++++---
net/ipv4/inet_connection_sock.c | 6 ++++++
4 files changed, 11 insertions(+), 29 deletions(-)
--
2.14.2.920.gcf0c67979c-goog
^ permalink raw reply
* Re: [PATCH v2 net-next 06/12] qed: Add LL2 slowpath handling
From: David Miller @ 2017-10-09 4:40 UTC (permalink / raw)
To: Michal.Kalderon-YGCgFSpz5w/QT0dZR+AlfA
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
dledford-H+wXaHxf7aLQT0dZR+AlfA,
Ariel.Elior-YGCgFSpz5w/QT0dZR+AlfA
In-Reply-To: <CY1PR0701MB20128130D21FD3C54E45B5A188720-UpKza+2NMNLHMJvQ0dyT705OhdzP3rhOnBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
From: "Kalderon, Michal" <Michal.Kalderon-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
Date: Tue, 3 Oct 2017 18:05:32 +0000
> From: David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
> Sent: Tuesday, October 3, 2017 8:17 PM
>>> @@ -423,6 +423,41 @@ static void qed_ll2_rxq_parse_reg(struct qed_hwfn *p_hwfn,
>>> }
>>>
>>> static int
>>> +qed_ll2_handle_slowpath(struct qed_hwfn *p_hwfn,
>>> + struct qed_ll2_info *p_ll2_conn,
>>> + union core_rx_cqe_union *p_cqe,
>>> + unsigned long *p_lock_flags)
>>> +{
>>...
>>> + spin_unlock_irqrestore(&p_rx->lock, *p_lock_flags);
>>> +
>>
>>You can't drop this lock.
>>
>>Another thread can enter the loop of our caller and process RX queue
>>entries, then we would return from here and try to process the same
>>entries again.
>
> The lock is there to synchronize access to chains between qed_ll2_rxq_completion
> and qed_ll2_post_rx_buffer. qed_ll2_rxq_completion can't be called from
> different threads, the light l2 uses the single sp status block we have.
> The reason we release the lock is to avoid a deadlock where as a result of calling
> upper-layer driver it will potentially post additional rx-buffers.
Ok, please repost this patch series.
Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH] qed: Delete redundant check on dcb_app priority
From: David Miller @ 2017-10-09 4:21 UTC (permalink / raw)
To: chris.gekas; +Cc: Ariel.Elior, everest-linux-l2, netdev, linux-kernel
In-Reply-To: <1507502807-19767-1-git-send-email-chris.gekas@gmail.com>
From: Christos Gkekas <chris.gekas@gmail.com>
Date: Sun, 8 Oct 2017 23:46:47 +0100
> dcb_app priority is unsigned thus checking whether it is less than zero
> is redundant.
>
> Signed-off-by: Christos Gkekas <chris.gekas@gmail.com>
Applied to net-next.
^ permalink raw reply
* Re: [PATCH v2] net/core: Fix BUG to BUG_ON conditionals.
From: David Miller @ 2017-10-09 4:20 UTC (permalink / raw)
To: devtimhansen
Cc: willemb, edumazet, soheil, elena.reshetova, pabeni, tom, Jason,
fw, netdev, linux-kernel, alexander.levin
In-Reply-To: <20171008200338.2noygmfbdri6lc4y@debian>
From: Tim Hansen <devtimhansen@gmail.com>
Date: Sun, 8 Oct 2017 16:03:38 -0400
> Mistakenly sent the patch previously with a missing semicolon.
> Apologies.
>
> Fix BUG() calls to use BUG_ON(conditional) macros.
>
> This was found using make coccicheck M=net/core on linux next
> tag next-20170929
>
> Signed-off-by: Tim Hansen <devtimhansen@gmail.com>
You're going to have to submit this new version again, the way you
replied to the original patch caused the fixed version to not get
queued up in patchwork properly.
^ permalink raw reply
* Re: [PATCH] net: ethernet: stmmac: Clean up dead code
From: David Miller @ 2017-10-09 4:19 UTC (permalink / raw)
To: chris.gekas; +Cc: peppe.cavallaro, alexandre.torgue, netdev, linux-kernel
In-Reply-To: <1507490029-26406-1-git-send-email-chris.gekas@gmail.com>
From: Christos Gkekas <chris.gekas@gmail.com>
Date: Sun, 8 Oct 2017 20:13:49 +0100
> Many macros in dwmac-ipq806x are unused and should be removed.
> Moreover gmac->id is an unsigned variable and therefore checking
> whether it is less than zero is redundant.
>
> Signed-off-by: Christos Gkekas <chris.gekas@gmail.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next 0/6] ipv6: ipv6_dev_get_saddr() rcu works
From: David Miller @ 2017-10-09 4:17 UTC (permalink / raw)
To: edumazet; +Cc: netdev, eric.dumazet, yoshfuji
In-Reply-To: <20171008023028.32071-1-edumazet@google.com>
From: Eric Dumazet <edumazet@google.com>
Date: Sat, 7 Oct 2017 19:30:22 -0700
> Sending IPv6 udp packets on non connected sockets is quite slow,
> because ipv6_dev_get_saddr() is still using an rwlock and silly
> references games on ifa.
>
> Tested:
>
> $ ./super_netperf 16 -H 4444::555:0786 -l 2000 -t UDP_STREAM -- -m 100 &
> [1] 12527
>
> Performance is boosted from 2.02 Mpps to 4.28 Mpps
Awesome, series applied, thanks!
^ permalink raw reply
* Re: [PATCH] net: make ->ndo_get_phys_port_name accept 32-bit len
From: David Miller @ 2017-10-09 4:14 UTC (permalink / raw)
To: jakub.kicinski
Cc: adobriyan, netdev, michael.chan, saeedm, simon.horman, jiri,
ecree, vivien.didelot
In-Reply-To: <20171008182545.171498a2@cakuba.netronome.com>
From: Jakub Kicinski <jakub.kicinski@netronome.com>
Date: Sun, 8 Oct 2017 18:25:45 -0700
> On Sun, 8 Oct 2017 01:19:17 +0300, Alexey Dobriyan wrote:
>> Buffer length passed into this hook is always IFNAMSIZ which is 16.
>>
>> Code savings on x86_64:
>>
>> add/remove: 0/0 grow/shrink: 1/9 up/down: 2/-45 (-43)
>> function old new delta
>> rocker_cmd_get_port_settings_phys_name_proc 179 181 +2
>> rocker_port_get_phys_port_name 62 61 -1
>> mlxsw_sx_port_get_phys_port_name 54 50 -4
>> mlx5e_rep_get_phys_port_name 61 57 -4
>> efx_get_phys_port_name 50 46 -4
>> dsa_slave_get_phys_port_name 54 50 -4
>> bnxt_vf_rep_get_phys_port_name 69 65 -4
>> bnxt_get_phys_port_name 70 65 -5
>> mlxsw_sp_port_get_phys_port_name 116 107 -9
>> nfp_port_get_phys_port_name 180 170 -10
>>
>> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
>
> I don't think the gains justify the additional burden on backports.
Yeah I agree, this one is not really worth the pain.
^ permalink raw reply
* Re: [net 1/1] tipc: Unclone message at secondary destination lookup
From: David Miller @ 2017-10-09 4:13 UTC (permalink / raw)
To: jon.maloy; +Cc: ying.xue, netdev, tipc-discussion
In-Reply-To: <1507381640-29340-1-git-send-email-jon.maloy@ericsson.com>
From: Jon Maloy <jon.maloy@ericsson.com>
Date: Sat, 7 Oct 2017 15:07:20 +0200
> When a bundling message is received, the function tipc_link_input()
> calls function tipc_msg_extract() to unbundle all inner messages of
> the bundling message before adding them to input queue.
>
> The function tipc_msg_extract() just clones all inner skb for all
> inner messagges from the bundling skb. This means that the skb
> headroom of an inner message overlaps with the data part of the
> preceding message in the bundle.
>
> If the message in question is a name addressed message, it may be
> subject to a secondary destination lookup, and eventually be sent out
> on one of the interfaces again. But, since what is perceived as headroom
> by the device driver in reality is the last bytes of the preceding
> message in the bundle, the latter will be overwritten by the MAC
> addresses of the L2 header. If the preceding message has not yet been
> consumed by the user, it will evenually be delivered with corrupted
> contents.
>
> This commit fixes this by uncloning all messages passing through the
> function tipc_msg_lookup_dest(), hence ensuring that the headroom
> is always valid when the message is passed on.
>
> Signed-off-by: Tung Nguyen <tung.q.nguyen@dektech.com.au>
> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Applied.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox