Jordan Crouse wrote:

Is there any way to differentiate if a crypto API call was made in an
atomic context or not?  The problem here, is that I only have one engine,
so I need to protect it from multiple processes accessing it at the same time. I can get rid of the sleep in an atomic context, but we expect
to have both atomic and process contexts heavily accessing the engine at
the same time, we really run the risk of having the atomic contexts fail more often then they should due to a process holding the mutex.

As your implementation is already spinning on completion, you probably have two choices - fail racers that lose;

   if(atomic_dec_and_test(...)) {
       atomic_inc(...);
       /* fail */
   }
   /* do crypto with spin */
   atomic_inc(...);
   /* success */

or use appropriate spin-locks. The latter is probably the only option. Though I hope the system doesn't bottleneck on crypto, otherwise everything will be spinning - either waiting to start crypto or waiting for it to complete.

Cheers,
Geoff

-
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to