[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20061130000120.GA999@oleg>
Date: Thu, 30 Nov 2006 03:01:20 +0300
From: Oleg Nesterov <oleg@...sign.ru>
To: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
Cc: Alan Stern <stern@...land.harvard.edu>,
Jens Axboe <jens.axboe@...cle.com>,
linux-kernel@...r.kernel.org, davem@...emloft.net,
dhowells@...hat.com
Subject: Re: [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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists