* Re: Regression, bisected: reference leak with IPSec since ~2.6.31
From: Eric Dumazet @ 2010-09-21 9:21 UTC (permalink / raw)
To: Jarek Poplawski; +Cc: Nick Bowler, linux-kernel, netdev, David S. Miller
In-Reply-To: <20100921091248.GA8424@ff.dom.local>
Le mardi 21 septembre 2010 à 09:12 +0000, Jarek Poplawski a écrit :
> On 2010-09-20 23:31, Eric Dumazet wrote:
> ...
> > [PATCH] ip : fix truesize mismatch in ip fragmentation
> >
> > We should not set frag->destructor to sock_wkfree() until we are sure we
> > dont hit slow path in ip_fragment(). Or we risk uncharging
> > frag->truesize twice, and in the end, having negative socket
> > sk_wmem_alloc counter, or even freeing socket sooner than expected.
> >
> > Many thanks to Nick Bowler, who provided a very clean bug report and
> > test programs.
> >
> > While Nick bisection pointed to commit 2b85a34e911bf483 (net: No more
> > expensive sock_hold()/sock_put() on each tx), underlying bug is older.
> >
> > Reported-and-bisected-by: Nick Bowler <nbowler@elliptictech.com>
> > Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> > ---
> > net/ipv4/ip_output.c | 8 ++++----
> > net/ipv6/ip6_output.c | 10 +++++-----
> > 2 files changed, 9 insertions(+), 9 deletions(-)
> >
> > diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
> > index 04b6989..126d9b3 100644
> > --- a/net/ipv4/ip_output.c
> > +++ b/net/ipv4/ip_output.c
> > @@ -490,7 +490,6 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
> > if (skb_has_frags(skb)) {
> > struct sk_buff *frag;
> > int first_len = skb_pagelen(skb);
> > - int truesizes = 0;
> >
> > if (first_len - hlen > mtu ||
> > ((first_len - hlen) & 7) ||
> > @@ -510,11 +509,13 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
> > goto slow_path;
> >
> > BUG_ON(frag->sk);
> > - if (skb->sk) {
> > + }
> > + if (skb->sk) {
> > + skb_walk_frags(skb, frag) {
> > frag->sk = skb->sk;
> > frag->destructor = sock_wfree;
>
> Nice catch, but it seems doing it in the first loop as now, and
> reverting changes before goto slow_path might be more optimal here.
>
I thought of this, but found this function already very complex.
Once everything is in cpu caches, the added loop is very cheap.
I liked the :
<check everything without changing state>
if something wrong
goto slow_path
else
<OK, lets do destructive things>
^ permalink raw reply
* Re: Regression, bisected: reference leak with IPSec since ~2.6.31
From: Jarek Poplawski @ 2010-09-21 9:12 UTC (permalink / raw)
To: Eric Dumazet; +Cc: Nick Bowler, linux-kernel, netdev, David S. Miller
In-Reply-To: <1285018272.2323.243.camel@edumazet-laptop>
On 2010-09-20 23:31, Eric Dumazet wrote:
...
> [PATCH] ip : fix truesize mismatch in ip fragmentation
>
> We should not set frag->destructor to sock_wkfree() until we are sure we
> dont hit slow path in ip_fragment(). Or we risk uncharging
> frag->truesize twice, and in the end, having negative socket
> sk_wmem_alloc counter, or even freeing socket sooner than expected.
>
> Many thanks to Nick Bowler, who provided a very clean bug report and
> test programs.
>
> While Nick bisection pointed to commit 2b85a34e911bf483 (net: No more
> expensive sock_hold()/sock_put() on each tx), underlying bug is older.
>
> Reported-and-bisected-by: Nick Bowler <nbowler@elliptictech.com>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> ---
> net/ipv4/ip_output.c | 8 ++++----
> net/ipv6/ip6_output.c | 10 +++++-----
> 2 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
> index 04b6989..126d9b3 100644
> --- a/net/ipv4/ip_output.c
> +++ b/net/ipv4/ip_output.c
> @@ -490,7 +490,6 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
> if (skb_has_frags(skb)) {
> struct sk_buff *frag;
> int first_len = skb_pagelen(skb);
> - int truesizes = 0;
>
> if (first_len - hlen > mtu ||
> ((first_len - hlen) & 7) ||
> @@ -510,11 +509,13 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
> goto slow_path;
>
> BUG_ON(frag->sk);
> - if (skb->sk) {
> + }
> + if (skb->sk) {
> + skb_walk_frags(skb, frag) {
> frag->sk = skb->sk;
> frag->destructor = sock_wfree;
Nice catch, but it seems doing it in the first loop as now, and
reverting changes before goto slow_path might be more optimal here.
Jarek P.
^ permalink raw reply
* Re: [2.6.36-rc5] INET?: possible irq lock inversion dependency
From: Tetsuo Handa @ 2010-09-21 9:10 UTC (permalink / raw)
To: eric.dumazet; +Cc: linux-fsdevel, netdev
In-Reply-To: <1285055760.2617.27.camel@edumazet-laptop>
Eric Dumazet wrote:
> I would say someone calls xs_tcp_state_change() while softirqs are not
> masked.
>
> If its expected, then following patch is needed ?
After applying your patch, I got the same warning on different place.
I got this when doing "mount 127.0.0.1:/usr/src/ /mnt/".
Regards.
[ 320.747630]
[ 320.747633] =========================================================
[ 320.749957] [ INFO: possible irq lock inversion dependency detected ]
[ 320.749957] 2.6.36-rc5-old #3
[ 320.749957] ---------------------------------------------------------
[ 320.749957] mount/3799 just changed the state of lock:
[ 320.749957] (clock-AF_INET){++.?..}, at: [<c135ec4c>] xs_udp_write_space+0x1c/0x50
[ 320.749957] but this lock was taken by another, SOFTIRQ-safe lock in the past:
[ 320.749957] (slock-AF_INET){+.-...}
[ 320.749957]
[ 320.749957] and interrupts could create inverse lock ordering between them.
[ 320.749957]
[ 320.749957]
[ 320.749957] other info that might help us debug this:
[ 320.749957] no locks held by mount/3799.
[ 320.749957]
[ 320.749957] the shortest dependencies between 2nd lock and 1st lock:
[ 320.749957] -> (slock-AF_INET){+.-...} ops: 4340 {
[ 320.749957] HARDIRQ-ON-W at:
[ 320.749957] [<c106ab8e>] mark_irqflags+0xfe/0x180
[ 320.749957] [<c106b90d>] __lock_acquire+0x38d/0x8e0
[ 320.749957] [<c106ceaa>] lock_acquire+0x7a/0xa0
[ 320.749957] [<c138ca3e>] _raw_spin_lock_bh+0x3e/0x80
[ 320.749957] [<c12dba59>] lock_sock_fast+0x29/0x90
[ 320.749957] [<c132bdb4>] udp_destroy_sock+0x14/0x40
[ 320.749957] [<c12dbdb3>] sk_common_release+0xb3/0xc0
[ 320.749957] [<c132c728>] udp_lib_close+0x8/0x10
[ 320.749957] [<c133268e>] inet_release+0xbe/0x100
[ 320.749957] [<c12d5f66>] sock_release+0x66/0x80
[ 320.749957] [<c12d6ce2>] sock_close+0x12/0x30
[ 320.749957] [<c10c66fb>] __fput+0x1cb/0x240
[ 320.749957] [<c10c6789>] fput+0x19/0x20
[ 320.749957] [<c10c45c3>] filp_close+0x43/0x70
[ 320.749957] [<c103fded>] close_files+0xad/0x150
[ 320.749957] [<c103fef9>] put_files_struct+0x29/0xf0
[ 320.749957] [<c1040050>] exit_files+0x40/0x50
[ 320.749957] [<c1040716>] do_exit+0x116/0x2e0
[ 320.749957] [<c1040944>] do_group_exit+0x34/0xb0
[ 320.749957] [<c10409cf>] sys_exit_group+0xf/0x20
[ 320.749957] [<c138d4e1>] syscall_call+0x7/0xb
[ 320.749957] IN-SOFTIRQ-W at:
[ 320.749957] [<c106abae>] mark_irqflags+0x11e/0x180
[ 320.749957] [<c106b90d>] __lock_acquire+0x38d/0x8e0
[ 320.749957] [<c106ceaa>] lock_acquire+0x7a/0xa0
[ 320.749957] [<c138c8c9>] _raw_spin_lock+0x39/0x70
[ 320.749957] [<c12da3f1>] sk_clone+0xb1/0x2c0
[ 320.749957] [<c13108ea>] inet_csk_clone+0x1a/0xb0
[ 320.749957] [<c1325ecc>] tcp_create_openreq_child+0x1c/0x460
[ 320.749957] [<c132359f>] tcp_v4_syn_recv_sock+0x3f/0x1e0
[ 320.749957] [<c132649c>] tcp_check_req+0x18c/0x3b0
[ 320.749957] [<c132378d>] tcp_v4_hnd_req+0x4d/0x160
[ 320.749957] [<c1323ab9>] tcp_v4_do_rcv+0x159/0x280
[ 320.749957] [<c1324154>] tcp_v4_rcv+0x574/0xa30
[ 320.749957] [<c1305f63>] ip_local_deliver_finish+0x103/0x320
[ 320.749957] [<c13061b0>] ip_local_deliver+0x30/0x40
[ 320.749957] [<c1306329>] ip_rcv_finish+0x169/0x480
[ 320.749957] [<c13067da>] ip_rcv+0x19a/0x2b0
[ 320.749957] [<c12e743d>] __netif_receive_skb+0x21d/0x310
[ 320.749957] [<c12e7f48>] process_backlog+0x88/0x160
[ 320.749957] [<c12e8317>] net_rx_action+0x127/0x140
[ 320.749957] [<c1042e90>] __do_softirq+0xd0/0x130
[ 320.749957] INITIAL USE at:
[ 320.749957] [<c106b740>] __lock_acquire+0x1c0/0x8e0
[ 320.749957] [<c106ceaa>] lock_acquire+0x7a/0xa0
[ 320.749957] [<c138ca3e>] _raw_spin_lock_bh+0x3e/0x80
[ 320.749957] [<c12dba59>] lock_sock_fast+0x29/0x90
[ 320.749957] [<c132bdb4>] udp_destroy_sock+0x14/0x40
[ 320.749957] [<c12dbdb3>] sk_common_release+0xb3/0xc0
[ 320.749957] [<c132c728>] udp_lib_close+0x8/0x10
[ 320.749957] [<c133268e>] inet_release+0xbe/0x100
[ 320.749957] [<c12d5f66>] sock_release+0x66/0x80
[ 320.749957] [<c12d6ce2>] sock_close+0x12/0x30
[ 320.749957] [<c10c66fb>] __fput+0x1cb/0x240
[ 320.749957] [<c10c6789>] fput+0x19/0x20
[ 320.749957] [<c10c45c3>] filp_close+0x43/0x70
[ 320.749957] [<c103fded>] close_files+0xad/0x150
[ 320.749957] [<c103fef9>] put_files_struct+0x29/0xf0
[ 320.749957] [<c1040050>] exit_files+0x40/0x50
[ 320.749957] [<c1040716>] do_exit+0x116/0x2e0
[ 320.749957] [<c1040944>] do_group_exit+0x34/0xb0
[ 320.749957] [<c10409cf>] sys_exit_group+0xf/0x20
[ 320.749957] [<c138d4e1>] syscall_call+0x7/0xb
[ 320.749957] }
[ 320.749957] ... key at: [<c1d4d9f0>] af_family_slock_keys+0x10/0x140
[ 320.749957] ... acquired at:
[ 320.749957] [<c10693bb>] check_prevs_add+0xab/0x100
[ 320.749957] [<c1069745>] validate_chain+0x305/0x5a0
[ 320.749957] [<c106b82d>] __lock_acquire+0x2ad/0x8e0
[ 320.749957] [<c106ceaa>] lock_acquire+0x7a/0xa0
[ 320.749957] [<c138d07e>] _raw_write_lock_bh+0x3e/0x80
[ 320.749957] [<c1310c16>] inet_csk_listen_stop+0x86/0x160
[ 320.749957] [<c1313772>] tcp_close+0x382/0x390
[ 320.749957] [<c133268e>] inet_release+0xbe/0x100
[ 320.749957] [<c12d5f66>] sock_release+0x66/0x80
[ 320.749957] [<c12d6ce2>] sock_close+0x12/0x30
[ 320.749957] [<c10c66fb>] __fput+0x1cb/0x240
[ 320.749957] [<c10c6789>] fput+0x19/0x20
[ 320.749957] [<c10c45c3>] filp_close+0x43/0x70
[ 320.749957] [<c10c465d>] sys_close+0x6d/0x110
[ 320.749957] [<c138d4e1>] syscall_call+0x7/0xb
[ 320.749957]
[ 320.749957] -> (clock-AF_INET){++.?..} ops: 850 {
[ 320.749957] HARDIRQ-ON-W at:
[ 320.749957] [<c106ab8e>] mark_irqflags+0xfe/0x180
[ 320.749957] [<c106b90d>] __lock_acquire+0x38d/0x8e0
[ 320.749957] [<c106ceaa>] lock_acquire+0x7a/0xa0
[ 320.749957] [<c138d07e>] _raw_write_lock_bh+0x3e/0x80
[ 320.749957] [<c12dbd2f>] sk_common_release+0x2f/0xc0
[ 320.749957] [<c132c728>] udp_lib_close+0x8/0x10
[ 320.749957] [<c133268e>] inet_release+0xbe/0x100
[ 320.749957] [<c12d5f66>] sock_release+0x66/0x80
[ 320.749957] [<c12d6ce2>] sock_close+0x12/0x30
[ 320.749957] [<c10c66fb>] __fput+0x1cb/0x240
[ 320.749957] [<c10c6789>] fput+0x19/0x20
[ 320.749957] [<c10c45c3>] filp_close+0x43/0x70
[ 320.749957] [<c103fded>] close_files+0xad/0x150
[ 320.749957] [<c103fef9>] put_files_struct+0x29/0xf0
[ 320.749957] [<c1040050>] exit_files+0x40/0x50
[ 320.749957] [<c1040716>] do_exit+0x116/0x2e0
[ 320.749957] [<c1040944>] do_group_exit+0x34/0xb0
[ 320.749957] [<c10409cf>] sys_exit_group+0xf/0x20
[ 320.749957] [<c138d4e1>] syscall_call+0x7/0xb
[ 320.749957] HARDIRQ-ON-R at:
[ 320.749957] [<c106aafe>] mark_irqflags+0x6e/0x180
[ 320.749957] [<c106b90d>] __lock_acquire+0x38d/0x8e0
[ 320.749957] [<c106ceaa>] lock_acquire+0x7a/0xa0
[ 320.749957] [<c138cd5e>] _raw_read_lock_bh+0x3e/0x80
[ 320.749957] [<c135e9be>] xs_tcp_state_change+0x1e/0x1d0
[ 320.749957] [<c131c8a8>] tcp_rcv_synsent_state_process+0x398/0x590
[ 320.749957] [<c131cf47>] tcp_rcv_state_process+0x4a7/0x560
[ 320.749957] [<c13239d1>] tcp_v4_do_rcv+0x71/0x280
[ 320.749957] [<c12dad26>] __release_sock+0x66/0x150
[ 320.749957] [<c12dba27>] release_sock+0x87/0x90
[ 320.749957] [<c1332a7a>] inet_stream_connect+0x5a/0x1b0
[ 320.749957] [<c12d8888>] kernel_connect+0x18/0x30
[ 320.749957] [<c135f66e>] xs_tcp_finish_connecting+0x4e/0x120
[ 320.749957] [<c135f79b>] xs_tcp_setup_socket+0x5b/0x180
[ 320.749957] [<c135f9d4>] xs_tcp_connect_worker4+0x14/0x20
[ 320.749957] [<c1051767>] process_one_work+0x147/0x3a0
[ 320.749957] [<c1051aa6>] worker_thread+0xa6/0x200
[ 320.749957] [<c1056985>] kthread+0x75/0x80
[ 320.749957] [<c10031fa>] kernel_thread_helper+0x6/0x1c
[ 320.749957] IN-SOFTIRQ-R at:
[ 320.749957] [<c106abae>] mark_irqflags+0x11e/0x180
[ 320.749957] [<c106b90d>] __lock_acquire+0x38d/0x8e0
[ 320.749957] [<c106ceaa>] lock_acquire+0x7a/0xa0
[ 320.749957] [<c138cbe9>] _raw_read_lock+0x39/0x70
[ 320.749957] [<c135e891>] xs_tcp_data_ready+0x21/0x90
[ 320.749957] [<c131ad68>] tcp_data_queue+0x248/0x820
[ 320.749957] [<c131c0de>] tcp_rcv_established+0xae/0x4e0
[ 320.749957] [<c1323b31>] tcp_v4_do_rcv+0x1d1/0x280
[ 320.749957] [<c1324154>] tcp_v4_rcv+0x574/0xa30
[ 320.749957] [<c1305f63>] ip_local_deliver_finish+0x103/0x320
[ 320.749957] [<c13061b0>] ip_local_deliver+0x30/0x40
[ 320.749957] [<c1306329>] ip_rcv_finish+0x169/0x480
[ 320.749957] [<c13067da>] ip_rcv+0x19a/0x2b0
[ 320.749957] [<c12e743d>] __netif_receive_skb+0x21d/0x310
[ 320.749957] [<c12e7f48>] process_backlog+0x88/0x160
[ 320.749957] [<c12e8317>] net_rx_action+0x127/0x140
[ 320.749957] [<c1042e90>] __do_softirq+0xd0/0x130
[ 320.749957] SOFTIRQ-ON-R at:
[ 320.749957] [<c106ab72>] mark_irqflags+0xe2/0x180
[ 320.749957] [<c106b90d>] __lock_acquire+0x38d/0x8e0
[ 320.749957] [<c106ceaa>] lock_acquire+0x7a/0xa0
[ 320.749957] [<c138cbe9>] _raw_read_lock+0x39/0x70
[ 320.749957] [<c135ec4c>] xs_udp_write_space+0x1c/0x50
[ 320.749957] [<c135ed5a>] xs_udp_do_set_buffer_size+0x8a/0x90
[ 320.749957] [<c135ed9d>] xs_udp_set_buffer_size+0x3d/0x40
[ 320.749957] [<c135a0e8>] rpc_setbufsize+0x28/0x30
[ 320.749957] [<e09c4314>] nfs_server_set_fsinfo+0x364/0x400 [nfs]
[ 320.749957] [<e09c4415>] nfs_probe_fsinfo+0x65/0x100 [nfs]
[ 320.749957] [<e09c4717>] nfs_create_server+0x87/0x240 [nfs]
[ 320.749957] [<e09ceaeb>] nfs_get_sb+0x8b/0x240 [nfs]
[ 320.749957] [<c10c82c1>] vfs_kern_mount+0x71/0x190
[ 320.749957] [<c10c8607>] do_kern_mount+0x37/0x90
[ 320.749957] [<c10deae7>] do_new_mount+0x57/0xa0
[ 320.749957] [<c10df111>] do_mount+0x171/0x1b0
[ 320.749957] [<c10df40c>] sys_mount+0x6c/0xa0
[ 320.749957] [<c138d4e1>] syscall_call+0x7/0xb
[ 320.749957] INITIAL USE at:
[ 320.749957] [<c106b740>] __lock_acquire+0x1c0/0x8e0
[ 320.749957] [<c106ceaa>] lock_acquire+0x7a/0xa0
[ 320.749957] [<c138d07e>] _raw_write_lock_bh+0x3e/0x80
[ 320.749957] [<c12dbd2f>] sk_common_release+0x2f/0xc0
[ 320.749957] [<c132c728>] udp_lib_close+0x8/0x10
[ 320.749957] [<c133268e>] inet_release+0xbe/0x100
[ 320.749957] [<c12d5f66>] sock_release+0x66/0x80
[ 320.749957] [<c12d6ce2>] sock_close+0x12/0x30
[ 320.749957] [<c10c66fb>] __fput+0x1cb/0x240
[ 320.749957] [<c10c6789>] fput+0x19/0x20
[ 320.749957] [<c10c45c3>] filp_close+0x43/0x70
[ 320.749957] [<c103fded>] close_files+0xad/0x150
[ 320.749957] [<c103fef9>] put_files_struct+0x29/0xf0
[ 320.749957] [<c1040050>] exit_files+0x40/0x50
[ 320.749957] [<c1040716>] do_exit+0x116/0x2e0
[ 320.749957] [<c1040944>] do_group_exit+0x34/0xb0
[ 320.749957] [<c10409cf>] sys_exit_group+0xf/0x20
[ 320.749957] [<c138d4e1>] syscall_call+0x7/0xb
[ 320.749957] }
[ 320.749957] ... key at: [<c1d4db30>] af_callback_keys+0x10/0x130
[ 320.749957] ... acquired at:
[ 320.749957] [<c1069ff6>] check_usage_backwards+0x76/0xd0
[ 320.749957] [<c106a209>] mark_lock_irq+0x99/0x240
[ 320.749957] [<c106aeac>] mark_lock+0x21c/0x3c0
[ 320.749957] [<c106ab72>] mark_irqflags+0xe2/0x180
[ 320.749957] [<c106b90d>] __lock_acquire+0x38d/0x8e0
[ 320.749957] [<c106ceaa>] lock_acquire+0x7a/0xa0
[ 320.749957] [<c138cbe9>] _raw_read_lock+0x39/0x70
[ 320.749957] [<c135ec4c>] xs_udp_write_space+0x1c/0x50
[ 320.749957] [<c135ed5a>] xs_udp_do_set_buffer_size+0x8a/0x90
[ 320.749957] [<c135ed9d>] xs_udp_set_buffer_size+0x3d/0x40
[ 320.749957] [<c135a0e8>] rpc_setbufsize+0x28/0x30
[ 320.749957] [<e09c4314>] nfs_server_set_fsinfo+0x364/0x400 [nfs]
[ 320.749957] [<e09c4415>] nfs_probe_fsinfo+0x65/0x100 [nfs]
[ 320.749957] [<e09c4717>] nfs_create_server+0x87/0x240 [nfs]
[ 320.749957] [<e09ceaeb>] nfs_get_sb+0x8b/0x240 [nfs]
[ 320.749957] [<c10c82c1>] vfs_kern_mount+0x71/0x190
[ 320.749957] [<c10c8607>] do_kern_mount+0x37/0x90
[ 320.749957] [<c10deae7>] do_new_mount+0x57/0xa0
[ 320.749957] [<c10df111>] do_mount+0x171/0x1b0
[ 320.749957] [<c10df40c>] sys_mount+0x6c/0xa0
[ 320.749957] [<c138d4e1>] syscall_call+0x7/0xb
[ 320.749957]
[ 320.749957]
[ 320.749957] stack backtrace:
[ 320.749957] Pid: 3799, comm: mount Not tainted 2.6.36-rc5-old #3
[ 320.749957] Call Trace:
[ 320.749957] [<c103ded8>] ? printk+0x18/0x20
[ 320.749957] [<c1069e88>] print_irq_inversion_bug+0x108/0x120
[ 320.749957] [<c1069ff6>] check_usage_backwards+0x76/0xd0
[ 320.749957] [<c106a209>] mark_lock_irq+0x99/0x240
[ 320.749957] [<c1069f80>] ? check_usage_backwards+0x0/0xd0
[ 320.749957] [<c106aeac>] mark_lock+0x21c/0x3c0
[ 320.749957] [<c106ab72>] mark_irqflags+0xe2/0x180
[ 320.749957] [<c106b90d>] __lock_acquire+0x38d/0x8e0
[ 320.749957] [<c109a95e>] ? mempool_free_slab+0xe/0x10
[ 320.749957] [<c109a938>] ? mempool_free+0x98/0xa0
[ 320.749957] [<c106ceaa>] lock_acquire+0x7a/0xa0
[ 320.749957] [<c135ec4c>] ? xs_udp_write_space+0x1c/0x50
[ 320.749957] [<c138cbe9>] _raw_read_lock+0x39/0x70
[ 320.749957] [<c135ec4c>] ? xs_udp_write_space+0x1c/0x50
[ 320.749957] [<c135ec4c>] xs_udp_write_space+0x1c/0x50
[ 320.749957] [<c135ed5a>] xs_udp_do_set_buffer_size+0x8a/0x90
[ 320.749957] [<c135ed9d>] xs_udp_set_buffer_size+0x3d/0x40
[ 320.749957] [<c135ed60>] ? xs_udp_set_buffer_size+0x0/0x40
[ 320.749957] [<c135a0e8>] rpc_setbufsize+0x28/0x30
[ 320.749957] [<e09c4314>] nfs_server_set_fsinfo+0x364/0x400 [nfs]
[ 320.749957] [<e09c4415>] nfs_probe_fsinfo+0x65/0x100 [nfs]
[ 320.749957] [<c10bf8b8>] ? cache_alloc_debugcheck_after+0x98/0x1d0
[ 320.749957] [<e09cb1d3>] ? nfs_alloc_fattr+0x23/0x30 [nfs]
[ 320.749957] [<e09c4717>] nfs_create_server+0x87/0x240 [nfs]
[ 320.749957] [<e09cb1f5>] ? nfs_alloc_fhandle+0x15/0x30 [nfs]
[ 320.749957] [<e09ceaeb>] nfs_get_sb+0x8b/0x240 [nfs]
[ 320.749957] [<e09ce9b0>] ? nfs_compare_super+0x0/0x90 [nfs]
[ 320.749957] [<c10c82c1>] vfs_kern_mount+0x71/0x190
[ 320.749957] [<c10dc4fc>] ? get_fs_type+0x8c/0xa0
[ 320.749957] [<c10c8607>] do_kern_mount+0x37/0x90
[ 320.749957] [<c10deae7>] do_new_mount+0x57/0xa0
[ 320.749957] [<c10df111>] do_mount+0x171/0x1b0
[ 320.749957] [<c10df40c>] sys_mount+0x6c/0xa0
[ 320.749957] [<c138d4e1>] syscall_call+0x7/0xb
^ permalink raw reply
* [PATCH -next 3/3] sundance: Use dev_kfree_skb_any() helper
From: Denis Kirjanov @ 2010-09-21 8:57 UTC (permalink / raw)
To: davem; +Cc: netdev
Use dev_kfree_skb_any() helper to free the skb
Signed-off-by: Denis Kirjanov <dkirjanov@kernel.org>
---
drivers/net/sundance.c | 6 +-----
1 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c
index b21e961..794f33f 100644
--- a/drivers/net/sundance.c
+++ b/drivers/net/sundance.c
@@ -1114,7 +1114,6 @@ reset_tx (struct net_device *dev)
void __iomem *ioaddr = np->base;
struct sk_buff *skb;
int i;
- int irq = in_interrupt();
/* Reset tx logic, TxListPtr will be cleaned */
iowrite16 (TxDisable, ioaddr + MACCtrl1);
@@ -1129,10 +1128,7 @@ reset_tx (struct net_device *dev)
dma_unmap_single(&np->pci_dev->dev,
le32_to_cpu(np->tx_ring[i].frag[0].addr),
skb->len, DMA_TO_DEVICE);
- if (irq)
- dev_kfree_skb_irq (skb);
- else
- dev_kfree_skb (skb);
+ dev_kfree_skb_any(skb);
np->tx_skbuff[i] = NULL;
dev->stats.tx_dropped++;
}
--
1.7.2.2
^ permalink raw reply related
* [PATCH -next 2/3] sundance: Handle DMA mapping errors
From: Denis Kirjanov @ 2010-09-21 8:56 UTC (permalink / raw)
To: davem; +Cc: netdev
Check for DMA mapping errors.
Signed-off-by: Denis Kirjanov <dkirjanov@kernel.org>
---
drivers/net/sundance.c | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c
index ac32650..38d6ab2 100644
--- a/drivers/net/sundance.c
+++ b/drivers/net/sundance.c
@@ -1018,6 +1018,12 @@ static void init_ring(struct net_device *dev)
np->rx_ring[i].frag[0].addr = cpu_to_le32(
dma_map_single(&np->pci_dev->dev, skb->data,
np->rx_buf_sz, DMA_FROM_DEVICE));
+ if (dma_mapping_error(&np->pci_dev->dev,
+ np->rx_ring[i].frag[0].addr)) {
+ dev_kfree_skb(skb);
+ np->rx_skbuff[i] = NULL;
+ break;
+ }
np->rx_ring[i].frag[0].length = cpu_to_le32(np->rx_buf_sz | LastFrag);
}
np->dirty_rx = (unsigned int)(i - RX_RING_SIZE);
@@ -1070,6 +1076,9 @@ start_tx (struct sk_buff *skb, struct net_device *dev)
txdesc->status = cpu_to_le32 ((entry << 2) | DisableAlign);
txdesc->frag[0].addr = cpu_to_le32(dma_map_single(&np->pci_dev->dev,
skb->data, skb->len, DMA_TO_DEVICE));
+ if (dma_mapping_error(&np->pci_dev->dev,
+ txdesc->frag[0].addr))
+ goto drop_frame;
txdesc->frag[0].length = cpu_to_le32 (skb->len | LastFrag);
/* Increment cur_tx before tasklet_schedule() */
@@ -1091,6 +1100,12 @@ start_tx (struct sk_buff *skb, struct net_device *dev)
dev->name, np->cur_tx, entry);
}
return NETDEV_TX_OK;
+
+drop_frame:
+ dev_kfree_skb(skb);
+ np->tx_skbuff[entry] = NULL;
+ dev->stats.tx_dropped++;
+ return NETDEV_TX_OK;
}
/* Reset hardware tx and free all of tx buffers */
@@ -1398,6 +1413,12 @@ static void refill_rx (struct net_device *dev)
np->rx_ring[entry].frag[0].addr = cpu_to_le32(
dma_map_single(&np->pci_dev->dev, skb->data,
np->rx_buf_sz, DMA_FROM_DEVICE));
+ if (dma_mapping_error(&np->pci_dev->dev,
+ np->rx_ring[entry].frag[0].addr)) {
+ dev_kfree_skb_irq(skb);
+ np->rx_skbuff[entry] = NULL;
+ break;
+ }
}
/* Perhaps we need not reset this field. */
np->rx_ring[entry].frag[0].length =
--
1.7.2.2
^ permalink raw reply related
* [PATCH -next 1/3] sundance: Convert to DMA API
From: Denis Kirjanov @ 2010-09-21 8:56 UTC (permalink / raw)
To: davem; +Cc: netdev
Convert to DMA API
Signed-off-by: Denis Kirjanov <dkirjanov@kernel.org>
---
drivers/net/sundance.c | 87 +++++++++++++++++++++++------------------------
1 files changed, 43 insertions(+), 44 deletions(-)
diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c
index 3fa9497..ac32650 100644
--- a/drivers/net/sundance.c
+++ b/drivers/net/sundance.c
@@ -96,6 +96,7 @@ static char *media[MAX_UNITS];
#include <asm/io.h>
#include <linux/delay.h>
#include <linux/spinlock.h>
+#include <linux/dma-mapping.h>
#ifndef _COMPAT_WITH_OLD_KERNEL
#include <linux/crc32.h>
#include <linux/ethtool.h>
@@ -523,13 +524,15 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev,
tasklet_init(&np->rx_tasklet, rx_poll, (unsigned long)dev);
tasklet_init(&np->tx_tasklet, tx_poll, (unsigned long)dev);
- ring_space = pci_alloc_consistent(pdev, TX_TOTAL_SIZE, &ring_dma);
+ ring_space = dma_alloc_coherent(&pdev->dev, TX_TOTAL_SIZE,
+ &ring_dma, GFP_KERNEL);
if (!ring_space)
goto err_out_cleardev;
np->tx_ring = (struct netdev_desc *)ring_space;
np->tx_ring_dma = ring_dma;
- ring_space = pci_alloc_consistent(pdev, RX_TOTAL_SIZE, &ring_dma);
+ ring_space = dma_alloc_coherent(&pdev->dev, RX_TOTAL_SIZE,
+ &ring_dma, GFP_KERNEL);
if (!ring_space)
goto err_out_unmap_tx;
np->rx_ring = (struct netdev_desc *)ring_space;
@@ -663,9 +666,11 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev,
err_out_unregister:
unregister_netdev(dev);
err_out_unmap_rx:
- pci_free_consistent(pdev, RX_TOTAL_SIZE, np->rx_ring, np->rx_ring_dma);
+ dma_free_coherent(&pdev->dev, RX_TOTAL_SIZE,
+ np->rx_ring, np->rx_ring_dma);
err_out_unmap_tx:
- pci_free_consistent(pdev, TX_TOTAL_SIZE, np->tx_ring, np->tx_ring_dma);
+ dma_free_coherent(&pdev->dev, TX_TOTAL_SIZE,
+ np->tx_ring, np->tx_ring_dma);
err_out_cleardev:
pci_set_drvdata(pdev, NULL);
pci_iounmap(pdev, ioaddr);
@@ -1011,8 +1016,8 @@ static void init_ring(struct net_device *dev)
skb->dev = dev; /* Mark as being used by this device. */
skb_reserve(skb, 2); /* 16 byte align the IP header. */
np->rx_ring[i].frag[0].addr = cpu_to_le32(
- pci_map_single(np->pci_dev, skb->data, np->rx_buf_sz,
- PCI_DMA_FROMDEVICE));
+ dma_map_single(&np->pci_dev->dev, skb->data,
+ np->rx_buf_sz, DMA_FROM_DEVICE));
np->rx_ring[i].frag[0].length = cpu_to_le32(np->rx_buf_sz | LastFrag);
}
np->dirty_rx = (unsigned int)(i - RX_RING_SIZE);
@@ -1063,9 +1068,8 @@ start_tx (struct sk_buff *skb, struct net_device *dev)
txdesc->next_desc = 0;
txdesc->status = cpu_to_le32 ((entry << 2) | DisableAlign);
- txdesc->frag[0].addr = cpu_to_le32 (pci_map_single (np->pci_dev, skb->data,
- skb->len,
- PCI_DMA_TODEVICE));
+ txdesc->frag[0].addr = cpu_to_le32(dma_map_single(&np->pci_dev->dev,
+ skb->data, skb->len, DMA_TO_DEVICE));
txdesc->frag[0].length = cpu_to_le32 (skb->len | LastFrag);
/* Increment cur_tx before tasklet_schedule() */
@@ -1109,9 +1113,9 @@ reset_tx (struct net_device *dev)
skb = np->tx_skbuff[i];
if (skb) {
- pci_unmap_single(np->pci_dev,
+ dma_unmap_single(&np->pci_dev->dev,
le32_to_cpu(np->tx_ring[i].frag[0].addr),
- skb->len, PCI_DMA_TODEVICE);
+ skb->len, DMA_TO_DEVICE);
if (irq)
dev_kfree_skb_irq (skb);
else
@@ -1233,9 +1237,9 @@ static irqreturn_t intr_handler(int irq, void *dev_instance)
break;
skb = np->tx_skbuff[entry];
/* Free the original skb. */
- pci_unmap_single(np->pci_dev,
+ dma_unmap_single(&np->pci_dev->dev,
le32_to_cpu(np->tx_ring[entry].frag[0].addr),
- skb->len, PCI_DMA_TODEVICE);
+ skb->len, DMA_TO_DEVICE);
dev_kfree_skb_irq (np->tx_skbuff[entry]);
np->tx_skbuff[entry] = NULL;
np->tx_ring[entry].frag[0].addr = 0;
@@ -1252,9 +1256,9 @@ static irqreturn_t intr_handler(int irq, void *dev_instance)
break;
skb = np->tx_skbuff[entry];
/* Free the original skb. */
- pci_unmap_single(np->pci_dev,
+ dma_unmap_single(&np->pci_dev->dev,
le32_to_cpu(np->tx_ring[entry].frag[0].addr),
- skb->len, PCI_DMA_TODEVICE);
+ skb->len, DMA_TO_DEVICE);
dev_kfree_skb_irq (np->tx_skbuff[entry]);
np->tx_skbuff[entry] = NULL;
np->tx_ring[entry].frag[0].addr = 0;
@@ -1334,22 +1338,18 @@ static void rx_poll(unsigned long data)
if (pkt_len < rx_copybreak &&
(skb = dev_alloc_skb(pkt_len + 2)) != NULL) {
skb_reserve(skb, 2); /* 16 byte align the IP header */
- pci_dma_sync_single_for_cpu(np->pci_dev,
- le32_to_cpu(desc->frag[0].addr),
- np->rx_buf_sz,
- PCI_DMA_FROMDEVICE);
-
+ dma_sync_single_for_cpu(&np->pci_dev->dev,
+ le32_to_cpu(desc->frag[0].addr),
+ np->rx_buf_sz, DMA_FROM_DEVICE);
skb_copy_to_linear_data(skb, np->rx_skbuff[entry]->data, pkt_len);
- pci_dma_sync_single_for_device(np->pci_dev,
- le32_to_cpu(desc->frag[0].addr),
- np->rx_buf_sz,
- PCI_DMA_FROMDEVICE);
+ dma_sync_single_for_device(&np->pci_dev->dev,
+ le32_to_cpu(desc->frag[0].addr),
+ np->rx_buf_sz, DMA_FROM_DEVICE);
skb_put(skb, pkt_len);
} else {
- pci_unmap_single(np->pci_dev,
+ dma_unmap_single(&np->pci_dev->dev,
le32_to_cpu(desc->frag[0].addr),
- np->rx_buf_sz,
- PCI_DMA_FROMDEVICE);
+ np->rx_buf_sz, DMA_FROM_DEVICE);
skb_put(skb = np->rx_skbuff[entry], pkt_len);
np->rx_skbuff[entry] = NULL;
}
@@ -1396,8 +1396,8 @@ static void refill_rx (struct net_device *dev)
skb->dev = dev; /* Mark as being used by this device. */
skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */
np->rx_ring[entry].frag[0].addr = cpu_to_le32(
- pci_map_single(np->pci_dev, skb->data,
- np->rx_buf_sz, PCI_DMA_FROMDEVICE));
+ dma_map_single(&np->pci_dev->dev, skb->data,
+ np->rx_buf_sz, DMA_FROM_DEVICE));
}
/* Perhaps we need not reset this field. */
np->rx_ring[entry].frag[0].length =
@@ -1715,9 +1715,9 @@ static int netdev_close(struct net_device *dev)
np->rx_ring[i].status = 0;
skb = np->rx_skbuff[i];
if (skb) {
- pci_unmap_single(np->pci_dev,
+ dma_unmap_single(&np->pci_dev->dev,
le32_to_cpu(np->rx_ring[i].frag[0].addr),
- np->rx_buf_sz, PCI_DMA_FROMDEVICE);
+ np->rx_buf_sz, DMA_FROM_DEVICE);
dev_kfree_skb(skb);
np->rx_skbuff[i] = NULL;
}
@@ -1727,9 +1727,9 @@ static int netdev_close(struct net_device *dev)
np->tx_ring[i].next_desc = 0;
skb = np->tx_skbuff[i];
if (skb) {
- pci_unmap_single(np->pci_dev,
+ dma_unmap_single(&np->pci_dev->dev,
le32_to_cpu(np->tx_ring[i].frag[0].addr),
- skb->len, PCI_DMA_TODEVICE);
+ skb->len, DMA_TO_DEVICE);
dev_kfree_skb(skb);
np->tx_skbuff[i] = NULL;
}
@@ -1743,17 +1743,16 @@ static void __devexit sundance_remove1 (struct pci_dev *pdev)
struct net_device *dev = pci_get_drvdata(pdev);
if (dev) {
- struct netdev_private *np = netdev_priv(dev);
-
- unregister_netdev(dev);
- pci_free_consistent(pdev, RX_TOTAL_SIZE, np->rx_ring,
- np->rx_ring_dma);
- pci_free_consistent(pdev, TX_TOTAL_SIZE, np->tx_ring,
- np->tx_ring_dma);
- pci_iounmap(pdev, np->base);
- pci_release_regions(pdev);
- free_netdev(dev);
- pci_set_drvdata(pdev, NULL);
+ struct netdev_private *np = netdev_priv(dev);
+ unregister_netdev(dev);
+ dma_free_coherent(&pdev->dev, RX_TOTAL_SIZE,
+ np->rx_ring, np->rx_ring_dma);
+ dma_free_coherent(&pdev->dev, TX_TOTAL_SIZE,
+ np->tx_ring, np->tx_ring_dma);
+ pci_iounmap(pdev, np->base);
+ pci_release_regions(pdev);
+ free_netdev(dev);
+ pci_set_drvdata(pdev, NULL);
}
}
--
1.7.2.2
^ permalink raw reply related
* RE: [PATCH] qlcnic: dont assume NET_IP_ALIGN is 2
From: Amit Salecha @ 2010-09-21 8:41 UTC (permalink / raw)
To: Eric Dumazet
Cc: David Miller, netdev@vger.kernel.org, Ameen Rahman,
Anirban Chakraborty
In-Reply-To: <1285058073.2617.73.camel@edumazet-laptop>
> -----Original Message-----
> From: netdev-owner@vger.kernel.org [mailto:netdev-
> owner@vger.kernel.org] On Behalf Of Eric Dumazet
> Sent: Tuesday, September 21, 2010 2:05 PM
> To: Amit Salecha
> Cc: David Miller; netdev@vger.kernel.org; Ameen Rahman; Anirban
> Chakraborty
> Subject: RE: [PATCH] qlcnic: dont assume NET_IP_ALIGN is 2
>
> Le mardi 21 septembre 2010 à 03:19 -0500, Amit Salecha a écrit :
> >
> > > -----Original Message-----
> > > From: David Miller [mailto:davem@davemloft.net]
> > > Sent: Monday, September 20, 2010 9:29 PM
> > > To: Amit Salecha
> > > Cc: eric.dumazet@gmail.com; netdev@vger.kernel.org; Ameen Rahman;
> > > Anirban Chakraborty
> > > Subject: Re: [PATCH] qlcnic: dont assume NET_IP_ALIGN is 2
> > >
> > > From: Amit Salecha <amit.salecha@qlogic.com>
> > > Date: Mon, 20 Sep 2010 06:16:31 -0500
> > >
> > > > Though I have one doubt. We are allocating larger packets than
> the
> > > actual data used.
> > > > Doesn't it will break accounting ?
> > >
> > > No, it will "fix" accounting.
> > >
> > > You must charge to the SKB all of the non-shared memory that was
> > > allocated to the SKB.
> > >
> > > This means even if the packet only uses 128 bytes of the SKB
> > > data area, you must still account for the full blob of linear
> > > memory that was allocated for the SKB data area in skb->truesize.
> > >
> > > Otherwise remote attackers could consume enormous amounts of memory
> by
> > > tricking our socket accounting via carefully sized packets.
> >
> > Wont this affect throughput ?
> > As problem discuss in this thread http://www.mail-
> archive.com/netdev@vger.kernel.org/msg06848.html, it can affect tcp
> window scaling.
> >
>
> Amit, if you believe this is a problem, you should address it for all
> NICS, not only qlcnic.
>
> Qlcnic was lying to stack, because it consumed 2Kbytes blocs and
> pretended they were consuming skb->len bytes.
> (assuming MTU=1500, problem is worse if MTU is bigger)
>
> So in order to improve "throughput", you were allowing for memory
> exhaust and freeze of the _machine_ ?
>
This won't lead to such problem. truesize is used for accounting only.
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* RE: [PATCH] qlcnic: dont assume NET_IP_ALIGN is 2
From: Eric Dumazet @ 2010-09-21 8:34 UTC (permalink / raw)
To: Amit Salecha
Cc: David Miller, netdev@vger.kernel.org, Ameen Rahman,
Anirban Chakraborty
In-Reply-To: <99737F4847ED0A48AECC9F4A1974A4B80F86F80270@MNEXMB2.qlogic.org>
Le mardi 21 septembre 2010 à 03:19 -0500, Amit Salecha a écrit :
>
> > -----Original Message-----
> > From: David Miller [mailto:davem@davemloft.net]
> > Sent: Monday, September 20, 2010 9:29 PM
> > To: Amit Salecha
> > Cc: eric.dumazet@gmail.com; netdev@vger.kernel.org; Ameen Rahman;
> > Anirban Chakraborty
> > Subject: Re: [PATCH] qlcnic: dont assume NET_IP_ALIGN is 2
> >
> > From: Amit Salecha <amit.salecha@qlogic.com>
> > Date: Mon, 20 Sep 2010 06:16:31 -0500
> >
> > > Though I have one doubt. We are allocating larger packets than the
> > actual data used.
> > > Doesn't it will break accounting ?
> >
> > No, it will "fix" accounting.
> >
> > You must charge to the SKB all of the non-shared memory that was
> > allocated to the SKB.
> >
> > This means even if the packet only uses 128 bytes of the SKB
> > data area, you must still account for the full blob of linear
> > memory that was allocated for the SKB data area in skb->truesize.
> >
> > Otherwise remote attackers could consume enormous amounts of memory by
> > tricking our socket accounting via carefully sized packets.
>
> Wont this affect throughput ?
> As problem discuss in this thread http://www.mail-archive.com/netdev@vger.kernel.org/msg06848.html, it can affect tcp window scaling.
>
Amit, if you believe this is a problem, you should address it for all
NICS, not only qlcnic.
Qlcnic was lying to stack, because it consumed 2Kbytes blocs and
pretended they were consuming skb->len bytes.
(assuming MTU=1500, problem is worse if MTU is bigger)
So in order to improve "throughput", you were allowing for memory
exhaust and freeze of the _machine_ ?
^ permalink raw reply
* RE: [PATCH] qlcnic: dont assume NET_IP_ALIGN is 2
From: Amit Salecha @ 2010-09-21 8:19 UTC (permalink / raw)
To: David Miller
Cc: eric.dumazet@gmail.com, netdev@vger.kernel.org, Ameen Rahman,
Anirban Chakraborty
In-Reply-To: <20100920.085857.98907191.davem@davemloft.net>
> -----Original Message-----
> From: David Miller [mailto:davem@davemloft.net]
> Sent: Monday, September 20, 2010 9:29 PM
> To: Amit Salecha
> Cc: eric.dumazet@gmail.com; netdev@vger.kernel.org; Ameen Rahman;
> Anirban Chakraborty
> Subject: Re: [PATCH] qlcnic: dont assume NET_IP_ALIGN is 2
>
> From: Amit Salecha <amit.salecha@qlogic.com>
> Date: Mon, 20 Sep 2010 06:16:31 -0500
>
> > Though I have one doubt. We are allocating larger packets than the
> actual data used.
> > Doesn't it will break accounting ?
>
> No, it will "fix" accounting.
>
> You must charge to the SKB all of the non-shared memory that was
> allocated to the SKB.
>
> This means even if the packet only uses 128 bytes of the SKB
> data area, you must still account for the full blob of linear
> memory that was allocated for the SKB data area in skb->truesize.
>
> Otherwise remote attackers could consume enormous amounts of memory by
> tricking our socket accounting via carefully sized packets.
Wont this affect throughput ?
As problem discuss in this thread http://www.mail-archive.com/netdev@vger.kernel.org/msg06848.html, it can affect tcp window scaling.
-Amit
^ permalink raw reply
* Re: [2.6.35-rc5] INET?: possible irq lock inversion dependency
From: Eric Dumazet @ 2010-09-21 7:56 UTC (permalink / raw)
To: Tetsuo Handa; +Cc: linux-fsdevel, netdev
In-Reply-To: <201009210651.o8L6pbkP038129@www262.sakura.ne.jp>
Le mardi 21 septembre 2010 à 15:51 +0900, Tetsuo Handa a écrit :
> I succeeded to save undamaged messages by doing
>
> echo 1 > /proc/sys/kernel/printk_delay
>
> . (Well, it would be nice to do above before printing lockdep warning because
> it prints a lot of lines enough to drop some lines.)
>
> Although my patch is still applied, I believe my patch is not the culprit.
> This warning might be related to lock_sock_fast() which was introduced in
> 2.6.35 because I'm seeing this warning since 2.6.35-rcX . What can I do next?
>
> Regards.
>
> [ 199.267633] nfsd: last server has exited, flushing export cache
> [ 200.784089]
> [ 200.784094] =========================================================
> [ 200.786186] [ INFO: possible irq lock inversion dependency detected ]
> [ 200.786186] 2.6.36-rc5-old #2
> [ 200.786186] ---------------------------------------------------------
> [ 200.786186] kworker/0:1/10 just changed the state of lock:
> [ 200.786186] (clock-AF_INET){++.?..}, at: [<c135e9be>] xs_tcp_state_change+0x1e/0x1d0
> [ 200.786186] but this lock was taken by another, SOFTIRQ-safe lock in the past:
> [ 200.786186] (slock-AF_INET){+.-...}
> [ 200.786186]
> [ 200.786186] and interrupts could create inverse lock ordering between them.
> [ 200.786186]
> [ 200.786186]
> [ 200.786186] other info that might help us debug this:
> [ 200.786186] 3 locks held by kworker/0:1/10:
> [ 200.786186] #0: (rpciod){+.+.+.}, at: [<c10516f6>] process_one_work+0xd6/0x3a0
> [ 200.786186] #1: ((&xprt->task_cleanup)){+.+...}, at: [<c10516f6>] process_one_work+0xd6/0x3a0
> [ 200.786186] #2: (sk_lock-AF_INET-RPC){+.+...}, at: [<c1333119>] inet_shutdown+0x49/0x110
> [ 200.786186]
> [ 200.786186] the shortest dependencies between 2nd lock and 1st lock:
> [ 200.786186] -> (slock-AF_INET){+.-...} ops: 11832 {
> [ 200.786186] HARDIRQ-ON-W at:
> [ 200.786186] [<c106ab8e>] mark_irqflags+0xfe/0x180
> [ 200.786186] [<c106b90d>] __lock_acquire+0x38d/0x8e0
> [ 200.786186] [<c106ceaa>] lock_acquire+0x7a/0xa0
> [ 200.786186] [<c138ca3e>] _raw_spin_lock_bh+0x3e/0x80
> [ 200.786186] [<c12dba59>] lock_sock_fast+0x29/0x90
> [ 200.786186] [<c132bdb4>] udp_destroy_sock+0x14/0x40
> [ 200.786186] [<c12dbdb3>] sk_common_release+0xb3/0xc0
> [ 200.786186] [<c132c728>] udp_lib_close+0x8/0x10
> [ 200.786186] [<c133268e>] inet_release+0xbe/0x100
> [ 200.786186] [<c12d5f66>] sock_release+0x66/0x80
> [ 200.786186] [<c12d6ce2>] sock_close+0x12/0x30
> [ 200.786186] [<c10c66fb>] __fput+0x1cb/0x240
> [ 200.786186] [<c10c6789>] fput+0x19/0x20
> [ 200.786186] [<c10c45c3>] filp_close+0x43/0x70
> [ 200.786186] [<c103fded>] close_files+0xad/0x150
> [ 200.786186] [<c103fef9>] put_files_struct+0x29/0xf0
> [ 200.786186] [<c1040050>] exit_files+0x40/0x50
> [ 200.786186] [<c1040716>] do_exit+0x116/0x2e0
> [ 200.786186] [<c1040944>] do_group_exit+0x34/0xb0
> [ 200.786186] [<c10409cf>] sys_exit_group+0xf/0x20
> [ 200.786186] [<c138d4e1>] syscall_call+0x7/0xb
> [ 200.786186] IN-SOFTIRQ-W at:
> [ 200.786186] [<c106abae>] mark_irqflags+0x11e/0x180
> [ 200.786186] [<c106b90d>] __lock_acquire+0x38d/0x8e0
> [ 200.786186] [<c106ceaa>] lock_acquire+0x7a/0xa0
> [ 200.786186] [<c138c8c9>] _raw_spin_lock+0x39/0x70
> [ 200.786186] [<c12da3f1>] sk_clone+0xb1/0x2c0
> [ 200.786186] [<c13108ea>] inet_csk_clone+0x1a/0xb0
> [ 200.786186] [<c1325ecc>] tcp_create_openreq_child+0x1c/0x460
> [ 200.786186] [<c132359f>] tcp_v4_syn_recv_sock+0x3f/0x1e0
> [ 200.786186] [<c132649c>] tcp_check_req+0x18c/0x3b0
> [ 200.786186] [<c132378d>] tcp_v4_hnd_req+0x4d/0x160
> [ 200.786186] [<c1323ab9>] tcp_v4_do_rcv+0x159/0x280
> [ 200.786186] [<c1324154>] tcp_v4_rcv+0x574/0xa30
> [ 200.786186] [<c1305f63>] ip_local_deliver_finish+0x103/0x320
> [ 200.786186] [<c13061b0>] ip_local_deliver+0x30/0x40
> [ 200.786186] [<c1306329>] ip_rcv_finish+0x169/0x480
> [ 200.786186] [<c13067da>] ip_rcv+0x19a/0x2b0
> [ 200.786186] [<c12e743d>] __netif_receive_skb+0x21d/0x310
> [ 200.786186] [<c12e7f48>] process_backlog+0x88/0x160
> [ 200.786186] [<c12e8317>] net_rx_action+0x127/0x140
> [ 200.786186] [<c1042e90>] __do_softirq+0xd0/0x130
> [ 200.786186] INITIAL USE at:
> [ 200.786186] [<c106b740>] __lock_acquire+0x1c0/0x8e0
> [ 200.786186] [<c106ceaa>] lock_acquire+0x7a/0xa0
> [ 200.786186] [<c138ca3e>] _raw_spin_lock_bh+0x3e/0x80
> [ 200.786186] [<c12dba59>] lock_sock_fast+0x29/0x90
> [ 200.786186] [<c132bdb4>] udp_destroy_sock+0x14/0x40
> [ 200.786186] [<c12dbdb3>] sk_common_release+0xb3/0xc0
> [ 200.786186] [<c132c728>] udp_lib_close+0x8/0x10
> [ 200.786186] [<c133268e>] inet_release+0xbe/0x100
> [ 200.786186] [<c12d5f66>] sock_release+0x66/0x80
> [ 200.786186] [<c12d6ce2>] sock_close+0x12/0x30
> [ 200.786186] [<c10c66fb>] __fput+0x1cb/0x240
> [ 200.786186] [<c10c6789>] fput+0x19/0x20
> [ 200.786186] [<c10c45c3>] filp_close+0x43/0x70
> [ 200.786186] [<c103fded>] close_files+0xad/0x150
> [ 200.786186] [<c103fef9>] put_files_struct+0x29/0xf0
> [ 200.786186] [<c1040050>] exit_files+0x40/0x50
> [ 200.786186] [<c1040716>] do_exit+0x116/0x2e0
> [ 200.786186] [<c1040944>] do_group_exit+0x34/0xb0
> [ 200.786186] [<c10409cf>] sys_exit_group+0xf/0x20
> [ 200.786186] [<c138d4e1>] syscall_call+0x7/0xb
> [ 200.786186] }
> [ 200.786186] ... key at: [<c1d4d9f0>] af_family_slock_keys+0x10/0x140
> [ 200.786186] ... acquired at:
> [ 200.786186] [<c10693bb>] check_prevs_add+0xab/0x100
> [ 200.786186] [<c1069745>] validate_chain+0x305/0x5a0
> [ 200.786186] [<c106b82d>] __lock_acquire+0x2ad/0x8e0
> [ 200.786186] [<c106ceaa>] lock_acquire+0x7a/0xa0
> [ 200.786186] [<c138d07e>] _raw_write_lock_bh+0x3e/0x80
> [ 200.786186] [<c1310c16>] inet_csk_listen_stop+0x86/0x160
> [ 200.786186] [<c1313772>] tcp_close+0x382/0x390
> [ 200.786186] [<c133268e>] inet_release+0xbe/0x100
> [ 200.786186] [<c12d5f66>] sock_release+0x66/0x80
> [ 200.786186] [<c12d6ce2>] sock_close+0x12/0x30
> [ 200.786186] [<c10c66fb>] __fput+0x1cb/0x240
> [ 200.786186] [<c10c6789>] fput+0x19/0x20
> [ 200.786186] [<c10c45c3>] filp_close+0x43/0x70
> [ 200.786186] [<c10c465d>] sys_close+0x6d/0x110
> [ 200.786186] [<c138d4e1>] syscall_call+0x7/0xb
> [ 200.786186]
> [ 200.786186] -> (clock-AF_INET){++.?..} ops: 2429 {
> [ 200.786186] HARDIRQ-ON-W at:
> [ 200.786186] [<c106ab8e>] mark_irqflags+0xfe/0x180
> [ 200.786186] [<c106b90d>] __lock_acquire+0x38d/0x8e0
> [ 200.786186] [<c106ceaa>] lock_acquire+0x7a/0xa0
> [ 200.786186] [<c138d07e>] _raw_write_lock_bh+0x3e/0x80
> [ 200.786186] [<c12dbd2f>] sk_common_release+0x2f/0xc0
> [ 200.786186] [<c132c728>] udp_lib_close+0x8/0x10
> [ 200.786186] [<c133268e>] inet_release+0xbe/0x100
> [ 200.786186] [<c12d5f66>] sock_release+0x66/0x80
> [ 200.786186] [<c12d6ce2>] sock_close+0x12/0x30
> [ 200.786186] [<c10c66fb>] __fput+0x1cb/0x240
> [ 200.786186] [<c10c6789>] fput+0x19/0x20
> [ 200.786186] [<c10c45c3>] filp_close+0x43/0x70
> [ 200.786186] [<c103fded>] close_files+0xad/0x150
> [ 200.786186] [<c103fef9>] put_files_struct+0x29/0xf0
> [ 200.786186] [<c1040050>] exit_files+0x40/0x50
> [ 200.786186] [<c1040716>] do_exit+0x116/0x2e0
> [ 200.786186] [<c1040944>] do_group_exit+0x34/0xb0
> [ 200.786186] [<c10409cf>] sys_exit_group+0xf/0x20
> [ 200.786186] [<c138d4e1>] syscall_call+0x7/0xb
> [ 200.786186] HARDIRQ-ON-R at:
> [ 200.786186] [<c106aafe>] mark_irqflags+0x6e/0x180
> [ 200.786186] [<c106b90d>] __lock_acquire+0x38d/0x8e0
> [ 200.786186] [<c106ceaa>] lock_acquire+0x7a/0xa0
> [ 200.786186] [<c138cbe9>] _raw_read_lock+0x39/0x70
> [ 200.786186] [<c135e9be>] xs_tcp_state_change+0x1e/0x1d0
> [ 200.786186] [<c131c8a8>] tcp_rcv_synsent_state_process+0x398/0x590
> [ 200.786186] [<c131cf47>] tcp_rcv_state_process+0x4a7/0x560
> [ 200.786186] [<c13239d1>] tcp_v4_do_rcv+0x71/0x280
> [ 200.786186] [<c12dad26>] __release_sock+0x66/0x150
> [ 200.786186] [<c12dba27>] release_sock+0x87/0x90
> [ 200.786186] [<c1332a7a>] inet_stream_connect+0x5a/0x1b0
> [ 200.786186] [<c12d8888>] kernel_connect+0x18/0x30
> [ 200.786186] [<c135f66e>] xs_tcp_finish_connecting+0x4e/0x120
> [ 200.786186] [<c135f79b>] xs_tcp_setup_socket+0x5b/0x180
> [ 200.786186] [<c135f9d4>] xs_tcp_connect_worker4+0x14/0x20
> [ 200.786186] [<c1051767>] process_one_work+0x147/0x3a0
> [ 200.786186] [<c1051aa6>] worker_thread+0xa6/0x200
> [ 200.786186] [<c1056985>] kthread+0x75/0x80
> [ 200.786186] [<c10031fa>] kernel_thread_helper+0x6/0x1c
> [ 200.786186] IN-SOFTIRQ-R at:
> [ 200.786186] [<c106abae>] mark_irqflags+0x11e/0x180
> [ 200.786186] [<c106b90d>] __lock_acquire+0x38d/0x8e0
> [ 200.786186] [<c106ceaa>] lock_acquire+0x7a/0xa0
> [ 200.786186] [<c138cbe9>] _raw_read_lock+0x39/0x70
> [ 200.786186] [<c135e891>] xs_tcp_data_ready+0x21/0x90
> [ 200.786186] [<c131ad68>] tcp_data_queue+0x248/0x820
> [ 200.786186] [<c131c0de>] tcp_rcv_established+0xae/0x4e0
> [ 200.786186] [<c1323b31>] tcp_v4_do_rcv+0x1d1/0x280
> [ 200.786186] [<c1324154>] tcp_v4_rcv+0x574/0xa30
> [ 200.786186] [<c1305f63>] ip_local_deliver_finish+0x103/0x320
> [ 200.786186] [<c13061b0>] ip_local_deliver+0x30/0x40
> [ 200.786186] [<c1306329>] ip_rcv_finish+0x169/0x480
> [ 200.786186] [<c13067da>] ip_rcv+0x19a/0x2b0
> [ 200.786186] [<c12e743d>] __netif_receive_skb+0x21d/0x310
> [ 200.786186] [<c12e7f48>] process_backlog+0x88/0x160
> [ 200.786186] [<c12e8317>] net_rx_action+0x127/0x140
> [ 200.786186] [<c1042e90>] __do_softirq+0xd0/0x130
> [ 200.786186] SOFTIRQ-ON-R at:
> [ 200.786186] [<c106ab72>] mark_irqflags+0xe2/0x180
> [ 200.786186] [<c106b90d>] __lock_acquire+0x38d/0x8e0
> [ 200.786186] [<c106ceaa>] lock_acquire+0x7a/0xa0
> [ 200.786186] [<c138cbe9>] _raw_read_lock+0x39/0x70
> [ 200.786186] [<c135e9be>] xs_tcp_state_change+0x1e/0x1d0
> [ 200.786186] [<c1333167>] inet_shutdown+0x97/0x110
> [ 200.786186] [<c12d8a89>] kernel_sock_shutdown+0x9/0x10
> [ 200.786186] [<c135dcb7>] xs_tcp_shutdown+0x17/0x20
> [ 200.786186] [<c135dfb7>] xs_tcp_close+0x27/0x30
> [ 200.786186] [<c135c20d>] xprt_autoclose+0x1d/0x50
> [ 200.786186] [<c1051767>] process_one_work+0x147/0x3a0
> [ 200.786186] [<c1051aa6>] worker_thread+0xa6/0x200
> [ 200.786186] [<c1056985>] kthread+0x75/0x80
> [ 200.786186] [<c10031fa>] kernel_thread_helper+0x6/0x1c
> [ 200.786186] INITIAL USE at:
> [ 200.786186] [<c106b740>] __lock_acquire+0x1c0/0x8e0
> [ 200.786186] [<c106ceaa>] lock_acquire+0x7a/0xa0
> [ 200.786186] [<c138d07e>] _raw_write_lock_bh+0x3e/0x80
> [ 200.786186] [<c12dbd2f>] sk_common_release+0x2f/0xc0
> [ 200.786186] [<c132c728>] udp_lib_close+0x8/0x10
> [ 200.786186] [<c133268e>] inet_release+0xbe/0x100
> [ 200.786186] [<c12d5f66>] sock_release+0x66/0x80
> [ 200.786186] [<c12d6ce2>] sock_close+0x12/0x30
> [ 200.786186] [<c10c66fb>] __fput+0x1cb/0x240
> [ 200.786186] [<c10c6789>] fput+0x19/0x20
> [ 200.786186] [<c10c45c3>] filp_close+0x43/0x70
> [ 200.786186] [<c103fded>] close_files+0xad/0x150
> [ 200.786186] [<c103fef9>] put_files_struct+0x29/0xf0
> [ 200.786186] [<c1040050>] exit_files+0x40/0x50
> [ 200.786186] [<c1040716>] do_exit+0x116/0x2e0
> [ 200.786186] [<c1040944>] do_group_exit+0x34/0xb0
> [ 200.786186] [<c10409cf>] sys_exit_group+0xf/0x20
> [ 200.786186] [<c138d4e1>] syscall_call+0x7/0xb
> [ 200.786186] }
> [ 200.786186] ... key at: [<c1d4db30>] af_callback_keys+0x10/0x130
> [ 200.786186] ... acquired at:
> [ 200.786186] [<c1069ff6>] check_usage_backwards+0x76/0xd0
> [ 200.786186] [<c106a209>] mark_lock_irq+0x99/0x240
> [ 200.786186] [<c106aeac>] mark_lock+0x21c/0x3c0
> [ 200.786186] [<c106ab72>] mark_irqflags+0xe2/0x180
> [ 200.786186] [<c106b90d>] __lock_acquire+0x38d/0x8e0
> [ 200.786186] [<c106ceaa>] lock_acquire+0x7a/0xa0
> [ 200.786186] [<c138cbe9>] _raw_read_lock+0x39/0x70
> [ 200.786186] [<c135e9be>] xs_tcp_state_change+0x1e/0x1d0
> [ 200.786186] [<c1333167>] inet_shutdown+0x97/0x110
> [ 200.786186] [<c12d8a89>] kernel_sock_shutdown+0x9/0x10
> [ 200.786186] [<c135dcb7>] xs_tcp_shutdown+0x17/0x20
> [ 200.786186] [<c135dfb7>] xs_tcp_close+0x27/0x30
> [ 200.786186] [<c135c20d>] xprt_autoclose+0x1d/0x50
> [ 200.786186] [<c1051767>] process_one_work+0x147/0x3a0
> [ 200.786186] [<c1051aa6>] worker_thread+0xa6/0x200
> [ 200.786186] [<c1056985>] kthread+0x75/0x80
> [ 200.786186] [<c10031fa>] kernel_thread_helper+0x6/0x1c
> [ 200.786186]
> [ 200.786186]
> [ 200.786186] stack backtrace:
> [ 200.786186] Pid: 10, comm: kworker/0:1 Not tainted 2.6.36-rc5-old #2
> [ 200.786186] Call Trace:
> [ 200.786186] [<c103ded8>] ? printk+0x18/0x20
> [ 200.786186] [<c1069e88>] print_irq_inversion_bug+0x108/0x120
> [ 200.786186] [<c1069ff6>] check_usage_backwards+0x76/0xd0
> [ 200.786186] [<c106a209>] mark_lock_irq+0x99/0x240
> [ 200.786186] [<c1069f80>] ? check_usage_backwards+0x0/0xd0
> [ 200.786186] [<c106aeac>] mark_lock+0x21c/0x3c0
> [ 200.786186] [<c106ab72>] mark_irqflags+0xe2/0x180
> [ 200.786186] [<c106b90d>] __lock_acquire+0x38d/0x8e0
> [ 200.786186] [<c106cc0a>] ? __lock_is_held+0x3a/0x60
> [ 200.786186] [<c106ceaa>] lock_acquire+0x7a/0xa0
> [ 200.786186] [<c135e9be>] ? xs_tcp_state_change+0x1e/0x1d0
> [ 200.786186] [<c138cbe9>] _raw_read_lock+0x39/0x70
> [ 200.786186] [<c135e9be>] ? xs_tcp_state_change+0x1e/0x1d0
> [ 200.786186] [<c135e9be>] xs_tcp_state_change+0x1e/0x1d0
> [ 200.786186] [<c131fddf>] ? tcp_send_fin+0x4f/0xc0
> [ 200.786186] [<c1333167>] inet_shutdown+0x97/0x110
> [ 200.786186] [<c12d8a89>] kernel_sock_shutdown+0x9/0x10
> [ 200.786186] [<c135dcb7>] xs_tcp_shutdown+0x17/0x20
> [ 200.786186] [<c135dfb7>] xs_tcp_close+0x27/0x30
> [ 200.786186] [<c135c20d>] xprt_autoclose+0x1d/0x50
> [ 200.786186] [<c1051767>] process_one_work+0x147/0x3a0
> [ 200.786186] [<c10516f6>] ? process_one_work+0xd6/0x3a0
> [ 200.786186] [<c106d429>] ? __lock_acquired+0x119/0x1c0
> [ 200.786186] [<c135c1f0>] ? xprt_autoclose+0x0/0x50
> [ 200.786186] [<c1051a1c>] ? worker_thread+0x1c/0x200
> [ 200.786186] [<c1050537>] ? __need_more_worker+0x17/0x40
> [ 200.786186] [<c1051aa6>] worker_thread+0xa6/0x200
> [ 200.786186] [<c1056985>] kthread+0x75/0x80
> [ 200.786186] [<c1051a00>] ? worker_thread+0x0/0x200
> [ 200.786186] [<c1056910>] ? kthread+0x0/0x80
> [ 200.786186] [<c10031fa>] kernel_thread_helper+0x6/0x1c
> [ 208.718821] Restarting system.
> [ 208.720581] machine restart
I would say someone calls xs_tcp_state_change() while softirqs are not
masked.
If its expected, then following patch is needed ?
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index b6309db..fc94e5e 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1301,7 +1301,7 @@ static void xs_tcp_state_change(struct sock *sk)
{
struct rpc_xprt *xprt;
- read_lock(&sk->sk_callback_lock);
+ read_lock_bh(&sk->sk_callback_lock);
if (!(xprt = xprt_from_sock(sk)))
goto out;
dprintk("RPC: xs_tcp_state_change client %p...\n", xprt);
@@ -1313,7 +1313,7 @@ static void xs_tcp_state_change(struct sock *sk)
switch (sk->sk_state) {
case TCP_ESTABLISHED:
- spin_lock_bh(&xprt->transport_lock);
+ spin_lock(&xprt->transport_lock);
if (!xprt_test_and_set_connected(xprt)) {
struct sock_xprt *transport = container_of(xprt,
struct sock_xprt, xprt);
@@ -1327,7 +1327,7 @@ static void xs_tcp_state_change(struct sock *sk)
xprt_wake_pending_tasks(xprt, -EAGAIN);
}
- spin_unlock_bh(&xprt->transport_lock);
+ spin_unlock(&xprt->transport_lock);
break;
case TCP_FIN_WAIT1:
/* The client initiated a shutdown of the socket */
@@ -1365,7 +1365,7 @@ static void xs_tcp_state_change(struct sock *sk)
xs_sock_mark_closed(xprt);
}
out:
- read_unlock(&sk->sk_callback_lock);
+ read_unlock_bh(&sk->sk_callback_lock);
}
/**
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [PATCH] tmspci: fix tr%d in printk
From: Meelis Roos @ 2010-09-21 7:19 UTC (permalink / raw)
To: netdev
tmspci driver uses dev->name before register_netdev() and so prints tr%d
in initialization messages. Fix it by using dev_info.
Found and tested on real hardware.
Signed-off-by: Meelis Roos <mroos@linux.ee>
diff --git a/drivers/net/tokenring/tmspci.c b/drivers/net/tokenring/tmspci.c
index d4c7c0c..d3e788a 100644
--- a/drivers/net/tokenring/tmspci.c
+++ b/drivers/net/tokenring/tmspci.c
@@ -125,18 +125,16 @@ static int __devinit tms_pci_attach(struct pci_dev *pdev, const struct pci_devic
dev->irq = pci_irq_line;
dev->dma = 0;
- printk("%s: %s\n", dev->name, cardinfo->name);
- printk("%s: IO: %#4lx IRQ: %d\n",
- dev->name, dev->base_addr, dev->irq);
+ dev_info(&pdev->dev, "%s\n", cardinfo->name);
+ dev_info(&pdev->dev, " IO: %#4lx IRQ: %d\n", dev->base_addr, dev->irq);
tms_pci_read_eeprom(dev);
- printk("%s: Ring Station Address: %pM\n",
- dev->name, dev->dev_addr);
+ dev_info(&pdev->dev, " Ring Station Address: %pM\n", dev->dev_addr);
ret = tmsdev_init(dev, &pdev->dev);
if (ret) {
- printk("%s: unable to get memory for dev->priv.\n", dev->name);
+ dev_info(&pdev->dev, "unable to get memory for dev->priv.\n");
goto err_out_region;
}
--
Meelis Roos (mroos@linux.ee)
^ permalink raw reply related
* Dual ethernet attachment with single FEC
From: LEROY Christophe @ 2010-09-21 7:30 UTC (permalink / raw)
To: LinuxPPC-dev, netdev
Hello,
I have a board with 2 PHYs attached to one FEC ethernet controler on
powerpc.
I want to implement some kind of main-standby attachment to LAN by
setting the ISOLATE bit on one on the two PHYs then monitoring the link
status and switch to the other PHY when the link status goes down.
I see this behaviour is implemented in the sis900 driver, but it doesn't
use the standard PHY layer as the Freescale FEC driver does.
What would be the most proper way to implement this functionality ?
* Modify FEC driver to manage that ?
* Implement a virtual PHY driver that would manage that ?
* Other solution ?
Best regards
C. Leroy
^ permalink raw reply
* Re: REGRESSION: e1000e fails to communicate in 2.6.36-rcx (82566DM)
From: Priit Laes @ 2010-09-21 7:26 UTC (permalink / raw)
To: Tantilov, Emil S
Cc: e1000-devel@lists.sourceforge.net, netdev@vger.kernel.org
In-Reply-To: <EA929A9653AAE14F841771FB1DE5A1366008789CE3@rrsmsx501.amr.corp.intel.com>
Ühel kenal päeval, R, 2010-09-10 kell 11:21, kirjutas Tantilov, Emil S:
> >> > After trying out newer 2.6.35-rc3 kernel, the network interface fails
> >> > to
> >
> >Uhoh.. it was a typo ^^, real kernel version is 2.6.36-rc3+ :S
> >
> >> Is this still an issue in the latest net-next pull?
> >Yes, it is still not working (latest net-next pull was on 4th of Aug)
> >
> >> Also please provide the output of ethtool -e.
> >
> >Attached output from 2.6.36-rc3
>
> I think this is a known issue for this device - we have a patch currently
> in test, and we should have it out soon.
Any news on the patch?
2.6.36-rc5 is already out and I really do not want to see it getting
into major release :(
Cheers,
Priit :)
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
^ permalink raw reply
* [RFC] skge: limit DMA to 32 bit
From: Stanislaw Gruszka @ 2010-09-21 7:15 UTC (permalink / raw)
To: Stephen Hemminger, netdev
We have old fedora bug report about not working skge device on some
Gigabyte motherboard:
https://bugzilla.redhat.com/show_bug.cgi?id=447489
In dmesg there are messages:
skge 0000:02:0b.0: PCI error cmd=0x7 status=0x22b0
skge 0000:02:0b.0: unable to clear error (so ignoring them)
Status value 0x22b0 include PCI_STATUS_REC_MASTER_ABORT bit set, what
mean that DMA transfer on PCI bus was aborted.
I provided to user modified driver with module parameter, that allow
to experiment with different dma_mask's. He told that maximum working
dma_mask for him is 32 bits set.
Is 32bit DMA limit for every skge device acceptable patch?
Note, patch change possible driver DMA address space as below:
- 32bit - no change, still low mem only (896MB)
- 32bit-PAE - down from 36bit to low mem (896MB)
- 64bit - down from 64bit to 32bit
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index a8a6358..1a674e3 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -3797,8 +3797,7 @@ static const struct net_device_ops skge_netdev_ops = {
/* Initialize network device */
-static struct net_device *skge_devinit(struct skge_hw *hw, int port,
- int highmem)
+static struct net_device *skge_devinit(struct skge_hw *hw, int port)
{
struct skge_port *skge;
struct net_device *dev = alloc_etherdev(sizeof(*skge));
@@ -3814,9 +3813,6 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port,
dev->watchdog_timeo = TX_WATCHDOG;
dev->irq = hw->pdev->irq;
- if (highmem)
- dev->features |= NETIF_F_HIGHDMA;
-
skge = netdev_priv(dev);
netif_napi_add(dev, &skge->napi, skge_poll, NAPI_WEIGHT);
skge->netdev = dev;
@@ -3874,7 +3870,7 @@ static int __devinit skge_probe(struct pci_dev *pdev,
{
struct net_device *dev, *dev1;
struct skge_hw *hw;
- int err, using_dac = 0;
+ int err;
err = pci_enable_device(pdev);
if (err) {
@@ -3890,13 +3886,9 @@ static int __devinit skge_probe(struct pci_dev *pdev,
pci_set_master(pdev);
- if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {
- using_dac = 1;
- err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
- } else if (!(err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))) {
- using_dac = 0;
+ err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
+ if (!err)
err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
- }
if (err) {
dev_err(&pdev->dev, "no usable DMA configuration\n");
@@ -3944,7 +3936,7 @@ static int __devinit skge_probe(struct pci_dev *pdev,
(unsigned long long)pci_resource_start(pdev, 0), pdev->irq,
skge_board_name(hw), hw->chip_rev);
- dev = skge_devinit(hw, 0, using_dac);
+ dev = skge_devinit(hw, 0);
if (!dev)
goto err_out_led_off;
@@ -3967,7 +3959,7 @@ static int __devinit skge_probe(struct pci_dev *pdev,
skge_show_addr(dev);
if (hw->ports > 1) {
- dev1 = skge_devinit(hw, 1, using_dac);
+ dev1 = skge_devinit(hw, 1);
if (dev1 && register_netdev(dev1) == 0)
skge_show_addr(dev1);
else {
^ permalink raw reply related
* [2.6.35-rc5] INET?: possible irq lock inversion dependency
From: Tetsuo Handa @ 2010-09-21 6:51 UTC (permalink / raw)
To: eric.dumazet; +Cc: linux-fsdevel, netdev
In-Reply-To: <201009072132.FHA93457.MHOJFQOOFLVStF@I-love.SAKURA.ne.jp>
I succeeded to save undamaged messages by doing
echo 1 > /proc/sys/kernel/printk_delay
. (Well, it would be nice to do above before printing lockdep warning because
it prints a lot of lines enough to drop some lines.)
Although my patch is still applied, I believe my patch is not the culprit.
This warning might be related to lock_sock_fast() which was introduced in
2.6.35 because I'm seeing this warning since 2.6.35-rcX . What can I do next?
Regards.
[ 199.267633] nfsd: last server has exited, flushing export cache
[ 200.784089]
[ 200.784094] =========================================================
[ 200.786186] [ INFO: possible irq lock inversion dependency detected ]
[ 200.786186] 2.6.36-rc5-old #2
[ 200.786186] ---------------------------------------------------------
[ 200.786186] kworker/0:1/10 just changed the state of lock:
[ 200.786186] (clock-AF_INET){++.?..}, at: [<c135e9be>] xs_tcp_state_change+0x1e/0x1d0
[ 200.786186] but this lock was taken by another, SOFTIRQ-safe lock in the past:
[ 200.786186] (slock-AF_INET){+.-...}
[ 200.786186]
[ 200.786186] and interrupts could create inverse lock ordering between them.
[ 200.786186]
[ 200.786186]
[ 200.786186] other info that might help us debug this:
[ 200.786186] 3 locks held by kworker/0:1/10:
[ 200.786186] #0: (rpciod){+.+.+.}, at: [<c10516f6>] process_one_work+0xd6/0x3a0
[ 200.786186] #1: ((&xprt->task_cleanup)){+.+...}, at: [<c10516f6>] process_one_work+0xd6/0x3a0
[ 200.786186] #2: (sk_lock-AF_INET-RPC){+.+...}, at: [<c1333119>] inet_shutdown+0x49/0x110
[ 200.786186]
[ 200.786186] the shortest dependencies between 2nd lock and 1st lock:
[ 200.786186] -> (slock-AF_INET){+.-...} ops: 11832 {
[ 200.786186] HARDIRQ-ON-W at:
[ 200.786186] [<c106ab8e>] mark_irqflags+0xfe/0x180
[ 200.786186] [<c106b90d>] __lock_acquire+0x38d/0x8e0
[ 200.786186] [<c106ceaa>] lock_acquire+0x7a/0xa0
[ 200.786186] [<c138ca3e>] _raw_spin_lock_bh+0x3e/0x80
[ 200.786186] [<c12dba59>] lock_sock_fast+0x29/0x90
[ 200.786186] [<c132bdb4>] udp_destroy_sock+0x14/0x40
[ 200.786186] [<c12dbdb3>] sk_common_release+0xb3/0xc0
[ 200.786186] [<c132c728>] udp_lib_close+0x8/0x10
[ 200.786186] [<c133268e>] inet_release+0xbe/0x100
[ 200.786186] [<c12d5f66>] sock_release+0x66/0x80
[ 200.786186] [<c12d6ce2>] sock_close+0x12/0x30
[ 200.786186] [<c10c66fb>] __fput+0x1cb/0x240
[ 200.786186] [<c10c6789>] fput+0x19/0x20
[ 200.786186] [<c10c45c3>] filp_close+0x43/0x70
[ 200.786186] [<c103fded>] close_files+0xad/0x150
[ 200.786186] [<c103fef9>] put_files_struct+0x29/0xf0
[ 200.786186] [<c1040050>] exit_files+0x40/0x50
[ 200.786186] [<c1040716>] do_exit+0x116/0x2e0
[ 200.786186] [<c1040944>] do_group_exit+0x34/0xb0
[ 200.786186] [<c10409cf>] sys_exit_group+0xf/0x20
[ 200.786186] [<c138d4e1>] syscall_call+0x7/0xb
[ 200.786186] IN-SOFTIRQ-W at:
[ 200.786186] [<c106abae>] mark_irqflags+0x11e/0x180
[ 200.786186] [<c106b90d>] __lock_acquire+0x38d/0x8e0
[ 200.786186] [<c106ceaa>] lock_acquire+0x7a/0xa0
[ 200.786186] [<c138c8c9>] _raw_spin_lock+0x39/0x70
[ 200.786186] [<c12da3f1>] sk_clone+0xb1/0x2c0
[ 200.786186] [<c13108ea>] inet_csk_clone+0x1a/0xb0
[ 200.786186] [<c1325ecc>] tcp_create_openreq_child+0x1c/0x460
[ 200.786186] [<c132359f>] tcp_v4_syn_recv_sock+0x3f/0x1e0
[ 200.786186] [<c132649c>] tcp_check_req+0x18c/0x3b0
[ 200.786186] [<c132378d>] tcp_v4_hnd_req+0x4d/0x160
[ 200.786186] [<c1323ab9>] tcp_v4_do_rcv+0x159/0x280
[ 200.786186] [<c1324154>] tcp_v4_rcv+0x574/0xa30
[ 200.786186] [<c1305f63>] ip_local_deliver_finish+0x103/0x320
[ 200.786186] [<c13061b0>] ip_local_deliver+0x30/0x40
[ 200.786186] [<c1306329>] ip_rcv_finish+0x169/0x480
[ 200.786186] [<c13067da>] ip_rcv+0x19a/0x2b0
[ 200.786186] [<c12e743d>] __netif_receive_skb+0x21d/0x310
[ 200.786186] [<c12e7f48>] process_backlog+0x88/0x160
[ 200.786186] [<c12e8317>] net_rx_action+0x127/0x140
[ 200.786186] [<c1042e90>] __do_softirq+0xd0/0x130
[ 200.786186] INITIAL USE at:
[ 200.786186] [<c106b740>] __lock_acquire+0x1c0/0x8e0
[ 200.786186] [<c106ceaa>] lock_acquire+0x7a/0xa0
[ 200.786186] [<c138ca3e>] _raw_spin_lock_bh+0x3e/0x80
[ 200.786186] [<c12dba59>] lock_sock_fast+0x29/0x90
[ 200.786186] [<c132bdb4>] udp_destroy_sock+0x14/0x40
[ 200.786186] [<c12dbdb3>] sk_common_release+0xb3/0xc0
[ 200.786186] [<c132c728>] udp_lib_close+0x8/0x10
[ 200.786186] [<c133268e>] inet_release+0xbe/0x100
[ 200.786186] [<c12d5f66>] sock_release+0x66/0x80
[ 200.786186] [<c12d6ce2>] sock_close+0x12/0x30
[ 200.786186] [<c10c66fb>] __fput+0x1cb/0x240
[ 200.786186] [<c10c6789>] fput+0x19/0x20
[ 200.786186] [<c10c45c3>] filp_close+0x43/0x70
[ 200.786186] [<c103fded>] close_files+0xad/0x150
[ 200.786186] [<c103fef9>] put_files_struct+0x29/0xf0
[ 200.786186] [<c1040050>] exit_files+0x40/0x50
[ 200.786186] [<c1040716>] do_exit+0x116/0x2e0
[ 200.786186] [<c1040944>] do_group_exit+0x34/0xb0
[ 200.786186] [<c10409cf>] sys_exit_group+0xf/0x20
[ 200.786186] [<c138d4e1>] syscall_call+0x7/0xb
[ 200.786186] }
[ 200.786186] ... key at: [<c1d4d9f0>] af_family_slock_keys+0x10/0x140
[ 200.786186] ... acquired at:
[ 200.786186] [<c10693bb>] check_prevs_add+0xab/0x100
[ 200.786186] [<c1069745>] validate_chain+0x305/0x5a0
[ 200.786186] [<c106b82d>] __lock_acquire+0x2ad/0x8e0
[ 200.786186] [<c106ceaa>] lock_acquire+0x7a/0xa0
[ 200.786186] [<c138d07e>] _raw_write_lock_bh+0x3e/0x80
[ 200.786186] [<c1310c16>] inet_csk_listen_stop+0x86/0x160
[ 200.786186] [<c1313772>] tcp_close+0x382/0x390
[ 200.786186] [<c133268e>] inet_release+0xbe/0x100
[ 200.786186] [<c12d5f66>] sock_release+0x66/0x80
[ 200.786186] [<c12d6ce2>] sock_close+0x12/0x30
[ 200.786186] [<c10c66fb>] __fput+0x1cb/0x240
[ 200.786186] [<c10c6789>] fput+0x19/0x20
[ 200.786186] [<c10c45c3>] filp_close+0x43/0x70
[ 200.786186] [<c10c465d>] sys_close+0x6d/0x110
[ 200.786186] [<c138d4e1>] syscall_call+0x7/0xb
[ 200.786186]
[ 200.786186] -> (clock-AF_INET){++.?..} ops: 2429 {
[ 200.786186] HARDIRQ-ON-W at:
[ 200.786186] [<c106ab8e>] mark_irqflags+0xfe/0x180
[ 200.786186] [<c106b90d>] __lock_acquire+0x38d/0x8e0
[ 200.786186] [<c106ceaa>] lock_acquire+0x7a/0xa0
[ 200.786186] [<c138d07e>] _raw_write_lock_bh+0x3e/0x80
[ 200.786186] [<c12dbd2f>] sk_common_release+0x2f/0xc0
[ 200.786186] [<c132c728>] udp_lib_close+0x8/0x10
[ 200.786186] [<c133268e>] inet_release+0xbe/0x100
[ 200.786186] [<c12d5f66>] sock_release+0x66/0x80
[ 200.786186] [<c12d6ce2>] sock_close+0x12/0x30
[ 200.786186] [<c10c66fb>] __fput+0x1cb/0x240
[ 200.786186] [<c10c6789>] fput+0x19/0x20
[ 200.786186] [<c10c45c3>] filp_close+0x43/0x70
[ 200.786186] [<c103fded>] close_files+0xad/0x150
[ 200.786186] [<c103fef9>] put_files_struct+0x29/0xf0
[ 200.786186] [<c1040050>] exit_files+0x40/0x50
[ 200.786186] [<c1040716>] do_exit+0x116/0x2e0
[ 200.786186] [<c1040944>] do_group_exit+0x34/0xb0
[ 200.786186] [<c10409cf>] sys_exit_group+0xf/0x20
[ 200.786186] [<c138d4e1>] syscall_call+0x7/0xb
[ 200.786186] HARDIRQ-ON-R at:
[ 200.786186] [<c106aafe>] mark_irqflags+0x6e/0x180
[ 200.786186] [<c106b90d>] __lock_acquire+0x38d/0x8e0
[ 200.786186] [<c106ceaa>] lock_acquire+0x7a/0xa0
[ 200.786186] [<c138cbe9>] _raw_read_lock+0x39/0x70
[ 200.786186] [<c135e9be>] xs_tcp_state_change+0x1e/0x1d0
[ 200.786186] [<c131c8a8>] tcp_rcv_synsent_state_process+0x398/0x590
[ 200.786186] [<c131cf47>] tcp_rcv_state_process+0x4a7/0x560
[ 200.786186] [<c13239d1>] tcp_v4_do_rcv+0x71/0x280
[ 200.786186] [<c12dad26>] __release_sock+0x66/0x150
[ 200.786186] [<c12dba27>] release_sock+0x87/0x90
[ 200.786186] [<c1332a7a>] inet_stream_connect+0x5a/0x1b0
[ 200.786186] [<c12d8888>] kernel_connect+0x18/0x30
[ 200.786186] [<c135f66e>] xs_tcp_finish_connecting+0x4e/0x120
[ 200.786186] [<c135f79b>] xs_tcp_setup_socket+0x5b/0x180
[ 200.786186] [<c135f9d4>] xs_tcp_connect_worker4+0x14/0x20
[ 200.786186] [<c1051767>] process_one_work+0x147/0x3a0
[ 200.786186] [<c1051aa6>] worker_thread+0xa6/0x200
[ 200.786186] [<c1056985>] kthread+0x75/0x80
[ 200.786186] [<c10031fa>] kernel_thread_helper+0x6/0x1c
[ 200.786186] IN-SOFTIRQ-R at:
[ 200.786186] [<c106abae>] mark_irqflags+0x11e/0x180
[ 200.786186] [<c106b90d>] __lock_acquire+0x38d/0x8e0
[ 200.786186] [<c106ceaa>] lock_acquire+0x7a/0xa0
[ 200.786186] [<c138cbe9>] _raw_read_lock+0x39/0x70
[ 200.786186] [<c135e891>] xs_tcp_data_ready+0x21/0x90
[ 200.786186] [<c131ad68>] tcp_data_queue+0x248/0x820
[ 200.786186] [<c131c0de>] tcp_rcv_established+0xae/0x4e0
[ 200.786186] [<c1323b31>] tcp_v4_do_rcv+0x1d1/0x280
[ 200.786186] [<c1324154>] tcp_v4_rcv+0x574/0xa30
[ 200.786186] [<c1305f63>] ip_local_deliver_finish+0x103/0x320
[ 200.786186] [<c13061b0>] ip_local_deliver+0x30/0x40
[ 200.786186] [<c1306329>] ip_rcv_finish+0x169/0x480
[ 200.786186] [<c13067da>] ip_rcv+0x19a/0x2b0
[ 200.786186] [<c12e743d>] __netif_receive_skb+0x21d/0x310
[ 200.786186] [<c12e7f48>] process_backlog+0x88/0x160
[ 200.786186] [<c12e8317>] net_rx_action+0x127/0x140
[ 200.786186] [<c1042e90>] __do_softirq+0xd0/0x130
[ 200.786186] SOFTIRQ-ON-R at:
[ 200.786186] [<c106ab72>] mark_irqflags+0xe2/0x180
[ 200.786186] [<c106b90d>] __lock_acquire+0x38d/0x8e0
[ 200.786186] [<c106ceaa>] lock_acquire+0x7a/0xa0
[ 200.786186] [<c138cbe9>] _raw_read_lock+0x39/0x70
[ 200.786186] [<c135e9be>] xs_tcp_state_change+0x1e/0x1d0
[ 200.786186] [<c1333167>] inet_shutdown+0x97/0x110
[ 200.786186] [<c12d8a89>] kernel_sock_shutdown+0x9/0x10
[ 200.786186] [<c135dcb7>] xs_tcp_shutdown+0x17/0x20
[ 200.786186] [<c135dfb7>] xs_tcp_close+0x27/0x30
[ 200.786186] [<c135c20d>] xprt_autoclose+0x1d/0x50
[ 200.786186] [<c1051767>] process_one_work+0x147/0x3a0
[ 200.786186] [<c1051aa6>] worker_thread+0xa6/0x200
[ 200.786186] [<c1056985>] kthread+0x75/0x80
[ 200.786186] [<c10031fa>] kernel_thread_helper+0x6/0x1c
[ 200.786186] INITIAL USE at:
[ 200.786186] [<c106b740>] __lock_acquire+0x1c0/0x8e0
[ 200.786186] [<c106ceaa>] lock_acquire+0x7a/0xa0
[ 200.786186] [<c138d07e>] _raw_write_lock_bh+0x3e/0x80
[ 200.786186] [<c12dbd2f>] sk_common_release+0x2f/0xc0
[ 200.786186] [<c132c728>] udp_lib_close+0x8/0x10
[ 200.786186] [<c133268e>] inet_release+0xbe/0x100
[ 200.786186] [<c12d5f66>] sock_release+0x66/0x80
[ 200.786186] [<c12d6ce2>] sock_close+0x12/0x30
[ 200.786186] [<c10c66fb>] __fput+0x1cb/0x240
[ 200.786186] [<c10c6789>] fput+0x19/0x20
[ 200.786186] [<c10c45c3>] filp_close+0x43/0x70
[ 200.786186] [<c103fded>] close_files+0xad/0x150
[ 200.786186] [<c103fef9>] put_files_struct+0x29/0xf0
[ 200.786186] [<c1040050>] exit_files+0x40/0x50
[ 200.786186] [<c1040716>] do_exit+0x116/0x2e0
[ 200.786186] [<c1040944>] do_group_exit+0x34/0xb0
[ 200.786186] [<c10409cf>] sys_exit_group+0xf/0x20
[ 200.786186] [<c138d4e1>] syscall_call+0x7/0xb
[ 200.786186] }
[ 200.786186] ... key at: [<c1d4db30>] af_callback_keys+0x10/0x130
[ 200.786186] ... acquired at:
[ 200.786186] [<c1069ff6>] check_usage_backwards+0x76/0xd0
[ 200.786186] [<c106a209>] mark_lock_irq+0x99/0x240
[ 200.786186] [<c106aeac>] mark_lock+0x21c/0x3c0
[ 200.786186] [<c106ab72>] mark_irqflags+0xe2/0x180
[ 200.786186] [<c106b90d>] __lock_acquire+0x38d/0x8e0
[ 200.786186] [<c106ceaa>] lock_acquire+0x7a/0xa0
[ 200.786186] [<c138cbe9>] _raw_read_lock+0x39/0x70
[ 200.786186] [<c135e9be>] xs_tcp_state_change+0x1e/0x1d0
[ 200.786186] [<c1333167>] inet_shutdown+0x97/0x110
[ 200.786186] [<c12d8a89>] kernel_sock_shutdown+0x9/0x10
[ 200.786186] [<c135dcb7>] xs_tcp_shutdown+0x17/0x20
[ 200.786186] [<c135dfb7>] xs_tcp_close+0x27/0x30
[ 200.786186] [<c135c20d>] xprt_autoclose+0x1d/0x50
[ 200.786186] [<c1051767>] process_one_work+0x147/0x3a0
[ 200.786186] [<c1051aa6>] worker_thread+0xa6/0x200
[ 200.786186] [<c1056985>] kthread+0x75/0x80
[ 200.786186] [<c10031fa>] kernel_thread_helper+0x6/0x1c
[ 200.786186]
[ 200.786186]
[ 200.786186] stack backtrace:
[ 200.786186] Pid: 10, comm: kworker/0:1 Not tainted 2.6.36-rc5-old #2
[ 200.786186] Call Trace:
[ 200.786186] [<c103ded8>] ? printk+0x18/0x20
[ 200.786186] [<c1069e88>] print_irq_inversion_bug+0x108/0x120
[ 200.786186] [<c1069ff6>] check_usage_backwards+0x76/0xd0
[ 200.786186] [<c106a209>] mark_lock_irq+0x99/0x240
[ 200.786186] [<c1069f80>] ? check_usage_backwards+0x0/0xd0
[ 200.786186] [<c106aeac>] mark_lock+0x21c/0x3c0
[ 200.786186] [<c106ab72>] mark_irqflags+0xe2/0x180
[ 200.786186] [<c106b90d>] __lock_acquire+0x38d/0x8e0
[ 200.786186] [<c106cc0a>] ? __lock_is_held+0x3a/0x60
[ 200.786186] [<c106ceaa>] lock_acquire+0x7a/0xa0
[ 200.786186] [<c135e9be>] ? xs_tcp_state_change+0x1e/0x1d0
[ 200.786186] [<c138cbe9>] _raw_read_lock+0x39/0x70
[ 200.786186] [<c135e9be>] ? xs_tcp_state_change+0x1e/0x1d0
[ 200.786186] [<c135e9be>] xs_tcp_state_change+0x1e/0x1d0
[ 200.786186] [<c131fddf>] ? tcp_send_fin+0x4f/0xc0
[ 200.786186] [<c1333167>] inet_shutdown+0x97/0x110
[ 200.786186] [<c12d8a89>] kernel_sock_shutdown+0x9/0x10
[ 200.786186] [<c135dcb7>] xs_tcp_shutdown+0x17/0x20
[ 200.786186] [<c135dfb7>] xs_tcp_close+0x27/0x30
[ 200.786186] [<c135c20d>] xprt_autoclose+0x1d/0x50
[ 200.786186] [<c1051767>] process_one_work+0x147/0x3a0
[ 200.786186] [<c10516f6>] ? process_one_work+0xd6/0x3a0
[ 200.786186] [<c106d429>] ? __lock_acquired+0x119/0x1c0
[ 200.786186] [<c135c1f0>] ? xprt_autoclose+0x0/0x50
[ 200.786186] [<c1051a1c>] ? worker_thread+0x1c/0x200
[ 200.786186] [<c1050537>] ? __need_more_worker+0x17/0x40
[ 200.786186] [<c1051aa6>] worker_thread+0xa6/0x200
[ 200.786186] [<c1056985>] kthread+0x75/0x80
[ 200.786186] [<c1051a00>] ? worker_thread+0x0/0x200
[ 200.786186] [<c1056910>] ? kthread+0x0/0x80
[ 200.786186] [<c10031fa>] kernel_thread_helper+0x6/0x1c
[ 208.718821] Restarting system.
[ 208.720581] machine restart
^ permalink raw reply
* Re: [PATCH] iputils ping,ping6: use monotonic clock to schedule pings
From: Thomas Habets @ 2010-09-21 6:50 UTC (permalink / raw)
To: YOSHIFUJI Hideaki; +Cc: Thomas Habets, Jan Ceuleers, netdev
In-Reply-To: <4C98454C.6000602@linux-ipv6.org>
On Tue, 21 Sep 2010, YOSHIFUJI Hideaki wrote:
> Why don't we convert most (if not all) gettimeofday(), then?
I wanted to initially just solve the easy part in case it wouldn't be
accepted.
The latency measuring parts are more complicated because they're not
always gettimeofday() but SO_TIMESTAMP or SIOCGSTAMP with just a fallback
to gettimeofday(). I can dig deeper next week.
---------
typedef struct me_s {
char name[] = { "Thomas Habets" };
char email[] = { "thomas@habets.pp.se" };
char kernel[] = { "Linux" };
char *pgpKey[] = { "http://www.habets.pp.se/pubkey.txt" };
char pgp[] = { "A8A3 D1DD 4AE0 8467 7FDE 0945 286A E90A AD48 E854" };
char coolcmd[] = { "echo '. ./_&. ./_'>_;. ./_" };
} me_t;
^ permalink raw reply
* [PATCHv1.5 3/3] net: core: use kernel's converter from hex to bin
From: Andy Shevchenko @ 2010-09-21 6:40 UTC (permalink / raw)
To: linux-kernel; +Cc: David S. Miller, netdev, Andy Shevchenko
In-Reply-To: <2d00b66224535ae82be1a1e638b86b81fb890f58.1285051188.git.andy.shevchenko@gmail.com>
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
net/core/pktgen.c | 10 ++++------
net/core/utils.c | 13 +++++++------
2 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 386c228..2c0df0f 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -729,16 +729,14 @@ static int hex32_arg(const char __user *user_buffer, unsigned long maxlen,
*num = 0;
for (; i < maxlen; i++) {
+ int value;
char c;
*num <<= 4;
if (get_user(c, &user_buffer[i]))
return -EFAULT;
- if ((c >= '0') && (c <= '9'))
- *num |= c - '0';
- else if ((c >= 'a') && (c <= 'f'))
- *num |= c - 'a' + 10;
- else if ((c >= 'A') && (c <= 'F'))
- *num |= c - 'A' + 10;
+ value = hex_to_bin(c);
+ if (value >= 0)
+ *num |= value;
else
break;
}
diff --git a/net/core/utils.c b/net/core/utils.c
index f418544..ec6bb32 100644
--- a/net/core/utils.c
+++ b/net/core/utils.c
@@ -92,18 +92,19 @@ EXPORT_SYMBOL(in_aton);
static inline int xdigit2bin(char c, int delim)
{
+ int val;
+
if (c == delim || c == '\0')
return IN6PTON_DELIM;
if (c == ':')
return IN6PTON_COLON_MASK;
if (c == '.')
return IN6PTON_DOT;
- if (c >= '0' && c <= '9')
- return (IN6PTON_XDIGIT | IN6PTON_DIGIT| (c - '0'));
- if (c >= 'a' && c <= 'f')
- return (IN6PTON_XDIGIT | (c - 'a' + 10));
- if (c >= 'A' && c <= 'F')
- return (IN6PTON_XDIGIT | (c - 'A' + 10));
+
+ val = hex_to_bin(c);
+ if (val >= 0)
+ return val | IN6PTON_XDIGIT | (val < 10 ? IN6PTON_DIGIT : 0);
+
if (delim == -1)
return IN6PTON_DELIM;
return IN6PTON_UNKNOWN;
--
1.7.2.2
^ permalink raw reply related
* [PATCHv1.5 2/3] sunrpc/cache: don't use custom hex_to_bin() converter
From: Andy Shevchenko @ 2010-09-21 6:40 UTC (permalink / raw)
To: linux-kernel
Cc: David S. Miller, netdev, Andy Shevchenko, Trond Myklebust,
linux-nfs
In-Reply-To: <2d00b66224535ae82be1a1e638b86b81fb890f58.1285051188.git.andy.shevchenko@gmail.com>
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: linux-nfs@vger.kernel.org
---
net/sunrpc/cache.c | 20 +++++++++++++-------
1 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index 5b7b56f..c944a24 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -1171,13 +1171,19 @@ int qword_get(char **bpp, char *dest, int bufsize)
if (bp[0] == '\\' && bp[1] == 'x') {
/* HEX STRING */
bp += 2;
- while (isxdigit(bp[0]) && isxdigit(bp[1]) && len < bufsize) {
- int byte = isdigit(*bp) ? *bp-'0' : toupper(*bp)-'A'+10;
- bp++;
- byte <<= 4;
- byte |= isdigit(*bp) ? *bp-'0' : toupper(*bp)-'A'+10;
- *dest++ = byte;
- bp++;
+ while (len < bufsize) {
+ int h, l;
+
+ h = hex_to_bin(bp[0]);
+ if (h < 0)
+ break;
+
+ l = hex_to_bin(bp[1]);
+ if (l < 0)
+ break;
+
+ *dest++ = (h << 4) | l;
+ bp += 2;
len++;
}
} else {
--
1.7.2.2
^ permalink raw reply related
* [PATCHv1.5 1/3] drivers: atm: use native kernel's hex_to_bin() func
From: Andy Shevchenko @ 2010-09-21 6:40 UTC (permalink / raw)
To: linux-kernel
Cc: David S. Miller, netdev, Andy Shevchenko, Chas Williams,
linux-atm-general
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Chas Williams <chas@cmf.nrl.navy.mil>
Cc: linux-atm-general@lists.sourceforge.net
---
drivers/atm/horizon.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/atm/horizon.c b/drivers/atm/horizon.c
index 54720ba..a957904 100644
--- a/drivers/atm/horizon.c
+++ b/drivers/atm/horizon.c
@@ -1645,10 +1645,8 @@ static int hrz_send (struct atm_vcc * atm_vcc, struct sk_buff * skb) {
unsigned short d = 0;
char * s = skb->data;
if (*s++ == 'D') {
- for (i = 0; i < 4; ++i) {
- d = (d<<4) | ((*s <= '9') ? (*s - '0') : (*s - 'a' + 10));
- ++s;
- }
+ for (i = 0; i < 4; ++i)
+ d = (d << 4) | hex_to_bin(*s++);
PRINTK (KERN_INFO, "debug bitmap is now %hx", debug = d);
}
}
--
1.7.2.2
^ permalink raw reply related
* [PATCH] ip : take care of last fragment in ip_append_data
From: Eric Dumazet @ 2010-09-21 6:16 UTC (permalink / raw)
To: Nick Bowler; +Cc: linux-kernel, netdev, David S. Miller
In-Reply-To: <1285018272.2323.243.camel@edumazet-laptop>
Le lundi 20 septembre 2010 à 23:31 +0200, Eric Dumazet a écrit :
> OK, I found a bug in ip_fragment() and ip6_fragment()
>
> In case slow_path is hit, we have a truesize mismatch
>
> Could you try following patch ?
>
> Thanks !
>
> [PATCH] ip : fix truesize mismatch in ip fragmentation
>
> We should not set frag->destructor to sock_wkfree() until we are sure we
> dont hit slow path in ip_fragment(). Or we risk uncharging
> frag->truesize twice, and in the end, having negative socket
> sk_wmem_alloc counter, or even freeing socket sooner than expected.
>
> Many thanks to Nick Bowler, who provided a very clean bug report and
> test programs.
>
> While Nick bisection pointed to commit 2b85a34e911bf483 (net: No more
> expensive sock_hold()/sock_put() on each tx), underlying bug is older.
>
> Reported-and-bisected-by: Nick Bowler <nbowler@elliptictech.com>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> ---
> net/ipv4/ip_output.c | 8 ++++----
> net/ipv6/ip6_output.c | 10 +++++-----
> 2 files changed, 9 insertions(+), 9 deletions(-)
This previous patch works for me. I also cooked following fix, to not
enter slow path on some lengthes (MTU + N*(MTU-20))
[PATCH] ip : take care of last fragment in ip_append_data
While investigating a bit, I found ip_fragment() slow path was taken
because ip_append_data() provides following layout for a send(MTU +
N*(MTU - 20)) syscall :
- one skb with 1500 (mtu) bytes
- N fragments of 1480 (mtu-20) bytes (before adding IP header)
last fragment gets 17 bytes of trail data because of following bit:
if (datalen == length + fraggap)
alloclen += rt->dst.trailer_len;
Then esp4 adds 16 bytes of data (while trailer_len is 17... hmm...
another bug ?)
In ip_fragment(), we notice last fragment is too big (1496 + 20) > mtu,
so we take slow path, building another skb chain.
In order to avoid taking slow path, we should correct ip_append_data()
to make sure last fragment has real trail space, under mtu...
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
net/ipv4/ip_output.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 04b6989..dfd9a0d 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -927,16 +927,19 @@ alloc_new_skb:
!(rt->dst.dev->features&NETIF_F_SG))
alloclen = mtu;
else
- alloclen = datalen + fragheaderlen;
+ alloclen = fraglen;
/* The last fragment gets additional space at tail.
* Note, with MSG_MORE we overallocate on fragments,
* because we have no idea what fragment will be
* the last.
*/
- if (datalen == length + fraggap)
+ if (datalen == length + fraggap) {
alloclen += rt->dst.trailer_len;
-
+ /* make sure mtu is not reached */
+ if (datalen > mtu - fragheaderlen - rt->dst.trailer_len)
+ datalen -= ALIGN(rt->dst.trailer_len, 8);
+ }
if (transhdrlen) {
skb = sock_alloc_send_skb(sk,
alloclen + hh_len + 15,
^ permalink raw reply related
* Re: [PATCH] iputils ping,ping6: use sig_atomic_t for flags set by signal handlers
From: YOSHIFUJI Hideaki @ 2010-09-21 6:05 UTC (permalink / raw)
To: Thomas Habets; +Cc: netdev, YOSHIFUJI Hideaki
In-Reply-To: <alpine.DEB.1.10.1009051432540.13886@red.crap.retrofitta.se>
Hi,
(2010/09/05 21:52), Thomas Habets wrote:
>
> Required by ISO C99 7.14.1.1 paragraph 5.
Applied, thanks.
--yoshfuji
^ permalink raw reply
* Re: [PATCH] iputils ping,ping6: use monotonic clock to schedule pings
From: YOSHIFUJI Hideaki @ 2010-09-21 5:40 UTC (permalink / raw)
To: Thomas Habets; +Cc: Jan Ceuleers, netdev, YOSHIFUJI Hideaki
In-Reply-To: <alpine.DEB.1.10.1009051521120.13886@red.crap.retrofitta.se>
Hello
(2010/09/05 22:25), Thomas Habets wrote:
> This fixes the problem where when time is set backwards 'ping' appears
> to freeze until the walltime catches up with the previously set time.
>
> Adds dependency on librt.
Why don't we convert most (if not all) gettimeofday(), then?
--yoshfuji
^ permalink raw reply
* Re: Possible regression with skb_clone() in 2.6.36
From: Gustavo F. Padovan @ 2010-09-21 4:10 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-bluetooth-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
marcel-kz+m5ild9QBg9hUCZPvPmw
In-Reply-To: <20100917153440.474b93e4.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
* Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org> [2010-09-17 15:34:40 -0700]:
> On Mon, 30 Aug 2010 20:10:23 -0300
> "Gustavo F. Padovan" <padovan-Y3ZbgMPKUGA34EUeqzHoZw@public.gmane.org> wrote:
>
> > I've been experiencing some problems when running the L2CAP Streaming mode in
> > 2.6.36. The system quickly runs in an Out Of Memory condition and crash. That
> > wasn't happening before, so I think we may have a regression here (I didn't find
> > where yet). The crash log is below.
>
> So 2.6.35 was OK?
>
> > The following patch does not fix the regression, but shows that removing the
> > skb_clone() call from l2cap_streaming_send() makes the problem goes away. The
> > patch is good anyway since it saves memory and time when sending Streaming mode
> > packets.
>
> How does "make it go away" differ from "fix the regression" :)
>
> But yes, if we don't understand the source of the bug then it may well
> still be there. Did you make any progress in understanding the cause?
I did some progress and found that this really fix the bug. We are fine
here then. :)
--
Gustavo F. Padovan
ProFUSION embedded systems - http://profusion.mobi
^ permalink raw reply
* Re: 2.6.36-rc4-git5: Reported regressions from 2.6.35
From: Alex Deucher @ 2010-09-21 4:05 UTC (permalink / raw)
To: sedat.dilek
Cc: Rafael J. Wysocki, Linux SCSI List, Linux ACPI,
Network Development, Linux Wireless List,
Linux Kernel Mailing List, DRI, Florian Mickler, harn-solo,
Andrew Morton, Kernel Testers List, Linus Torvalds, Linux PM List,
Maciej Rutecki
In-Reply-To: <AANLkTinLR0Js0ueVOGEkbs27d4FEH14c=1wuhUqPsiHx@mail.gmail.com>
On Mon, Sep 20, 2010 at 3:19 PM, Sedat Dilek <sedat.dilek@googlemail.com> wrote:
> Hi Rafael,
>
> can you please add the following, Thanks in advance.
>> Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=18872
>> Subject : Radeon KMS r100 and STR problems
>> Submitter : Richard Mittendorfer <delist@gmx.net>
>> Date : 2010-09-17 18:26 (4 days old)
>> Message-ID : <20100917202647.aa4b6300.delist@gmx.net>
>> References : http://marc.info/?l=linux-kernel&m=128474802809779&w=2
>
> On Mon, Sep 20, 2010 at 8:47 PM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
>> This message contains a list of some regressions from 2.6.35,
>> for which there are no fixes in the mainline known to the tracking team.
>> If any of them have been fixed already, please let us know.
>>
>> If you know of any other unresolved regressions from 2.6.35, please let us
>> know either and we'll add them to the list. Also, please let us know
>> if any of the entries below are invalid.
>>
>> Each entry from the list will be sent additionally in an automatic reply
>> to this message with CCs to the people involved in reporting and handling
>> the issue.
>>
>>
>> Listed regressions statistics:
>>
>> Date Total Pending Unresolved
>> ----------------------------------------
>> 2010-09-20 38 15 15
>> 2010-09-12 28 14 13
>> 2010-08-30 21 16 15
>>
>>
>> Unresolved regressions
>
> Hi Rafael,
>
> can you please add the following Bug, Thanks in advance.
>
> Bug-Entry : https://bugzilla.kernel.org/show_bug.cgi?id=16140
> Subject : Suspend To RAM/ Resume broken - Radeon KMS on RV250
> Submitter : Michael Long <harn-solo@gmx.de>
> Date : 2010-06-06 09:52
> Message-ID : ???
> References : ???
>
> What is with "Regression: No" in the BR? Change?
This isn't a regression as according to your bug report, s/r has never
worked on your board with kms. The kms and ums drm components are
completely different drivers even though they are compiled into the
same binary.
Alex
>
> Regards,
> - Sedat -
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* RE: [RFC PATCH v9 12/16] Add mp(mediate passthru) device.
From: Xin, Xiaohui @ 2010-09-21 1:39 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: netdev@vger.kernel.org, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org, mingo@elte.hu, davem@davemloft.net,
herbert@gondor.hengli.com.au, jdike@linux.intel.com
In-Reply-To: <20100920113643.GB23898@redhat.com>
>From: Michael S. Tsirkin [mailto:mst@redhat.com]
>Sent: Monday, September 20, 2010 7:37 PM
>To: Xin, Xiaohui
>Cc: netdev@vger.kernel.org; kvm@vger.kernel.org; linux-kernel@vger.kernel.org;
>mingo@elte.hu; davem@davemloft.net; herbert@gondor.hengli.com.au;
>jdike@linux.intel.com
>Subject: Re: [RFC PATCH v9 12/16] Add mp(mediate passthru) device.
>
>On Mon, Sep 20, 2010 at 04:08:48PM +0800, xiaohui.xin@intel.com wrote:
>> From: Xin Xiaohui <xiaohui.xin@intel.com>
>>
>> ---
>> Michael,
>> I have move the ioctl to configure the locked memory to vhost
>
>It's ok to move this to vhost but vhost does not
>know how much memory is needed by the backend.
I think the backend here you mean is mp device.
Actually, the memory needed is related to vq->num to run zero-copy
smoothly. That means mp device did not know it but vhost did.
And the rlimt stuff is per process, we use current pointer to set
and check the rlimit, the operations should be in the same process.
Now the check operations are in vhost process, as mp_recvmsg() or
mp_sendmsg() are called by vhost. So set operations should be in
vhost process too, it's natural.
>So I think we'll need another ioctl in the backend
>to tell userspace how much memory is needed?
>
Except vhost tells it to mp device, mp did not know
how much memory is needed to run zero-copy smoothly.
Is userspace interested about the memory mp is needed?
>It seems a bit cleaner as a backend ioctl as vhost
>does not lock memory itself, but I am not
>principally opposed.
>
>> and
>> check the limit with mm->locked_vm. please have a look.
>>
>> Thanks
>> Xiaohui
>>
>> drivers/vhost/mpassthru.c | 74 +++++++++----------------------------------
>> drivers/vhost/net.c | 78
>++++++++++++++++++++++++++++++++++++++------
>> include/linux/vhost.h | 3 ++
>> 3 files changed, 85 insertions(+), 70 deletions(-)
>>
>> diff --git a/drivers/vhost/mpassthru.c b/drivers/vhost/mpassthru.c
>> index d86d94c..fd3827b 100644
>> --- a/drivers/vhost/mpassthru.c
>> +++ b/drivers/vhost/mpassthru.c
>> @@ -109,9 +109,6 @@ struct page_ctor {
>> int wq_len;
>> int rq_len;
>> spinlock_t read_lock;
>> - /* record the locked pages */
>> - int lock_pages;
>> - struct rlimit o_rlim;
>> struct net_device *dev;
>> struct mpassthru_port port;
>> struct page_info **hash_table;
>> @@ -231,7 +228,6 @@ static int page_ctor_attach(struct mp_struct *mp)
>> ctor->port.ctor = page_ctor;
>> ctor->port.sock = &mp->socket;
>> ctor->port.hash = mp_lookup;
>> - ctor->lock_pages = 0;
>>
>> /* locked by mp_mutex */
>> dev->mp_port = &ctor->port;
>> @@ -264,37 +260,6 @@ struct page_info *info_dequeue(struct page_ctor *ctor)
>> return info;
>> }
>>
>> -static int set_memlock_rlimit(struct page_ctor *ctor, int resource,
>> - unsigned long cur, unsigned long max)
>> -{
>> - struct rlimit new_rlim, *old_rlim;
>> - int retval;
>> -
>> - if (resource != RLIMIT_MEMLOCK)
>> - return -EINVAL;
>> - new_rlim.rlim_cur = cur;
>> - new_rlim.rlim_max = max;
>> -
>> - old_rlim = current->signal->rlim + resource;
>> -
>> - /* remember the old rlimit value when backend enabled */
>> - ctor->o_rlim.rlim_cur = old_rlim->rlim_cur;
>> - ctor->o_rlim.rlim_max = old_rlim->rlim_max;
>> -
>> - if ((new_rlim.rlim_max > old_rlim->rlim_max) &&
>> - !capable(CAP_SYS_RESOURCE))
>> - return -EPERM;
>> -
>> - retval = security_task_setrlimit(resource, &new_rlim);
>> - if (retval)
>> - return retval;
>> -
>> - task_lock(current->group_leader);
>> - *old_rlim = new_rlim;
>> - task_unlock(current->group_leader);
>> - return 0;
>> -}
>> -
>> static void relinquish_resource(struct page_ctor *ctor)
>> {
>> if (!(ctor->dev->flags & IFF_UP) &&
>> @@ -322,8 +287,6 @@ static void mp_ki_dtor(struct kiocb *iocb)
>> info->ctor->rq_len--;
>> } else
>> info->ctor->wq_len--;
>> - /* Decrement the number of locked pages */
>> - info->ctor->lock_pages -= info->pnum;
>> kmem_cache_free(ext_page_info_cache, info);
>> relinquish_resource(info->ctor);
>>
>> @@ -349,7 +312,7 @@ static struct kiocb *create_iocb(struct page_info *info, int size)
>> iocb->ki_dtor(iocb);
>> iocb->private = (void *)info;
>> iocb->ki_dtor = mp_ki_dtor;
>> -
>> + iocb->ki_user_data = info->pnum;
>> return iocb;
>> }
>>
>> @@ -375,10 +338,6 @@ static int page_ctor_detach(struct mp_struct *mp)
>>
>> relinquish_resource(ctor);
>>
>> - set_memlock_rlimit(ctor, RLIMIT_MEMLOCK,
>> - ctor->o_rlim.rlim_cur,
>> - ctor->o_rlim.rlim_max);
>> -
>> /* locked by mp_mutex */
>> ctor->dev->mp_port = NULL;
>> dev_put(ctor->dev);
>> @@ -565,21 +524,23 @@ static struct page_info *alloc_page_info(struct page_ctor *ctor,
>> int rc;
>> int i, j, n = 0;
>> int len;
>> - unsigned long base, lock_limit;
>> + unsigned long base, lock_limit, locked;
>> struct page_info *info = NULL;
>>
>> - lock_limit = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur;
>> - lock_limit >>= PAGE_SHIFT;
>> + down_write(¤t->mm->mmap_sem);
>> + locked = count + current->mm->locked_vm;
>> + lock_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT;
>>
>> - if (ctor->lock_pages + count > lock_limit && npages) {
>> - printk(KERN_INFO "exceed the locked memory rlimit.");
>> - return NULL;
>> - }
>> + if ((locked > lock_limit) && !capable(CAP_IPC_LOCK))
>> + goto out;
>>
>> info = kmem_cache_alloc(ext_page_info_cache, GFP_KERNEL);
>>
>> if (!info)
>> - return NULL;
>> + goto out;
>> +
>> + up_write(¤t->mm->mmap_sem);
>> +
>> info->skb = NULL;
>> info->next = info->prev = NULL;
>>
>
>Sorry I wasnt clear, I didn't really mean we copy everything
>from infiniband, just the capability checks and locked_mm use.
>These guys don't do registration on data path so
>they can play games with locked_mm etc on registration.
>But lock on data path, taking mmap sem and doing security checks
>on data path would be bad for performance.
>I would expect this to cause contention especially
>as we'll go for multiqueue.
>
>Here's what I really meant:
> SET_MEM_LOCKED gets a 32 bit integer (or a 64 bit
> if you like - just not long).
> the meaning of which is "this is how much
> memory device can lock".
> This ioctl does rlim_cur and capability checks,
> if passed immediately increments locked_vm counter
> by the *maximum amount specified*.
> Device must store the value by which we incremented
> locked_vm and the mm pointer (if this is vhost ioctl
> it has the owner already). Let's call this
> field lock_limit.
>
>
> Lock limit can also take into account
> e.g. device tx queue depth and our queue size.
> Either we give another ioctl that tells userspace
> about these and let it make the decision,
> or simply cap lock_limit ourselves
> depending on these parameters.
>
> If another SET_MEM_LOCKED ioctl is made,
> decrement lcoked_vm in the stored mm,
> and redo the operation on current->mm
> (note: might be different!).
>
> This ioctl should probably fail if backend is active
> (already has locked some pages), such an
> approach makes it easy as we do not need to
> find and unlock pages.
>
> Each time you want to lock some memory you check that
> 1. current->mm matches the stored mm.
> 2. (number of pages locked + amount we want to lock) * PAGE_SIZE <= lock_limit.
>
>
> close and RESET_OWNER decrement and drop mm reference
> (note: on close
> we decrement owner's locked_vm, not current->mm
> which might be different).
>
>
>
>
>> @@ -633,8 +594,7 @@ static struct page_info *alloc_page_info(struct page_ctor *ctor,
>> for (i = 0; i < j; i++)
>> mp_hash_insert(ctor, info->pages[i], info);
>> }
>> - /* increment the number of locked pages */
>> - ctor->lock_pages += j;
>> +
>> return info;
>>
>> failed:
>> @@ -642,7 +602,9 @@ failed:
>> put_page(info->pages[i]);
>>
>> kmem_cache_free(ext_page_info_cache, info);
>> -
>> + return NULL;
>> +out:
>> + up(¤t->mm->mmap_sem);
>> return NULL;
>> }
>>
>> @@ -1006,12 +968,6 @@ proceed:
>> count--;
>> }
>>
>> - if (!ctor->lock_pages || !ctor->rq_len) {
>> - set_memlock_rlimit(ctor, RLIMIT_MEMLOCK,
>> - iocb->ki_user_data * 4096 * 2,
>> - iocb->ki_user_data * 4096 * 2);
>> - }
>> -
>> /* Translate address to kernel */
>> info = alloc_page_info(ctor, iocb, iov, count, frags, npages, 0);
>> if (!info)
>> diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
>> index c4bc815..da78837 100644
>> --- a/drivers/vhost/net.c
>> +++ b/drivers/vhost/net.c
>> @@ -42,6 +42,7 @@ enum {
>> };
>>
>> static struct kmem_cache *notify_cache;
>> +static struct rlimit orig_rlim;
>>
>> enum vhost_net_poll_state {
>> VHOST_NET_POLL_DISABLED = 0,
>> @@ -136,13 +137,7 @@ static void handle_async_rx_events_notify(struct vhost_net *net,
>> struct vhost_log *vq_log = NULL;
>> int rx_total_len = 0;
>> unsigned int head, log, in, out;
>> - int size;
>> - int count;
>> -
>> - struct virtio_net_hdr_mrg_rxbuf hdr = {
>> - .hdr.flags = 0,
>> - .hdr.gso_type = VIRTIO_NET_HDR_GSO_NONE
>> - };
>> + int size, free = 0;
>>
>> if (!is_async_vq(vq))
>> return;
>> @@ -160,7 +155,7 @@ static void handle_async_rx_events_notify(struct vhost_net *net,
>> size = iocb->ki_nbytes;
>> head = iocb->ki_pos;
>> rx_total_len += iocb->ki_nbytes;
>> -
>> + free += iocb->ki_user_data;
>> if (iocb->ki_dtor)
>> iocb->ki_dtor(iocb);
>> kmem_cache_free(net->cache, iocb);
>> @@ -192,6 +187,7 @@ static void handle_async_rx_events_notify(struct vhost_net *net,
>> size = iocb->ki_nbytes;
>> head = iocb->ki_pos;
>> rx_total_len += iocb->ki_nbytes;
>> + free += iocb->ki_user_data;
>>
>> if (iocb->ki_dtor)
>> iocb->ki_dtor(iocb);
>> @@ -211,7 +207,6 @@ static void handle_async_rx_events_notify(struct vhost_net *net,
>> break;
>>
>> i++;
>> - iocb == NULL;
>> if (count)
>> iocb = notify_dequeue(vq);
>> }
>> @@ -219,6 +214,10 @@ static void handle_async_rx_events_notify(struct vhost_net *net,
>> &net->dev, vq, vq->heads, hc);
>> }
>> }
>> + /* record locked memroy */
>> + down_write(¤t->mm->mmap_sem);
>> + current->mm->locked_vm -= free;
>> + up_write(¤t->mm->mmap_sem);
>> }
>>
>> static void handle_async_tx_events_notify(struct vhost_net *net,
>> @@ -227,7 +226,7 @@ static void handle_async_tx_events_notify(struct vhost_net *net,
>> struct kiocb *iocb = NULL;
>> struct list_head *entry, *tmp;
>> unsigned long flags;
>> - int tx_total_len = 0;
>> + int tx_total_len = 0, free = 0;
>>
>> if (!is_async_vq(vq))
>> return;
>> @@ -242,7 +241,7 @@ static void handle_async_tx_events_notify(struct vhost_net *net,
>> vhost_add_used_and_signal(&net->dev, vq,
>> iocb->ki_pos, 0);
>> tx_total_len += iocb->ki_nbytes;
>> -
>> + free += iocb->ki_user_data;
>> if (iocb->ki_dtor)
>> iocb->ki_dtor(iocb);
>>
>> @@ -253,6 +252,10 @@ static void handle_async_tx_events_notify(struct vhost_net *net,
>> }
>> }
>> spin_unlock_irqrestore(&vq->notify_lock, flags);
>> + /* record locked memroy */
>> + down_write(¤t->mm->mmap_sem);
>> + current->mm->locked_vm -= free;
>> + up_write(¤t->mm->mmap_sem);
>> }
>>
>> static struct kiocb *create_iocb(struct vhost_net *net,
>> @@ -581,6 +584,7 @@ static void handle_rx_net(struct work_struct *work)
>> static int vhost_net_open(struct inode *inode, struct file *f)
>> {
>> struct vhost_net *n = kmalloc(sizeof *n, GFP_KERNEL);
>> + struct rlimit *old_rlim;
>> int r;
>> if (!n)
>> return -ENOMEM;
>> @@ -597,6 +601,12 @@ static int vhost_net_open(struct inode *inode, struct file *f)
>> n->tx_poll_state = VHOST_NET_POLL_DISABLED;
>> n->cache = NULL;
>>
>> + old_rlim = current->signal->rlim + RLIMIT_MEMLOCK;
>> +
>> + /* remember the old rlimit value when backend enabled */
>> + orig_rlim.rlim_cur = old_rlim->rlim_cur;
>> + orig_rlim.rlim_max = old_rlim->rlim_max;
>> +
>> f->private_data = n;
>>
>> return 0;
>> @@ -659,6 +669,39 @@ static void vhost_net_flush(struct vhost_net *n)
>> vhost_net_flush_vq(n, VHOST_NET_VQ_RX);
>> }
>>
>> +static long vhost_net_set_mem_locked(struct vhost_net *n,
>> + unsigned long cur,
>> + unsigned long max)
>> +{
>
>So one issue here is that when this is called on close,
>current might be different from owner, with bad results.
>
>I really think avoiding modifying rlimit is
>the simplest way to go for now.
>
>> + struct rlimit new_rlim, *old_rlim;
>> + int retval = 0;
>> +
>> + mutex_lock(&n->dev.mutex);
>> + new_rlim.rlim_cur = cur;
>> + new_rlim.rlim_max = max;
>> +
>> + old_rlim = current->signal->rlim + RLIMIT_MEMLOCK;
>> +
>> + if ((new_rlim.rlim_max > old_rlim->rlim_max) &&
>> + !capable(CAP_SYS_RESOURCE)) {
>> + retval = -EPERM;
>> + goto err;
>> + }
>> +
>> + retval = security_task_setrlimit(RLIMIT_MEMLOCK, &new_rlim);
>> + if (retval) {
>> + retval = retval;
>> + goto err;
>> + }
>> +
>> + task_lock(current->group_leader);
>> + *old_rlim = new_rlim;
>> + task_unlock(current->group_leader);
>> +err:
>> + mutex_unlock(&n->dev.mutex);
>> + return retval;
>> +}
>> +
>> static void vhost_async_cleanup(struct vhost_net *n)
>> {
>> /* clean the notifier */
>> @@ -691,6 +734,10 @@ static int vhost_net_release(struct inode *inode, struct file *f)
>> * since jobs can re-queue themselves. */
>> vhost_net_flush(n);
>> vhost_async_cleanup(n);
>> + /* return back the rlimit */
>> + vhost_net_set_mem_locked(n,
>> + orig_rlim.rlim_cur,
>> + orig_rlim.rlim_max);
>> kfree(n);
>> return 0;
>> }
>> @@ -846,6 +893,7 @@ err:
>> return r;
>> }
>>
>> +
>> static long vhost_net_reset_owner(struct vhost_net *n)
>> {
>> struct socket *tx_sock = NULL;
>> @@ -913,6 +961,7 @@ static long vhost_net_ioctl(struct file *f, unsigned int ioctl,
>> void __user *argp = (void __user *)arg;
>> u64 __user *featurep = argp;
>> struct vhost_vring_file backend;
>> + struct rlimit rlim;
>> u64 features;
>> int r;
>> switch (ioctl) {
>> @@ -933,6 +982,13 @@ static long vhost_net_ioctl(struct file *f, unsigned int ioctl,
>> return vhost_net_set_features(n, features);
>> case VHOST_RESET_OWNER:
>> return vhost_net_reset_owner(n);
>> + case VHOST_SET_MEM_LOCKED:
>> + r = copy_from_user(&rlim, argp, sizeof rlim);
>> + if (r < 0)
>> + return r;
>> + return vhost_net_set_mem_locked(n,
>> + rlim.rlim_cur,
>> + rlim.rlim_max);
>> default:
>> mutex_lock(&n->dev.mutex);
>> r = vhost_dev_ioctl(&n->dev, ioctl, arg);
>> diff --git a/include/linux/vhost.h b/include/linux/vhost.h
>> index e847f1e..df93f5a 100644
>> --- a/include/linux/vhost.h
>> +++ b/include/linux/vhost.h
>> @@ -92,6 +92,9 @@ struct vhost_memory {
>> /* Specify an eventfd file descriptor to signal on log write. */
>> #define VHOST_SET_LOG_FD _IOW(VHOST_VIRTIO, 0x07, int)
>>
>> +/* Specify how much locked memory can be used */
>> +#define VHOST_SET_MEM_LOCKED _IOW(VHOST_VIRTIO, 0x08, struct rlimit)
>> +
>
>This is not a good structure to use: its size varies between
>64 and 32 bit. rlimit64 would be better.
>Also, you will have to include resource.h from here.
>
>> /* Ring setup. */
>> /* Set number of descriptors in ring. This parameter can not
>> * be modified while ring is running (bound to a device). */
>> --
>> 1.5.4.4
^ 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