Re: CryptoAPI: schedual while atomic

From: James Morris
Date: Mon Aug 30 2004 - 10:09:55 EST


On Mon, 30 Aug 2004, Jean-Luc Cooke wrote:

> On Mon, Aug 30, 2004 at 10:42:11AM -0400, James Morris wrote:
> > Where is the code which caused this? The transforms are safe to use (but
> > not allocate) in process and softirq contexts.
>
> In add_entropy_words of random.c my experimental code is calling
> crypto_digest_update(). In update() it calles crypto_yield.
> add_entropy_words() is being call ed directly from a keyboard_interrupt. I
> was hoping to tidy up the code a bit by not using batch_entropy_stores... but
> I guess that's unavoidable then?

You can't call crypto routines from hardirq context. Think about how
slow crypto is and why you don't want it running in a hardware irq.


> Last question:
> Would spin_lock_irqsave() spin_unlock_irqrestore() still needed to surround
> crypto_digest_update() calls if they're going to be scattered/gathered
> later?

Not sure exactly what you mean, but you need to serialize calls to
crypto_digest_update(), yes.


- James
--
James Morris
<jmorris@xxxxxxxxxx>


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