linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] lightnvm: warn if irqs are disabled in lock laddr
@ 2016-02-01 10:34 Javier González
  2016-02-01 10:34 ` [PATCH 2/2] lightnvm: fix request intersection locking in rrpc Javier González
  2016-02-03  8:54 ` [PATCH 1/2] lightnvm: warn if irqs are disabled in lock laddr Matias Bjørling
  0 siblings, 2 replies; 4+ messages in thread
From: Javier González @ 2016-02-01 10:34 UTC (permalink / raw)
  To: mb; +Cc: linux-kernel, linux-block, Javier González

Add a warning if irqs are disabled when locking a new address in rrpc.
The typical path to a new request does not disable irqs, but this is not
guaranteed in the future.

Signed-off-by: Javier González <javier@cnexlabs.com>
---
 drivers/lightnvm/rrpc.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/lightnvm/rrpc.h b/drivers/lightnvm/rrpc.h
index dfca5c4..c27283a 100644
--- a/drivers/lightnvm/rrpc.h
+++ b/drivers/lightnvm/rrpc.h
@@ -184,6 +184,8 @@ static int __rrpc_lock_laddr(struct rrpc *rrpc, sector_t laddr,
 	sector_t laddr_end = laddr + pages - 1;
 	struct rrpc_inflight_rq *rtmp;
 
+	WARN_ON(irqs_disabled());
+
 	spin_lock_irq(&rrpc->inflights.lock);
 	list_for_each_entry(rtmp, &rrpc->inflights.reqs, list) {
 		if (unlikely(request_intersects(rtmp, laddr, laddr_end))) {
-- 
2.1.4

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

* [PATCH 2/2] lightnvm: fix request intersection locking in rrpc
  2016-02-01 10:34 [PATCH 1/2] lightnvm: warn if irqs are disabled in lock laddr Javier González
@ 2016-02-01 10:34 ` Javier González
  2016-02-03  8:53   ` Matias Bjørling
  2016-02-03  8:54 ` [PATCH 1/2] lightnvm: warn if irqs are disabled in lock laddr Matias Bjørling
  1 sibling, 1 reply; 4+ messages in thread
From: Javier González @ 2016-02-01 10:34 UTC (permalink / raw)
  To: mb; +Cc: linux-kernel, linux-block, Javier González

This patch fixes an error on the calculation of intersecting logical
addresses; it contemplates the case where a new request including
several addresses intersects with a single locked address. This case is
typical when multiple pages are sent in a new request, while GC - which
at the moment sends one address at the time - is running.

Signed-off-by: Javier González <javier@cnexlabs.com>
---
 drivers/lightnvm/rrpc.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/lightnvm/rrpc.h b/drivers/lightnvm/rrpc.h
index c27283a..3989d65 100644
--- a/drivers/lightnvm/rrpc.h
+++ b/drivers/lightnvm/rrpc.h
@@ -174,8 +174,7 @@ static inline sector_t rrpc_get_sector(sector_t laddr)
 static inline int request_intersects(struct rrpc_inflight_rq *r,
 				sector_t laddr_start, sector_t laddr_end)
 {
-	return (laddr_end >= r->l_start && laddr_end <= r->l_end) &&
-		(laddr_start >= r->l_start && laddr_start <= r->l_end);
+	return (laddr_end >= r->l_start) && (laddr_start <= r->l_end);
 }
 
 static int __rrpc_lock_laddr(struct rrpc *rrpc, sector_t laddr,
-- 
2.1.4

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

* Re: [PATCH 2/2] lightnvm: fix request intersection locking in rrpc
  2016-02-01 10:34 ` [PATCH 2/2] lightnvm: fix request intersection locking in rrpc Javier González
@ 2016-02-03  8:53   ` Matias Bjørling
  0 siblings, 0 replies; 4+ messages in thread
From: Matias Bjørling @ 2016-02-03  8:53 UTC (permalink / raw)
  To: Javier González; +Cc: linux-kernel, linux-block, Javier González

On 02/01/2016 11:34 AM, Javier González wrote:
> This patch fixes an error on the calculation of intersecting logical
> addresses; it contemplates the case where a new request including
> several addresses intersects with a single locked address. This case is
> typical when multiple pages are sent in a new request, while GC - which
> at the moment sends one address at the time - is running.
> 
> Signed-off-by: Javier González <javier@cnexlabs.com>
> ---
>  drivers/lightnvm/rrpc.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/lightnvm/rrpc.h b/drivers/lightnvm/rrpc.h
> index c27283a..3989d65 100644
> --- a/drivers/lightnvm/rrpc.h
> +++ b/drivers/lightnvm/rrpc.h
> @@ -174,8 +174,7 @@ static inline sector_t rrpc_get_sector(sector_t laddr)
>  static inline int request_intersects(struct rrpc_inflight_rq *r,
>  				sector_t laddr_start, sector_t laddr_end)
>  {
> -	return (laddr_end >= r->l_start && laddr_end <= r->l_end) &&
> -		(laddr_start >= r->l_start && laddr_start <= r->l_end);
> +	return (laddr_end >= r->l_start) && (laddr_start <= r->l_end);
>  }
>  
>  static int __rrpc_lock_laddr(struct rrpc *rrpc, sector_t laddr,
> 
Thanks, applied for next -rc.

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

* Re: [PATCH 1/2] lightnvm: warn if irqs are disabled in lock laddr
  2016-02-01 10:34 [PATCH 1/2] lightnvm: warn if irqs are disabled in lock laddr Javier González
  2016-02-01 10:34 ` [PATCH 2/2] lightnvm: fix request intersection locking in rrpc Javier González
@ 2016-02-03  8:54 ` Matias Bjørling
  1 sibling, 0 replies; 4+ messages in thread
From: Matias Bjørling @ 2016-02-03  8:54 UTC (permalink / raw)
  To: Javier González; +Cc: linux-kernel, linux-block, Javier González

On 02/01/2016 11:34 AM, Javier González wrote:
> Add a warning if irqs are disabled when locking a new address in rrpc.
> The typical path to a new request does not disable irqs, but this is not
> guaranteed in the future.
> 
> Signed-off-by: Javier González <javier@cnexlabs.com>
> ---
>  drivers/lightnvm/rrpc.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/lightnvm/rrpc.h b/drivers/lightnvm/rrpc.h
> index dfca5c4..c27283a 100644
> --- a/drivers/lightnvm/rrpc.h
> +++ b/drivers/lightnvm/rrpc.h
> @@ -184,6 +184,8 @@ static int __rrpc_lock_laddr(struct rrpc *rrpc, sector_t laddr,
>  	sector_t laddr_end = laddr + pages - 1;
>  	struct rrpc_inflight_rq *rtmp;
>  
> +	WARN_ON(irqs_disabled());
> +
>  	spin_lock_irq(&rrpc->inflights.lock);
>  	list_for_each_entry(rtmp, &rrpc->inflights.reqs, list) {
>  		if (unlikely(request_intersects(rtmp, laddr, laddr_end))) {
> 

Thanks, applied for next -rc.

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

end of thread, other threads:[~2016-02-03  8:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-01 10:34 [PATCH 1/2] lightnvm: warn if irqs are disabled in lock laddr Javier González
2016-02-01 10:34 ` [PATCH 2/2] lightnvm: fix request intersection locking in rrpc Javier González
2016-02-03  8:53   ` Matias Bjørling
2016-02-03  8:54 ` [PATCH 1/2] lightnvm: warn if irqs are disabled in lock laddr Matias Bjørling

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).