Re: [PATCH 4/4] crypto: s5p-sss - Use mutex instead of spinlock

2017-03-17 Thread Krzysztof Kozlowski
On Fri, Mar 17, 2017 at 06:28:29PM +0100, Bartlomiej Zolnierkiewicz wrote:
> 
> Hi,
> 
> On Friday, March 17, 2017 04:49:22 PM Krzysztof Kozlowski wrote:
> > Driver uses threaded interrupt handler so there is no real need for
> > using spinlocks for synchronization.  Mutexes would do fine and are
> > friendlier for overall system preemptivness and real-time behavior.
> 
> Are you sure that this conversion is safe?  This driver also uses
> a tasklet and tasklets run in the interrupt context.
>

Yes, you're right. This is not safe and patch should be dropped. Thanks
for spotting this.

Best regards,
Krzysztof



Re: [PATCH 4/4] crypto: s5p-sss - Use mutex instead of spinlock

2017-03-17 Thread Bartlomiej Zolnierkiewicz

Hi,

On Friday, March 17, 2017 04:49:22 PM Krzysztof Kozlowski wrote:
> Driver uses threaded interrupt handler so there is no real need for
> using spinlocks for synchronization.  Mutexes would do fine and are
> friendlier for overall system preemptivness and real-time behavior.

Are you sure that this conversion is safe?  This driver also uses
a tasklet and tasklets run in the interrupt context.

> @@ -667,18 +666,17 @@ static void s5p_tasklet_cb(unsigned long data)
>   struct s5p_aes_dev *dev = (struct s5p_aes_dev *)data;
>   struct crypto_async_request *async_req, *backlog;
>   struct s5p_aes_reqctx *reqctx;
> - unsigned long flags;
>  
> - spin_lock_irqsave(>lock, flags);
> + mutex_lock(>lock);
>   backlog   = crypto_get_backlog(>queue);
>   async_req = crypto_dequeue_request(>queue);
>  
>   if (!async_req) {
>   dev->busy = false;
> - spin_unlock_irqrestore(>lock, flags);
> + mutex_unlock(>lock);
>   return;
>   }
> - spin_unlock_irqrestore(>lock, flags);
> + mutex_unlock(>lock);

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R Institute Poland
Samsung Electronics