Hello all!
In a work handler (of a work queue) I want to avoid the concurrently
usage of a socket (because there can be more worker-threads on a SMP
system)...
My first idea was to use spin_lock_irqsave in the work handler:
...
spin_lock_irqsave(&tx_d->lock, flags);
sock_sendmsg(...);
spin_unlock_irqrestore(&tx_d->lock, flags);
...
but if I do that, I get this message from the kernel:
BUG: warning at kernel/softirq.c:137/local_bh_enable()
[<b0121808>] local_bh_enable+0x38/0x79
[<b021d445>] lock_sock+0x89/0x91
[<b016ebb0>] mntput_no_expire+0x11/0x6a
[<b025cc6a>] inet_autobind+0x8/0x52
[<b025d5de>] inet_sendmsg+0x1c/0x3f
[<b021b1d7>] sock_sendmsg+0xce/0xe8
[<b012d65d>] autoremove_wake_function+0x0/0x2d
[<b01165c6>] __wake_up_sync+0x31/0x4b
[<f0b27c60>] ethos_tx_action+0x1f0/0x280 [ethos]
[<b01176ab>] try_to_wake_up+0x355/0x35f
[<b012a960>] run_workqueue+0x72/0xaf
[<f0b27a70>] ethos_tx_action+0x0/0x280 [ethos]
[<b012b220>] worker_thread+0xd9/0x10d
[<b01176b5>] default_wake_function+0x0/0xc
[<b012b147>] worker_thread+0x0/0x10d
[<b012d591>] kthread+0xc2/0xed
[<b012d4cf>] kthread+0x0/0xed
[<b0101005>] kernel_thread_helper+0x5/0xb
Then I tried:
...
spin_lock(&tx_d->lock);
sock_sendmsg(...);
spin_unlock(&tx_d->lock);
...
and I get no error messages anymore but now a nice person asked me if
that's safe and I think it isn't because interrupts are on in work
handlers or not?
So why do I get the error message?
What can I use instead of spin_lock_irqsave?
Many Thanks for your answers!
Best regards
Lukas
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ