Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1603482

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

From Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Newsgroups linux.kernel
Subject Re: [PATCH 4/4] crypto: s5p-sss - Use mutex instead of spinlock
Date 2017-03-17 18:40 +0100
Message-ID <tm414-1ya-5@gated-at.bofh.it> (permalink)
References <tm1we-80O-19@gated-at.bofh.it> <tm1we-80O-21@gated-at.bofh.it> <tm414-1ya-7@gated-at.bofh.it> <tm1we-80O-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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(&dev->lock, flags);
> +	mutex_lock(&dev->lock);
>  	backlog   = crypto_get_backlog(&dev->queue);
>  	async_req = crypto_dequeue_request(&dev->queue);
>  
>  	if (!async_req) {
>  		dev->busy = false;
> -		spin_unlock_irqrestore(&dev->lock, flags);
> +		mutex_unlock(&dev->lock);
>  		return;
>  	}
> -	spin_unlock_irqrestore(&dev->lock, flags);
> +	mutex_unlock(&dev->lock);

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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 4/4] crypto: s5p-sss - Use mutex instead of spinlock Krzysztof Kozlowski <krzk@kernel.org> - 2017-03-17 16:00 +0100
  Re: [PATCH 4/4] crypto: s5p-sss - Use mutex instead of spinlock Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> - 2017-03-17 18:40 +0100
    Re: [PATCH 4/4] crypto: s5p-sss - Use mutex instead of spinlock Krzysztof Kozlowski <krzk@kernel.org> - 2017-03-17 19:30 +0100

csiph-web