lkml.org 
[lkml]   [2006]   [Nov]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch] cpufreq: mark cpufreq_tsc() as core_initcall_sync
On 11/29, Paul E. McKenney wrote:
>
> On Wed, Nov 29, 2006 at 11:16:46PM +0300, Oleg Nesterov wrote:
> >
> > Hmm... SRCU can't be used from irq, yes. But I think that both versions
> > (spinlock needs _irqsave) can ?
>
> I didn't think you could call wait_event() from irq.

Ah, sorry for confusion, I talked only about read lock/unlock of course.

Just in case, it is not safe to do srcu_read_{,un}lock() from irq,

per_cpu_ptr(sp->per_cpu_ref, smp_processor_id())->c[idx]++
^^^^^^^^
we need local_t for that.

> For the locked version, you would also need spin_lock_irqsave() or some
> such to avoid self-deadlock.
>
> For the atomic version, the fact that synchronize_qrcu() increments
> the new counter before decrmenting the old one should mean that calls
> to qrcu_read_lock() and qrcu_read_unlock() can be called from irq.

Yes, exactly! There is another reason, suppose we did

qp->completed++;
atomic_inc(qp->ctr + (idx ^ 0x1));

In that case the reader could be stalled if synchronize_qrcu() takes a
preemption in between.

> But synchronize_qrcu() must be called from process context, since it
> can block.

Surely.

Oleg.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-11-30 01:03    [W:0.059 / U:10.516 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site