* CryptoAPI: schedual while atomic
@ 2004-08-30 13:24 Jean-Luc Cooke
2004-08-30 14:42 ` James Morris
0 siblings, 1 reply; 4+ messages in thread
From: Jean-Luc Cooke @ 2004-08-30 13:24 UTC (permalink / raw)
To: linux-kernel
While I was playing with using the CryptoAPI in /dev/random for my own
purposes, I noticed that I was getting quite a few "schedual while atomic!"
console messages.
Talking with Michal Ludvig, I seem to think that a "!is_atomic()" check
inside crypto_yield() or passing a flag during crypto_alloc_tfm() would make
a lot of sense.
This may be more directed at James Morris, but here it goes:
Can we have some logic to either check for or turn off crypto_yield()'s in
crypto/internal.h's crypto_yield() ?
Cheers,
JLC
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: CryptoAPI: schedual while atomic
2004-08-30 14:42 ` James Morris
@ 2004-08-30 13:53 ` Jean-Luc Cooke
2004-08-30 15:06 ` James Morris
0 siblings, 1 reply; 4+ messages in thread
From: Jean-Luc Cooke @ 2004-08-30 13:53 UTC (permalink / raw)
To: James Morris; +Cc: linux-kernel
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?
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?
Thanks for your time.
JLC
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: CryptoAPI: schedual while atomic
2004-08-30 13:24 CryptoAPI: schedual while atomic Jean-Luc Cooke
@ 2004-08-30 14:42 ` James Morris
2004-08-30 13:53 ` Jean-Luc Cooke
0 siblings, 1 reply; 4+ messages in thread
From: James Morris @ 2004-08-30 14:42 UTC (permalink / raw)
To: Jean-Luc Cooke; +Cc: linux-kernel
On Mon, 30 Aug 2004, Jean-Luc Cooke wrote:
> While I was playing with using the CryptoAPI in /dev/random for my own
> purposes, I noticed that I was getting quite a few "schedual while atomic!"
> console messages.
Where is the code which caused this? The transforms are safe to use (but
not allocate) in process and softirq contexts.
> Talking with Michal Ludvig, I seem to think that a "!is_atomic()" check
> inside crypto_yield() or passing a flag during crypto_alloc_tfm() would make
> a lot of sense.
>
> This may be more directed at James Morris, but here it goes:
>
> Can we have some logic to either check for or turn off crypto_yield()'s in
> crypto/internal.h's crypto_yield() ?
Why? This should not be needed.
- James
--
James Morris
<jmorris@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: CryptoAPI: schedual while atomic
2004-08-30 13:53 ` Jean-Luc Cooke
@ 2004-08-30 15:06 ` James Morris
0 siblings, 0 replies; 4+ messages in thread
From: James Morris @ 2004-08-30 15:06 UTC (permalink / raw)
To: Jean-Luc Cooke; +Cc: linux-kernel
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@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-08-30 15:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-30 13:24 CryptoAPI: schedual while atomic Jean-Luc Cooke
2004-08-30 14:42 ` James Morris
2004-08-30 13:53 ` Jean-Luc Cooke
2004-08-30 15:06 ` James Morris
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox