netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: sched: don't use GFP_KERNEL under spin lock
@ 2017-09-05 10:54 Jakub Kicinski
  2017-09-05 10:59 ` Jakub Kicinski
  2017-09-05 14:10 ` Eric Dumazet
  0 siblings, 2 replies; 6+ messages in thread
From: Jakub Kicinski @ 2017-09-05 10:54 UTC (permalink / raw)
  To: netdev; +Cc: jiri, Chris Mi, xiyou.wangcong, jhs, oss-drivers, Jakub Kicinski

The new TC IDR code uses GFP_KERNEL under spinlocks.  Which leads
to:

[  582.621091] BUG: sleeping function called from invalid context at ../mm/slab.h:416
[  582.629721] in_atomic(): 1, irqs_disabled(): 0, pid: 3379, name: tc
[  582.636939] 2 locks held by tc/3379:
[  582.641049]  #0:  (rtnl_mutex){+.+.+.}, at: [<ffffffff910354ce>] rtnetlink_rcv_msg+0x92e/0x1400
[  582.650958]  #1:  (&(&tn->idrinfo->lock)->rlock){+.-.+.}, at: [<ffffffff9110a5e0>] tcf_idr_create+0x2f0/0x8e0
[  582.662217] Preemption disabled at:
[  582.662222] [<ffffffff9110a5e0>] tcf_idr_create+0x2f0/0x8e0
[  582.672592] CPU: 9 PID: 3379 Comm: tc Tainted: G        W       4.13.0-rc7-debug-00648-g43503a79b9f0 #287
[  582.683432] Hardware name: Dell Inc. PowerEdge R730/072T6D, BIOS 2.3.4 11/08/2016
[  582.691937] Call Trace:
...
[  582.713332]  ? tcf_idr_create+0x2f0/0x8e0
[  582.717925]  ___might_sleep+0x40f/0x660
[  582.722336]  ? finish_task_switch+0xb90/0xb90
[  582.727315]  ? mark_held_locks+0xdd/0x190
[  582.731908]  __might_sleep+0xba/0x240
[  582.736125]  ? radix_tree_node_alloc.constprop.6+0x4a/0x450
[  582.742460]  kmem_cache_alloc+0x286/0x540
[  582.747055]  radix_tree_node_alloc.constprop.6+0x4a/0x450
[  582.753209]  idr_get_free_cmn+0x627/0xf80
...
[  582.815525]  idr_alloc_cmn+0x1a8/0x270
[  582.819821]  ? __raw_spin_lock_init+0x21/0x120
[  582.824914]  ? idr_replace+0x20/0x20
[  582.829013]  ? do_raw_spin_lock+0x1f0/0x1f0
[  582.833804]  tcf_idr_create+0x31b/0x8e0
...

Fixes: 65a206c01e8e ("net/sched: Change act_api and act_xxx modules to use IDR")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
---
 net/sched/act_api.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 0eb545bcb247..a48e4b45722d 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -298,7 +298,7 @@ int tcf_idr_create(struct tc_action_net *tn, u32 index, struct nlattr *est,
 	if (!index) {
 		spin_lock_bh(&idrinfo->lock);
 		err = idr_alloc_ext(idr, NULL, &idr_index, 1, 0,
-				    GFP_KERNEL);
+				    GFP_ATOMIC);
 		spin_unlock_bh(&idrinfo->lock);
 		if (err) {
 err3:
@@ -309,7 +309,7 @@ int tcf_idr_create(struct tc_action_net *tn, u32 index, struct nlattr *est,
 	} else {
 		spin_lock_bh(&idrinfo->lock);
 		err = idr_alloc_ext(idr, NULL, NULL, index, index + 1,
-				    GFP_KERNEL);
+				    GFP_ATOMIC);
 		spin_unlock_bh(&idrinfo->lock);
 		if (err)
 			goto err3;
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net] net: sched: don't use GFP_KERNEL under spin lock
  2017-09-05 10:54 [PATCH net] net: sched: don't use GFP_KERNEL under spin lock Jakub Kicinski
@ 2017-09-05 10:59 ` Jakub Kicinski
  2017-09-05 12:52   ` Jiri Pirko
  2017-09-05 14:10 ` Eric Dumazet
  1 sibling, 1 reply; 6+ messages in thread
From: Jakub Kicinski @ 2017-09-05 10:59 UTC (permalink / raw)
  To: netdev; +Cc: jiri, oss-drivers

Jiri, FWIW I also just noticed these, but they seem related to the
earlier TC chain work?

unreferenced object 0xffff8807466f70c8 (size 64):
  comm "tc", pid 1812, jiffies 4294932641 (age 1537.192s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 a0 83 e1 31 07 88 ff ff  ...........1....
    d8 70 6f 46 07 88 ff ff d8 70 6f 46 07 88 ff ff  .poF.....poF....
  backtrace:
    [<ffffffffaa6b0118>] kmemleak_alloc+0x28/0x50
    [<ffffffffa89a89b6>] kmem_cache_alloc_trace+0x1e6/0x550
    [<ffffffffaa102827>] tcf_chain_create+0x97/0x460
    [<ffffffffaa102f67>] tcf_block_get+0x127/0x230
    [<ffffffffc03e8546>] ingress_init+0x76/0x110 [sch_ingress]
    [<ffffffffaa0fbb1c>] qdisc_create+0x2ec/0x1100
    [<ffffffffaa0fce1a>] tc_modify_qdisc+0x4ea/0x1ae0
    [<ffffffffaa0355dc>] rtnetlink_rcv_msg+0xa3c/0x1400
    [<ffffffffaa12e3cb>] netlink_rcv_skb+0x22b/0x4e0
    [<ffffffffaa024b55>] rtnetlink_rcv+0x15/0x20
    [<ffffffffaa12bddd>] netlink_unicast+0x47d/0x710
    [<ffffffffaa12caef>] netlink_sendmsg+0xa7f/0x1140
    [<ffffffffa9f15c52>] sock_sendmsg+0xe2/0x170
    [<ffffffffa9f188bd>] ___sys_sendmsg+0x72d/0xcc0
    [<ffffffffa9f1bfa2>] __sys_sendmsg+0xe2/0x260
    [<ffffffffa9f1c132>] SyS_sendmsg+0x12/0x20
unreferenced object 0xffff88074db6c008 (size 64):
  comm "tc", pid 2097, jiffies 4294953636 (age 1453.212s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 60 a6 d1 31 07 88 ff ff  ........`..1....
    18 c0 b6 4d 07 88 ff ff 18 c0 b6 4d 07 88 ff ff  ...M.......M....
  backtrace:
    [<ffffffffaa6b0118>] kmemleak_alloc+0x28/0x50
    [<ffffffffa89a89b6>] kmem_cache_alloc_trace+0x1e6/0x550
    [<ffffffffaa102827>] tcf_chain_create+0x97/0x460
    [<ffffffffaa102f67>] tcf_block_get+0x127/0x230
    [<ffffffffc03e8546>] ingress_init+0x76/0x110 [sch_ingress]
    [<ffffffffaa0fbb1c>] qdisc_create+0x2ec/0x1100
    [<ffffffffaa0fce1a>] tc_modify_qdisc+0x4ea/0x1ae0
    [<ffffffffaa0355dc>] rtnetlink_rcv_msg+0xa3c/0x1400
    [<ffffffffaa12e3cb>] netlink_rcv_skb+0x22b/0x4e0
    [<ffffffffaa024b55>] rtnetlink_rcv+0x15/0x20
    [<ffffffffaa12bddd>] netlink_unicast+0x47d/0x710
    [<ffffffffaa12caef>] netlink_sendmsg+0xa7f/0x1140
    [<ffffffffa9f15c52>] sock_sendmsg+0xe2/0x170
    [<ffffffffa9f188bd>] ___sys_sendmsg+0x72d/0xcc0
    [<ffffffffa9f1bfa2>] __sys_sendmsg+0xe2/0x260
    [<ffffffffa9f1c132>] SyS_sendmsg+0x12/0x20
unreferenced object 0xffff880749f82a48 (size 64):
  comm "tc", pid 2381, jiffies 4294972986 (age 1375.812s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 c0 b7 31 31 07 88 ff ff  ..........11....
    58 2a f8 49 07 88 ff ff 58 2a f8 49 07 88 ff ff  X*.I....X*.I....
  backtrace:
    [<ffffffffaa6b0118>] kmemleak_alloc+0x28/0x50
    [<ffffffffa89a89b6>] kmem_cache_alloc_trace+0x1e6/0x550
    [<ffffffffaa102827>] tcf_chain_create+0x97/0x460
    [<ffffffffaa102f67>] tcf_block_get+0x127/0x230
    [<ffffffffc03e8546>] ingress_init+0x76/0x110 [sch_ingress]
    [<ffffffffaa0fbb1c>] qdisc_create+0x2ec/0x1100
    [<ffffffffaa0fce1a>] tc_modify_qdisc+0x4ea/0x1ae0
    [<ffffffffaa0355dc>] rtnetlink_rcv_msg+0xa3c/0x1400
    [<ffffffffaa12e3cb>] netlink_rcv_skb+0x22b/0x4e0
    [<ffffffffaa024b55>] rtnetlink_rcv+0x15/0x20
    [<ffffffffaa12bddd>] netlink_unicast+0x47d/0x710
    [<ffffffffaa12caef>] netlink_sendmsg+0xa7f/0x1140
    [<ffffffffa9f15c52>] sock_sendmsg+0xe2/0x170
    [<ffffffffa9f188bd>] ___sys_sendmsg+0x72d/0xcc0
    [<ffffffffa9f1bfa2>] __sys_sendmsg+0xe2/0x260
    [<ffffffffa9f1c132>] SyS_sendmsg+0x12/0x20
unreferenced object 0xffff8803fd855a08 (size 64):
  comm "tc", pid 2663, jiffies 4294992152 (age 1299.328s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 20 49 80 31 07 88 ff ff  ........ I.1....
    18 5a 85 fd 03 88 ff ff 18 5a 85 fd 03 88 ff ff  .Z.......Z......
  backtrace:
    [<ffffffffaa6b0118>] kmemleak_alloc+0x28/0x50
    [<ffffffffa89a89b6>] kmem_cache_alloc_trace+0x1e6/0x550
    [<ffffffffaa102827>] tcf_chain_create+0x97/0x460
    [<ffffffffaa102f67>] tcf_block_get+0x127/0x230
    [<ffffffffc03e8546>] ingress_init+0x76/0x110 [sch_ingress]
    [<ffffffffaa0fbb1c>] qdisc_create+0x2ec/0x1100
    [<ffffffffaa0fce1a>] tc_modify_qdisc+0x4ea/0x1ae0
    [<ffffffffaa0355dc>] rtnetlink_rcv_msg+0xa3c/0x1400
    [<ffffffffaa12e3cb>] netlink_rcv_skb+0x22b/0x4e0
    [<ffffffffaa024b55>] rtnetlink_rcv+0x15/0x20
    [<ffffffffaa12bddd>] netlink_unicast+0x47d/0x710
    [<ffffffffaa12caef>] netlink_sendmsg+0xa7f/0x1140
    [<ffffffffa9f15c52>] sock_sendmsg+0xe2/0x170
    [<ffffffffa9f188bd>] ___sys_sendmsg+0x72d/0xcc0
    [<ffffffffa9f1bfa2>] __sys_sendmsg+0xe2/0x260
    [<ffffffffa9f1c132>] SyS_sendmsg+0x12/0x20
unreferenced object 0xffff88071b096f28 (size 64):
  comm "tc", pid 2943, jiffies 4295013397 (age 1214.352s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 c0 37 e7 30 07 88 ff ff  .........7.0....
    38 6f 09 1b 07 88 ff ff 38 6f 09 1b 07 88 ff ff  8o......8o......
  backtrace:
    [<ffffffffaa6b0118>] kmemleak_alloc+0x28/0x50
    [<ffffffffa89a89b6>] kmem_cache_alloc_trace+0x1e6/0x550
    [<ffffffffaa102827>] tcf_chain_create+0x97/0x460
    [<ffffffffaa102f67>] tcf_block_get+0x127/0x230
    [<ffffffffc03e8546>] ingress_init+0x76/0x110 [sch_ingress]
    [<ffffffffaa0fbb1c>] qdisc_create+0x2ec/0x1100
    [<ffffffffaa0fce1a>] tc_modify_qdisc+0x4ea/0x1ae0
    [<ffffffffaa0355dc>] rtnetlink_rcv_msg+0xa3c/0x1400
    [<ffffffffaa12e3cb>] netlink_rcv_skb+0x22b/0x4e0
    [<ffffffffaa024b55>] rtnetlink_rcv+0x15/0x20
    [<ffffffffaa12bddd>] netlink_unicast+0x47d/0x710
    [<ffffffffaa12caef>] netlink_sendmsg+0xa7f/0x1140
    [<ffffffffa9f15c52>] sock_sendmsg+0xe2/0x170
    [<ffffffffa9f188bd>] ___sys_sendmsg+0x72d/0xcc0
    [<ffffffffa9f1bfa2>] __sys_sendmsg+0xe2/0x260
    [<ffffffffa9f1c132>] SyS_sendmsg+0x12/0x20
unreferenced object 0xffff880731f66568 (size 64):
  comm "tc", pid 3263, jiffies 4295033366 (age 1134.480s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 95 64 65 07 88 ff ff  ..........de....
    78 65 f6 31 07 88 ff ff 78 65 f6 31 07 88 ff ff  xe.1....xe.1....
  backtrace:
    [<ffffffffaa6b0118>] kmemleak_alloc+0x28/0x50
    [<ffffffffa89a89b6>] kmem_cache_alloc_trace+0x1e6/0x550
    [<ffffffffaa102827>] tcf_chain_create+0x97/0x460
    [<ffffffffaa102f67>] tcf_block_get+0x127/0x230
    [<ffffffffc03e8546>] ingress_init+0x76/0x110 [sch_ingress]
    [<ffffffffaa0fbb1c>] qdisc_create+0x2ec/0x1100
    [<ffffffffaa0fce1a>] tc_modify_qdisc+0x4ea/0x1ae0
    [<ffffffffaa0355dc>] rtnetlink_rcv_msg+0xa3c/0x1400
    [<ffffffffaa12e3cb>] netlink_rcv_skb+0x22b/0x4e0
    [<ffffffffaa024b55>] rtnetlink_rcv+0x15/0x20
    [<ffffffffaa12bddd>] netlink_unicast+0x47d/0x710
    [<ffffffffaa12caef>] netlink_sendmsg+0xa7f/0x1140
    [<ffffffffa9f15c52>] sock_sendmsg+0xe2/0x170
    [<ffffffffa9f188bd>] ___sys_sendmsg+0x72d/0xcc0
    [<ffffffffa9f1bfa2>] __sys_sendmsg+0xe2/0x260
    [<ffffffffa9f1c132>] SyS_sendmsg+0x12/0x20

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net] net: sched: don't use GFP_KERNEL under spin lock
  2017-09-05 10:59 ` Jakub Kicinski
@ 2017-09-05 12:52   ` Jiri Pirko
  2017-09-05 14:25     ` [oss-drivers] " Jakub Kicinski
  0 siblings, 1 reply; 6+ messages in thread
From: Jiri Pirko @ 2017-09-05 12:52 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: netdev, oss-drivers

Tue, Sep 05, 2017 at 12:59:48PM CEST, kubakici@wp.pl wrote:
>Jiri, FWIW I also just noticed these, but they seem related to the
>earlier TC chain work?

What do you do to trigger this?

>
>unreferenced object 0xffff8807466f70c8 (size 64):
>  comm "tc", pid 1812, jiffies 4294932641 (age 1537.192s)
>  hex dump (first 32 bytes):
>    00 00 00 00 00 00 00 00 a0 83 e1 31 07 88 ff ff  ...........1....
>    d8 70 6f 46 07 88 ff ff d8 70 6f 46 07 88 ff ff  .poF.....poF....
>  backtrace:
>    [<ffffffffaa6b0118>] kmemleak_alloc+0x28/0x50
>    [<ffffffffa89a89b6>] kmem_cache_alloc_trace+0x1e6/0x550
>    [<ffffffffaa102827>] tcf_chain_create+0x97/0x460
>    [<ffffffffaa102f67>] tcf_block_get+0x127/0x230
>    [<ffffffffc03e8546>] ingress_init+0x76/0x110 [sch_ingress]
>    [<ffffffffaa0fbb1c>] qdisc_create+0x2ec/0x1100
>    [<ffffffffaa0fce1a>] tc_modify_qdisc+0x4ea/0x1ae0
>    [<ffffffffaa0355dc>] rtnetlink_rcv_msg+0xa3c/0x1400
>    [<ffffffffaa12e3cb>] netlink_rcv_skb+0x22b/0x4e0
>    [<ffffffffaa024b55>] rtnetlink_rcv+0x15/0x20
>    [<ffffffffaa12bddd>] netlink_unicast+0x47d/0x710
>    [<ffffffffaa12caef>] netlink_sendmsg+0xa7f/0x1140
>    [<ffffffffa9f15c52>] sock_sendmsg+0xe2/0x170
>    [<ffffffffa9f188bd>] ___sys_sendmsg+0x72d/0xcc0
>    [<ffffffffa9f1bfa2>] __sys_sendmsg+0xe2/0x260
>    [<ffffffffa9f1c132>] SyS_sendmsg+0x12/0x20
>unreferenced object 0xffff88074db6c008 (size 64):
>  comm "tc", pid 2097, jiffies 4294953636 (age 1453.212s)
>  hex dump (first 32 bytes):
>    00 00 00 00 00 00 00 00 60 a6 d1 31 07 88 ff ff  ........`..1....
>    18 c0 b6 4d 07 88 ff ff 18 c0 b6 4d 07 88 ff ff  ...M.......M....
>  backtrace:
>    [<ffffffffaa6b0118>] kmemleak_alloc+0x28/0x50
>    [<ffffffffa89a89b6>] kmem_cache_alloc_trace+0x1e6/0x550
>    [<ffffffffaa102827>] tcf_chain_create+0x97/0x460
>    [<ffffffffaa102f67>] tcf_block_get+0x127/0x230
>    [<ffffffffc03e8546>] ingress_init+0x76/0x110 [sch_ingress]
>    [<ffffffffaa0fbb1c>] qdisc_create+0x2ec/0x1100
>    [<ffffffffaa0fce1a>] tc_modify_qdisc+0x4ea/0x1ae0
>    [<ffffffffaa0355dc>] rtnetlink_rcv_msg+0xa3c/0x1400
>    [<ffffffffaa12e3cb>] netlink_rcv_skb+0x22b/0x4e0
>    [<ffffffffaa024b55>] rtnetlink_rcv+0x15/0x20
>    [<ffffffffaa12bddd>] netlink_unicast+0x47d/0x710
>    [<ffffffffaa12caef>] netlink_sendmsg+0xa7f/0x1140
>    [<ffffffffa9f15c52>] sock_sendmsg+0xe2/0x170
>    [<ffffffffa9f188bd>] ___sys_sendmsg+0x72d/0xcc0
>    [<ffffffffa9f1bfa2>] __sys_sendmsg+0xe2/0x260
>    [<ffffffffa9f1c132>] SyS_sendmsg+0x12/0x20
>unreferenced object 0xffff880749f82a48 (size 64):
>  comm "tc", pid 2381, jiffies 4294972986 (age 1375.812s)
>  hex dump (first 32 bytes):
>    00 00 00 00 00 00 00 00 c0 b7 31 31 07 88 ff ff  ..........11....
>    58 2a f8 49 07 88 ff ff 58 2a f8 49 07 88 ff ff  X*.I....X*.I....
>  backtrace:
>    [<ffffffffaa6b0118>] kmemleak_alloc+0x28/0x50
>    [<ffffffffa89a89b6>] kmem_cache_alloc_trace+0x1e6/0x550
>    [<ffffffffaa102827>] tcf_chain_create+0x97/0x460
>    [<ffffffffaa102f67>] tcf_block_get+0x127/0x230
>    [<ffffffffc03e8546>] ingress_init+0x76/0x110 [sch_ingress]
>    [<ffffffffaa0fbb1c>] qdisc_create+0x2ec/0x1100
>    [<ffffffffaa0fce1a>] tc_modify_qdisc+0x4ea/0x1ae0
>    [<ffffffffaa0355dc>] rtnetlink_rcv_msg+0xa3c/0x1400
>    [<ffffffffaa12e3cb>] netlink_rcv_skb+0x22b/0x4e0
>    [<ffffffffaa024b55>] rtnetlink_rcv+0x15/0x20
>    [<ffffffffaa12bddd>] netlink_unicast+0x47d/0x710
>    [<ffffffffaa12caef>] netlink_sendmsg+0xa7f/0x1140
>    [<ffffffffa9f15c52>] sock_sendmsg+0xe2/0x170
>    [<ffffffffa9f188bd>] ___sys_sendmsg+0x72d/0xcc0
>    [<ffffffffa9f1bfa2>] __sys_sendmsg+0xe2/0x260
>    [<ffffffffa9f1c132>] SyS_sendmsg+0x12/0x20
>unreferenced object 0xffff8803fd855a08 (size 64):
>  comm "tc", pid 2663, jiffies 4294992152 (age 1299.328s)
>  hex dump (first 32 bytes):
>    00 00 00 00 00 00 00 00 20 49 80 31 07 88 ff ff  ........ I.1....
>    18 5a 85 fd 03 88 ff ff 18 5a 85 fd 03 88 ff ff  .Z.......Z......
>  backtrace:
>    [<ffffffffaa6b0118>] kmemleak_alloc+0x28/0x50
>    [<ffffffffa89a89b6>] kmem_cache_alloc_trace+0x1e6/0x550
>    [<ffffffffaa102827>] tcf_chain_create+0x97/0x460
>    [<ffffffffaa102f67>] tcf_block_get+0x127/0x230
>    [<ffffffffc03e8546>] ingress_init+0x76/0x110 [sch_ingress]
>    [<ffffffffaa0fbb1c>] qdisc_create+0x2ec/0x1100
>    [<ffffffffaa0fce1a>] tc_modify_qdisc+0x4ea/0x1ae0
>    [<ffffffffaa0355dc>] rtnetlink_rcv_msg+0xa3c/0x1400
>    [<ffffffffaa12e3cb>] netlink_rcv_skb+0x22b/0x4e0
>    [<ffffffffaa024b55>] rtnetlink_rcv+0x15/0x20
>    [<ffffffffaa12bddd>] netlink_unicast+0x47d/0x710
>    [<ffffffffaa12caef>] netlink_sendmsg+0xa7f/0x1140
>    [<ffffffffa9f15c52>] sock_sendmsg+0xe2/0x170
>    [<ffffffffa9f188bd>] ___sys_sendmsg+0x72d/0xcc0
>    [<ffffffffa9f1bfa2>] __sys_sendmsg+0xe2/0x260
>    [<ffffffffa9f1c132>] SyS_sendmsg+0x12/0x20
>unreferenced object 0xffff88071b096f28 (size 64):
>  comm "tc", pid 2943, jiffies 4295013397 (age 1214.352s)
>  hex dump (first 32 bytes):
>    00 00 00 00 00 00 00 00 c0 37 e7 30 07 88 ff ff  .........7.0....
>    38 6f 09 1b 07 88 ff ff 38 6f 09 1b 07 88 ff ff  8o......8o......
>  backtrace:
>    [<ffffffffaa6b0118>] kmemleak_alloc+0x28/0x50
>    [<ffffffffa89a89b6>] kmem_cache_alloc_trace+0x1e6/0x550
>    [<ffffffffaa102827>] tcf_chain_create+0x97/0x460
>    [<ffffffffaa102f67>] tcf_block_get+0x127/0x230
>    [<ffffffffc03e8546>] ingress_init+0x76/0x110 [sch_ingress]
>    [<ffffffffaa0fbb1c>] qdisc_create+0x2ec/0x1100
>    [<ffffffffaa0fce1a>] tc_modify_qdisc+0x4ea/0x1ae0
>    [<ffffffffaa0355dc>] rtnetlink_rcv_msg+0xa3c/0x1400
>    [<ffffffffaa12e3cb>] netlink_rcv_skb+0x22b/0x4e0
>    [<ffffffffaa024b55>] rtnetlink_rcv+0x15/0x20
>    [<ffffffffaa12bddd>] netlink_unicast+0x47d/0x710
>    [<ffffffffaa12caef>] netlink_sendmsg+0xa7f/0x1140
>    [<ffffffffa9f15c52>] sock_sendmsg+0xe2/0x170
>    [<ffffffffa9f188bd>] ___sys_sendmsg+0x72d/0xcc0
>    [<ffffffffa9f1bfa2>] __sys_sendmsg+0xe2/0x260
>    [<ffffffffa9f1c132>] SyS_sendmsg+0x12/0x20
>unreferenced object 0xffff880731f66568 (size 64):
>  comm "tc", pid 3263, jiffies 4295033366 (age 1134.480s)
>  hex dump (first 32 bytes):
>    00 00 00 00 00 00 00 00 00 95 64 65 07 88 ff ff  ..........de....
>    78 65 f6 31 07 88 ff ff 78 65 f6 31 07 88 ff ff  xe.1....xe.1....
>  backtrace:
>    [<ffffffffaa6b0118>] kmemleak_alloc+0x28/0x50
>    [<ffffffffa89a89b6>] kmem_cache_alloc_trace+0x1e6/0x550
>    [<ffffffffaa102827>] tcf_chain_create+0x97/0x460
>    [<ffffffffaa102f67>] tcf_block_get+0x127/0x230
>    [<ffffffffc03e8546>] ingress_init+0x76/0x110 [sch_ingress]
>    [<ffffffffaa0fbb1c>] qdisc_create+0x2ec/0x1100
>    [<ffffffffaa0fce1a>] tc_modify_qdisc+0x4ea/0x1ae0
>    [<ffffffffaa0355dc>] rtnetlink_rcv_msg+0xa3c/0x1400
>    [<ffffffffaa12e3cb>] netlink_rcv_skb+0x22b/0x4e0
>    [<ffffffffaa024b55>] rtnetlink_rcv+0x15/0x20
>    [<ffffffffaa12bddd>] netlink_unicast+0x47d/0x710
>    [<ffffffffaa12caef>] netlink_sendmsg+0xa7f/0x1140
>    [<ffffffffa9f15c52>] sock_sendmsg+0xe2/0x170
>    [<ffffffffa9f188bd>] ___sys_sendmsg+0x72d/0xcc0
>    [<ffffffffa9f1bfa2>] __sys_sendmsg+0xe2/0x260
>    [<ffffffffa9f1c132>] SyS_sendmsg+0x12/0x20

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net] net: sched: don't use GFP_KERNEL under spin lock
  2017-09-05 10:54 [PATCH net] net: sched: don't use GFP_KERNEL under spin lock Jakub Kicinski
  2017-09-05 10:59 ` Jakub Kicinski
@ 2017-09-05 14:10 ` Eric Dumazet
  1 sibling, 0 replies; 6+ messages in thread
From: Eric Dumazet @ 2017-09-05 14:10 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: netdev, jiri, Chris Mi, xiyou.wangcong, jhs, oss-drivers

On Tue, 2017-09-05 at 03:54 -0700, Jakub Kicinski wrote:
> The new TC IDR code uses GFP_KERNEL under spinlocks.  Which leads
> to:

> ...
> 
> Fixes: 65a206c01e8e ("net/sched: Change act_api and act_xxx modules to use IDR")
> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
> Reviewed-by: Simon Horman <simon.horman@netronome.com>
> ---
>  net/sched/act_api.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/sched/act_api.c b/net/sched/act_api.c
> index 0eb545bcb247..a48e4b45722d 100644
> --- a/net/sched/act_api.c
> +++ b/net/sched/act_api.c
> @@ -298,7 +298,7 @@ int tcf_idr_create(struct tc_action_net *tn, u32 index, struct nlattr *est,
>  	if (!index) {


		idr_preload(GFP_KERNEL);

>  		spin_lock_bh(&idrinfo->lock);
>  		err = idr_alloc_ext(idr, NULL, &idr_index, 1, 0,
> -				    GFP_KERNEL);
> +				    GFP_ATOMIC);
>  		spin_unlock_bh(&idrinfo->lock);
>  		if (err) {
>  err3:
> @@ -309,7 +309,7 @@ int tcf_idr_create(struct tc_action_net *tn, u32 index, struct nlattr *est,
>  	} else {

		idr_preload(GFP_KERNEL);

>  		spin_lock_bh(&idrinfo->lock);
>  		err = idr_alloc_ext(idr, NULL, NULL, index, index + 1,
> -				    GFP_KERNEL);
> +				    GFP_ATOMIC);
>  		spin_unlock_bh(&idrinfo->lock);
>  		if (err)
>  			goto err3;

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [oss-drivers] Re: [PATCH net] net: sched: don't use GFP_KERNEL under spin lock
  2017-09-05 12:52   ` Jiri Pirko
@ 2017-09-05 14:25     ` Jakub Kicinski
  2017-09-05 14:31       ` Jiri Pirko
  0 siblings, 1 reply; 6+ messages in thread
From: Jakub Kicinski @ 2017-09-05 14:25 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: netdev, oss-drivers

On Tue, 5 Sep 2017 14:52:21 +0200, Jiri Pirko wrote:
> Tue, Sep 05, 2017 at 12:59:48PM CEST, kubakici@wp.pl wrote:
> >Jiri, FWIW I also just noticed these, but they seem related to the
> >earlier TC chain work?  
> 
> What do you do to trigger this?

Sorry, I wasted a bit of time there because kmemleak takes surprisingly
long to notice the memory leak...  In the end this is sufficient:

 modprobe nfp
 ifconfig p4p1 10.8.1.1/24 up
 tc qdisc add dev p4p1 handle ffff: ingress
 tc filter add dev p4p1 parent ffff: protocol 802.1Q flower vlan_id 600 \
     action mirred egress redirect dev p4p1
 tc filter del dev p4p1 parent ffff:
 rmmod nfp

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [oss-drivers] Re: [PATCH net] net: sched: don't use GFP_KERNEL under spin lock
  2017-09-05 14:25     ` [oss-drivers] " Jakub Kicinski
@ 2017-09-05 14:31       ` Jiri Pirko
  0 siblings, 0 replies; 6+ messages in thread
From: Jiri Pirko @ 2017-09-05 14:31 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: netdev, oss-drivers

Tue, Sep 05, 2017 at 04:25:51PM CEST, kubakici@wp.pl wrote:
>On Tue, 5 Sep 2017 14:52:21 +0200, Jiri Pirko wrote:
>> Tue, Sep 05, 2017 at 12:59:48PM CEST, kubakici@wp.pl wrote:
>> >Jiri, FWIW I also just noticed these, but they seem related to the
>> >earlier TC chain work?  
>> 
>> What do you do to trigger this?
>
>Sorry, I wasted a bit of time there because kmemleak takes surprisingly
>long to notice the memory leak...  In the end this is sufficient:
>
> modprobe nfp
> ifconfig p4p1 10.8.1.1/24 up
> tc qdisc add dev p4p1 handle ffff: ingress
> tc filter add dev p4p1 parent ffff: protocol 802.1Q flower vlan_id 600 \
>     action mirred egress redirect dev p4p1
> tc filter del dev p4p1 parent ffff:
> rmmod nfp

Will try. Thanks!

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-09-05 14:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-05 10:54 [PATCH net] net: sched: don't use GFP_KERNEL under spin lock Jakub Kicinski
2017-09-05 10:59 ` Jakub Kicinski
2017-09-05 12:52   ` Jiri Pirko
2017-09-05 14:25     ` [oss-drivers] " Jakub Kicinski
2017-09-05 14:31       ` Jiri Pirko
2017-09-05 14:10 ` Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).