* Re: in_atomic() & spin_lock / spin_unlock in different functions
@ 2002-10-13 19:21 Manfred Spraul
0 siblings, 0 replies; 3+ messages in thread
From: Manfred Spraul @ 2002-10-13 19:21 UTC (permalink / raw)
To: Pavel Machek; +Cc: linux-kernel
> What is it that in_atomic counts? Obviously spinlocks and
> get_cpu/put_cpu. Anything else?
>
preempt_disable(), local_irq_disable(), local_bh_disable().
> I'm doing spin_lock_irqsave() then in another function
> spin_unlock_irqrestore. Is that okay? If no, can it cause "scheduling
> in atomic"?
It's not okay, but shouldn't cause scheduling in atomic messages.
The problem is sparc: the 'unsigned long flags' parameter used by
_irqsave and _irqrestore contains the stack frame, which means that you
cannot pass it between functions.
--
Manfred
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: in_atomic() & spin_lock / spin_unlock in different functions
2002-10-13 18:38 Pavel Machek
@ 2002-10-13 19:40 ` Robert Love
0 siblings, 0 replies; 3+ messages in thread
From: Robert Love @ 2002-10-13 19:40 UTC (permalink / raw)
To: Pavel Machek; +Cc: kernel list
On Sun, 2002-10-13 at 14:38, Pavel Machek wrote:
> I'm doing spin_lock_irqsave() then in another function
> spin_unlock_irqrestore. Is that okay? If no, can it cause "scheduling
> in atomic"?
It is not OK if the function is run by a different process. Then one
process will have a preempt_count one larger than it should and one
would have a preempt_count one smaller.
The task with the one smaller preempt_count will probably cause a crash
when it preemptively reschedules erroneously.
In other words, you have:
Process A Process B
preempt_count++
preempt_count--
When both of those routines need to be done by the same process.
Also, you cannot use spin_lock_irqsave() in different functions at all
on sparc as it contains stack information.
Robert Love
^ permalink raw reply [flat|nested] 3+ messages in thread
* in_atomic() & spin_lock / spin_unlock in different functions
@ 2002-10-13 18:38 Pavel Machek
2002-10-13 19:40 ` Robert Love
0 siblings, 1 reply; 3+ messages in thread
From: Pavel Machek @ 2002-10-13 18:38 UTC (permalink / raw)
To: kernel list
Hi!
What is it that in_atomic counts? Obviously spinlocks and
get_cpu/put_cpu. Anything else?
Is there easy way to find out which spinlock causes "scheduling in
atomic" warning? [It happens a *lot* in swsusp].
I'm doing spin_lock_irqsave() then in another function
spin_unlock_irqrestore. Is that okay? If no, can it cause "scheduling
in atomic"?
Pavel
--
When do you have heart between your knees?
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-10-13 19:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-13 19:21 in_atomic() & spin_lock / spin_unlock in different functions Manfred Spraul
-- strict thread matches above, loose matches on Subject: below --
2002-10-13 18:38 Pavel Machek
2002-10-13 19:40 ` Robert Love
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).