Re: spin_lock_irqsave or spin_lock in work queue handlers?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Michael!

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?


It probably works as long as there is no code which locks this spinlock with
interrupts disabled. But I recommend using a mutex instead, as it can sleeps.
The spinlock does busy waiting...
	-Michi

O.K. I think:
The spin_locks were only used in the work handler and in no interrupt handler. So without disabling interrupts (to avoid the BUG message) it has been safe - good.

I don't know mutex_lock and I'm using semaphores. I hope that's also OK.

Many Thanks and 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


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux