linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] lightnvm: pblk: remove spinlock when freeing line metadata
@ 2017-10-05  8:35 Hans Holmberg
  2017-10-06  9:20 ` Andrey Ryabinin
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Holmberg @ 2017-10-05  8:35 UTC (permalink / raw)
  To: Matias Bjorling
  Cc: linux-block, linux-kernel, Javier Gonzales, Andrey Ryabinin,
	Hans Holmberg

From: Hans Holmberg <hans.holmberg@cnexlabs.com>

Lockdep complains about being in atomic context while freeing line
metadata - and rightly so as we take a spinlock and end up calling
vfree that might sleep(in pblk_mfree).

There is no need for holding the line manager free_lock while
freeing line metadata, so remove the lock.

Signed-off-by: Hans Holmberg <hans.holmberg@cnexlabs.com>
---
This patch is for:
https://github.com/OpenChannelSSD/linux branch for-4.15/pblk

 drivers/lightnvm/pblk-init.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c
index c452478..a645117 100644
--- a/drivers/lightnvm/pblk-init.c
+++ b/drivers/lightnvm/pblk-init.c
@@ -393,13 +393,11 @@ static void pblk_line_meta_free(struct pblk *pblk)
 	kfree(l_mg->bb_aux);
 	kfree(l_mg->vsc_list);
 
-	spin_lock(&l_mg->free_lock);
 	for (i = 0; i < PBLK_DATA_LINES; i++) {
 		kfree(l_mg->sline_meta[i]);
 		pblk_mfree(l_mg->eline_meta[i]->buf, l_mg->emeta_alloc_type);
 		kfree(l_mg->eline_meta[i]);
 	}
-	spin_unlock(&l_mg->free_lock);
 
 	kfree(pblk->lines);
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] lightnvm: pblk: remove spinlock when freeing line metadata
  2017-10-05  8:35 [PATCH] lightnvm: pblk: remove spinlock when freeing line metadata Hans Holmberg
@ 2017-10-06  9:20 ` Andrey Ryabinin
  2017-10-06 13:28   ` Javier González
  0 siblings, 1 reply; 3+ messages in thread
From: Andrey Ryabinin @ 2017-10-06  9:20 UTC (permalink / raw)
  To: Hans Holmberg, Matias Bjorling
  Cc: linux-block, linux-kernel, Javier Gonzales, Hans Holmberg

On 10/05/2017 11:35 AM, Hans Holmberg wrote:
> From: Hans Holmberg <hans.holmberg@cnexlabs.com>
> 
> Lockdep complains about being in atomic context while freeing line
> metadata - and rightly so as we take a spinlock and end up calling
> vfree that might sleep(in pblk_mfree).
> 
> There is no need for holding the line manager free_lock while
> freeing line metadata, so remove the lock.
> 
> Signed-off-by: Hans Holmberg <hans.holmberg@cnexlabs.com>

Reviewed-by: Andrey Ryabinin <aryabinin@virtuozzo.com>

I guess this also deserves stable tag. The bug was introduced in 4.13 by
commit 588726d3ec68 ("lightnvm: pblk: fail gracefully on irrec. error").


> ---
> This patch is for:
> https://github.com/OpenChannelSSD/linux branch for-4.15/pblk
> 
>  drivers/lightnvm/pblk-init.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c
> index c452478..a645117 100644
> --- a/drivers/lightnvm/pblk-init.c
> +++ b/drivers/lightnvm/pblk-init.c
> @@ -393,13 +393,11 @@ static void pblk_line_meta_free(struct pblk *pblk)
>  	kfree(l_mg->bb_aux);
>  	kfree(l_mg->vsc_list);
>  
> -	spin_lock(&l_mg->free_lock);
>  	for (i = 0; i < PBLK_DATA_LINES; i++) {
>  		kfree(l_mg->sline_meta[i]);
>  		pblk_mfree(l_mg->eline_meta[i]->buf, l_mg->emeta_alloc_type);
>  		kfree(l_mg->eline_meta[i]);
>  	}
> -	spin_unlock(&l_mg->free_lock);
>  
>  	kfree(pblk->lines);
>  }
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] lightnvm: pblk: remove spinlock when freeing line metadata
  2017-10-06  9:20 ` Andrey Ryabinin
@ 2017-10-06 13:28   ` Javier González
  0 siblings, 0 replies; 3+ messages in thread
From: Javier González @ 2017-10-06 13:28 UTC (permalink / raw)
  To: Andrey Ryabinin
  Cc: Hans Holmberg, Matias Bjørling, linux-block,
	Linux Kernel Mailing List, Hans Holmberg

[-- Attachment #1: Type: text/plain, Size: 822 bytes --]

> On 6 Oct 2017, at 11.20, Andrey Ryabinin <aryabinin@virtuozzo.com> wrote:
> 
> On 10/05/2017 11:35 AM, Hans Holmberg wrote:
>> From: Hans Holmberg <hans.holmberg@cnexlabs.com>
>> 
>> Lockdep complains about being in atomic context while freeing line
>> metadata - and rightly so as we take a spinlock and end up calling
>> vfree that might sleep(in pblk_mfree).
>> 
>> There is no need for holding the line manager free_lock while
>> freeing line metadata, so remove the lock.
>> 
>> Signed-off-by: Hans Holmberg <hans.holmberg@cnexlabs.com>
> 
> Reviewed-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
> 
> I guess this also deserves stable tag. The bug was introduced in 4.13 by
> commit 588726d3ec68 ("lightnvm: pblk: fail gracefully on irrec. error").
> 

Good point. We'll add it when picking it up.

Thanks,
Javier

[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-10-06 13:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-05  8:35 [PATCH] lightnvm: pblk: remove spinlock when freeing line metadata Hans Holmberg
2017-10-06  9:20 ` Andrey Ryabinin
2017-10-06 13:28   ` Javier González

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).