All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers: nvme: target: core: Pass lockdep expression to RCU lists
@ 2020-01-10 13:23 ` Amol Grover
  0 siblings, 0 replies; 12+ messages in thread
From: Amol Grover @ 2020-01-10 13:23 UTC (permalink / raw)
  To: Christoph Hellwig, Sagi Grimberg, Chaitanya Kulkarni
  Cc: linux-nvme, linux-kernel, linux-kernel-mentees, Joel Fernandes,
	Madhuparna Bhowmik, Paul E . McKenney, Amol Grover

ctrl->subsys->namespaces and subsys->namespaces are traversed with
hlist_for_each_entry_rcu outside an RCU read-side critical section
but under the protection of subsys->lock.

Hence, add the corresponding lockdep expression to the list traversal
primitive to silence false-positive lockdep warnings, and
harden RCU lists.

Add macro for the corresponding lockdep expression to make the code
clean and concise.

Signed-off-by: Amol Grover <frextrite@gmail.com>
---
 drivers/nvme/target/core.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index 28438b833c1b..7caab4ba6a04 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -15,6 +15,9 @@
 
 #include "nvmet.h"
 
+#define subsys_lock_held() \
+	lockdep_is_held(&subsys->lock)
+
 struct workqueue_struct *buffered_io_wq;
 static const struct nvmet_fabrics_ops *nvmet_transports[NVMF_TRTYPE_MAX];
 static DEFINE_IDA(cntlid_ida);
@@ -555,7 +558,8 @@ int nvmet_ns_enable(struct nvmet_ns *ns)
 	} else {
 		struct nvmet_ns *old;
 
-		list_for_each_entry_rcu(old, &subsys->namespaces, dev_link) {
+		list_for_each_entry_rcu(old, &subsys->namespaces, dev_link,
+							subsys_lock_held()) {
 			BUG_ON(ns->nsid == old->nsid);
 			if (ns->nsid < old->nsid)
 				break;
@@ -1172,7 +1176,8 @@ static void nvmet_setup_p2p_ns_map(struct nvmet_ctrl *ctrl,
 
 	ctrl->p2p_client = get_device(req->p2p_client);
 
-	list_for_each_entry_rcu(ns, &ctrl->subsys->namespaces, dev_link)
+	list_for_each_entry_rcu(ns, &ctrl->subsys->namespaces, dev_link,
+							subsys_lock_held())
 		nvmet_p2pmem_ns_add_p2p(ctrl, ns);
 }
 
-- 
2.24.1


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

* [PATCH] drivers: nvme: target: core: Pass lockdep expression to RCU lists
@ 2020-01-10 13:23 ` Amol Grover
  0 siblings, 0 replies; 12+ messages in thread
From: Amol Grover @ 2020-01-10 13:23 UTC (permalink / raw)
  To: Christoph Hellwig, Sagi Grimberg, Chaitanya Kulkarni
  Cc: Paul E . McKenney, Amol Grover, linux-kernel, linux-nvme,
	Joel Fernandes, linux-kernel-mentees, Madhuparna Bhowmik

ctrl->subsys->namespaces and subsys->namespaces are traversed with
hlist_for_each_entry_rcu outside an RCU read-side critical section
but under the protection of subsys->lock.

Hence, add the corresponding lockdep expression to the list traversal
primitive to silence false-positive lockdep warnings, and
harden RCU lists.

Add macro for the corresponding lockdep expression to make the code
clean and concise.

Signed-off-by: Amol Grover <frextrite@gmail.com>
---
 drivers/nvme/target/core.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index 28438b833c1b..7caab4ba6a04 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -15,6 +15,9 @@
 
 #include "nvmet.h"
 
+#define subsys_lock_held() \
+	lockdep_is_held(&subsys->lock)
+
 struct workqueue_struct *buffered_io_wq;
 static const struct nvmet_fabrics_ops *nvmet_transports[NVMF_TRTYPE_MAX];
 static DEFINE_IDA(cntlid_ida);
@@ -555,7 +558,8 @@ int nvmet_ns_enable(struct nvmet_ns *ns)
 	} else {
 		struct nvmet_ns *old;
 
-		list_for_each_entry_rcu(old, &subsys->namespaces, dev_link) {
+		list_for_each_entry_rcu(old, &subsys->namespaces, dev_link,
+							subsys_lock_held()) {
 			BUG_ON(ns->nsid == old->nsid);
 			if (ns->nsid < old->nsid)
 				break;
@@ -1172,7 +1176,8 @@ static void nvmet_setup_p2p_ns_map(struct nvmet_ctrl *ctrl,
 
 	ctrl->p2p_client = get_device(req->p2p_client);
 
-	list_for_each_entry_rcu(ns, &ctrl->subsys->namespaces, dev_link)
+	list_for_each_entry_rcu(ns, &ctrl->subsys->namespaces, dev_link,
+							subsys_lock_held())
 		nvmet_p2pmem_ns_add_p2p(ctrl, ns);
 }
 
-- 
2.24.1


_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* [Linux-kernel-mentees] [PATCH] drivers: nvme: target: core: Pass lockdep expression to RCU lists
@ 2020-01-10 13:23 ` Amol Grover
  0 siblings, 0 replies; 12+ messages in thread
From: Amol Grover @ 2020-01-10 13:23 UTC (permalink / raw)
  To: Christoph Hellwig, Sagi Grimberg, Chaitanya Kulkarni
  Cc: Paul E . McKenney, linux-kernel, linux-nvme, Joel Fernandes,
	linux-kernel-mentees

ctrl->subsys->namespaces and subsys->namespaces are traversed with
hlist_for_each_entry_rcu outside an RCU read-side critical section
but under the protection of subsys->lock.

Hence, add the corresponding lockdep expression to the list traversal
primitive to silence false-positive lockdep warnings, and
harden RCU lists.

Add macro for the corresponding lockdep expression to make the code
clean and concise.

Signed-off-by: Amol Grover <frextrite@gmail.com>
---
 drivers/nvme/target/core.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index 28438b833c1b..7caab4ba6a04 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -15,6 +15,9 @@
 
 #include "nvmet.h"
 
+#define subsys_lock_held() \
+	lockdep_is_held(&subsys->lock)
+
 struct workqueue_struct *buffered_io_wq;
 static const struct nvmet_fabrics_ops *nvmet_transports[NVMF_TRTYPE_MAX];
 static DEFINE_IDA(cntlid_ida);
@@ -555,7 +558,8 @@ int nvmet_ns_enable(struct nvmet_ns *ns)
 	} else {
 		struct nvmet_ns *old;
 
-		list_for_each_entry_rcu(old, &subsys->namespaces, dev_link) {
+		list_for_each_entry_rcu(old, &subsys->namespaces, dev_link,
+							subsys_lock_held()) {
 			BUG_ON(ns->nsid == old->nsid);
 			if (ns->nsid < old->nsid)
 				break;
@@ -1172,7 +1176,8 @@ static void nvmet_setup_p2p_ns_map(struct nvmet_ctrl *ctrl,
 
 	ctrl->p2p_client = get_device(req->p2p_client);
 
-	list_for_each_entry_rcu(ns, &ctrl->subsys->namespaces, dev_link)
+	list_for_each_entry_rcu(ns, &ctrl->subsys->namespaces, dev_link,
+							subsys_lock_held())
 		nvmet_p2pmem_ns_add_p2p(ctrl, ns);
 }
 
-- 
2.24.1

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

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

* Re: [PATCH] drivers: nvme: target: core: Pass lockdep expression to RCU lists
  2020-01-10 13:23 ` Amol Grover
  (?)
@ 2020-01-10 15:47   ` Joel Fernandes
  -1 siblings, 0 replies; 12+ messages in thread
From: Joel Fernandes @ 2020-01-10 15:47 UTC (permalink / raw)
  To: Amol Grover
  Cc: Christoph Hellwig, Sagi Grimberg, Chaitanya Kulkarni, linux-nvme,
	linux-kernel, linux-kernel-mentees, Madhuparna Bhowmik,
	Paul E . McKenney

On Fri, Jan 10, 2020 at 06:53:58PM +0530, Amol Grover wrote:
> ctrl->subsys->namespaces and subsys->namespaces are traversed with
> hlist_for_each_entry_rcu outside an RCU read-side critical section
> but under the protection of subsys->lock.
> 
> Hence, add the corresponding lockdep expression to the list traversal
> primitive to silence false-positive lockdep warnings, and
> harden RCU lists.
> 
> Add macro for the corresponding lockdep expression to make the code
> clean and concise.

Amol, thanks. Could you fix this checkpatch warnings? hint: Use --fix-inplace

CHECK: Alignment should match open parenthesis
#50: FILE: drivers/nvme/target/core.c:562:
+               list_for_each_entry_rcu(old, &subsys->namespaces, dev_link,
+                                                       subsys_lock_held()) {

CHECK: Alignment should match open parenthesis
#60: FILE: drivers/nvme/target/core.c:1180:
+       list_for_each_entry_rcu(ns, &ctrl->subsys->namespaces, dev_link,
+                                                       subsys_lock_held())

Otherwise,

Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>

thanks,

 - Joel


> 
> Signed-off-by: Amol Grover <frextrite@gmail.com>
> ---
>  drivers/nvme/target/core.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
> index 28438b833c1b..7caab4ba6a04 100644
> --- a/drivers/nvme/target/core.c
> +++ b/drivers/nvme/target/core.c
> @@ -15,6 +15,9 @@
>  
>  #include "nvmet.h"
>  
> +#define subsys_lock_held() \
> +	lockdep_is_held(&subsys->lock)
> +
>  struct workqueue_struct *buffered_io_wq;
>  static const struct nvmet_fabrics_ops *nvmet_transports[NVMF_TRTYPE_MAX];
>  static DEFINE_IDA(cntlid_ida);
> @@ -555,7 +558,8 @@ int nvmet_ns_enable(struct nvmet_ns *ns)
>  	} else {
>  		struct nvmet_ns *old;
>  
> -		list_for_each_entry_rcu(old, &subsys->namespaces, dev_link) {
> +		list_for_each_entry_rcu(old, &subsys->namespaces, dev_link,
> +							subsys_lock_held()) {
>  			BUG_ON(ns->nsid == old->nsid);
>  			if (ns->nsid < old->nsid)
>  				break;
> @@ -1172,7 +1176,8 @@ static void nvmet_setup_p2p_ns_map(struct nvmet_ctrl *ctrl,
>  
>  	ctrl->p2p_client = get_device(req->p2p_client);
>  
> -	list_for_each_entry_rcu(ns, &ctrl->subsys->namespaces, dev_link)
> +	list_for_each_entry_rcu(ns, &ctrl->subsys->namespaces, dev_link,
> +							subsys_lock_held())
>  		nvmet_p2pmem_ns_add_p2p(ctrl, ns);
>  }
>  
> -- 
> 2.24.1
> 

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

* Re: [PATCH] drivers: nvme: target: core: Pass lockdep expression to RCU lists
@ 2020-01-10 15:47   ` Joel Fernandes
  0 siblings, 0 replies; 12+ messages in thread
From: Joel Fernandes @ 2020-01-10 15:47 UTC (permalink / raw)
  To: Amol Grover
  Cc: Sagi Grimberg, Chaitanya Kulkarni, Paul E . McKenney,
	linux-kernel, linux-nvme, linux-kernel-mentees,
	Christoph Hellwig, Madhuparna Bhowmik

On Fri, Jan 10, 2020 at 06:53:58PM +0530, Amol Grover wrote:
> ctrl->subsys->namespaces and subsys->namespaces are traversed with
> hlist_for_each_entry_rcu outside an RCU read-side critical section
> but under the protection of subsys->lock.
> 
> Hence, add the corresponding lockdep expression to the list traversal
> primitive to silence false-positive lockdep warnings, and
> harden RCU lists.
> 
> Add macro for the corresponding lockdep expression to make the code
> clean and concise.

Amol, thanks. Could you fix this checkpatch warnings? hint: Use --fix-inplace

CHECK: Alignment should match open parenthesis
#50: FILE: drivers/nvme/target/core.c:562:
+               list_for_each_entry_rcu(old, &subsys->namespaces, dev_link,
+                                                       subsys_lock_held()) {

CHECK: Alignment should match open parenthesis
#60: FILE: drivers/nvme/target/core.c:1180:
+       list_for_each_entry_rcu(ns, &ctrl->subsys->namespaces, dev_link,
+                                                       subsys_lock_held())

Otherwise,

Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>

thanks,

 - Joel


> 
> Signed-off-by: Amol Grover <frextrite@gmail.com>
> ---
>  drivers/nvme/target/core.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
> index 28438b833c1b..7caab4ba6a04 100644
> --- a/drivers/nvme/target/core.c
> +++ b/drivers/nvme/target/core.c
> @@ -15,6 +15,9 @@
>  
>  #include "nvmet.h"
>  
> +#define subsys_lock_held() \
> +	lockdep_is_held(&subsys->lock)
> +
>  struct workqueue_struct *buffered_io_wq;
>  static const struct nvmet_fabrics_ops *nvmet_transports[NVMF_TRTYPE_MAX];
>  static DEFINE_IDA(cntlid_ida);
> @@ -555,7 +558,8 @@ int nvmet_ns_enable(struct nvmet_ns *ns)
>  	} else {
>  		struct nvmet_ns *old;
>  
> -		list_for_each_entry_rcu(old, &subsys->namespaces, dev_link) {
> +		list_for_each_entry_rcu(old, &subsys->namespaces, dev_link,
> +							subsys_lock_held()) {
>  			BUG_ON(ns->nsid == old->nsid);
>  			if (ns->nsid < old->nsid)
>  				break;
> @@ -1172,7 +1176,8 @@ static void nvmet_setup_p2p_ns_map(struct nvmet_ctrl *ctrl,
>  
>  	ctrl->p2p_client = get_device(req->p2p_client);
>  
> -	list_for_each_entry_rcu(ns, &ctrl->subsys->namespaces, dev_link)
> +	list_for_each_entry_rcu(ns, &ctrl->subsys->namespaces, dev_link,
> +							subsys_lock_held())
>  		nvmet_p2pmem_ns_add_p2p(ctrl, ns);
>  }
>  
> -- 
> 2.24.1
> 

_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [Linux-kernel-mentees] [PATCH] drivers: nvme: target: core: Pass lockdep expression to RCU lists
@ 2020-01-10 15:47   ` Joel Fernandes
  0 siblings, 0 replies; 12+ messages in thread
From: Joel Fernandes @ 2020-01-10 15:47 UTC (permalink / raw)
  To: Amol Grover
  Cc: Sagi Grimberg, Chaitanya Kulkarni, Paul E . McKenney,
	linux-kernel, linux-nvme, linux-kernel-mentees,
	Christoph Hellwig

On Fri, Jan 10, 2020 at 06:53:58PM +0530, Amol Grover wrote:
> ctrl->subsys->namespaces and subsys->namespaces are traversed with
> hlist_for_each_entry_rcu outside an RCU read-side critical section
> but under the protection of subsys->lock.
> 
> Hence, add the corresponding lockdep expression to the list traversal
> primitive to silence false-positive lockdep warnings, and
> harden RCU lists.
> 
> Add macro for the corresponding lockdep expression to make the code
> clean and concise.

Amol, thanks. Could you fix this checkpatch warnings? hint: Use --fix-inplace

CHECK: Alignment should match open parenthesis
#50: FILE: drivers/nvme/target/core.c:562:
+               list_for_each_entry_rcu(old, &subsys->namespaces, dev_link,
+                                                       subsys_lock_held()) {

CHECK: Alignment should match open parenthesis
#60: FILE: drivers/nvme/target/core.c:1180:
+       list_for_each_entry_rcu(ns, &ctrl->subsys->namespaces, dev_link,
+                                                       subsys_lock_held())

Otherwise,

Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>

thanks,

 - Joel


> 
> Signed-off-by: Amol Grover <frextrite@gmail.com>
> ---
>  drivers/nvme/target/core.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
> index 28438b833c1b..7caab4ba6a04 100644
> --- a/drivers/nvme/target/core.c
> +++ b/drivers/nvme/target/core.c
> @@ -15,6 +15,9 @@
>  
>  #include "nvmet.h"
>  
> +#define subsys_lock_held() \
> +	lockdep_is_held(&subsys->lock)
> +
>  struct workqueue_struct *buffered_io_wq;
>  static const struct nvmet_fabrics_ops *nvmet_transports[NVMF_TRTYPE_MAX];
>  static DEFINE_IDA(cntlid_ida);
> @@ -555,7 +558,8 @@ int nvmet_ns_enable(struct nvmet_ns *ns)
>  	} else {
>  		struct nvmet_ns *old;
>  
> -		list_for_each_entry_rcu(old, &subsys->namespaces, dev_link) {
> +		list_for_each_entry_rcu(old, &subsys->namespaces, dev_link,
> +							subsys_lock_held()) {
>  			BUG_ON(ns->nsid == old->nsid);
>  			if (ns->nsid < old->nsid)
>  				break;
> @@ -1172,7 +1176,8 @@ static void nvmet_setup_p2p_ns_map(struct nvmet_ctrl *ctrl,
>  
>  	ctrl->p2p_client = get_device(req->p2p_client);
>  
> -	list_for_each_entry_rcu(ns, &ctrl->subsys->namespaces, dev_link)
> +	list_for_each_entry_rcu(ns, &ctrl->subsys->namespaces, dev_link,
> +							subsys_lock_held())
>  		nvmet_p2pmem_ns_add_p2p(ctrl, ns);
>  }
>  
> -- 
> 2.24.1
> 
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

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

* Re: [PATCH] drivers: nvme: target: core: Pass lockdep expression to RCU lists
  2020-01-10 13:23 ` Amol Grover
  (?)
@ 2020-01-10 16:31   ` Keith Busch
  -1 siblings, 0 replies; 12+ messages in thread
From: Keith Busch @ 2020-01-10 16:31 UTC (permalink / raw)
  To: Amol Grover
  Cc: Christoph Hellwig, Sagi Grimberg, Chaitanya Kulkarni, linux-nvme,
	linux-kernel, linux-kernel-mentees, Joel Fernandes,
	Madhuparna Bhowmik, Paul E . McKenney

On Fri, Jan 10, 2020 at 06:53:58PM +0530, Amol Grover wrote:
> +#define subsys_lock_held() \
> +	lockdep_is_held(&subsys->lock)

This macro requires "struct nvmet_subsys *subsys" was previously declared
in the function using it, which isn't obvious when looking at the users. I
don't think that's worth the conciseness.

> @@ -555,7 +558,8 @@ int nvmet_ns_enable(struct nvmet_ns *ns)
>  	} else {
>  		struct nvmet_ns *old;
>  
> -		list_for_each_entry_rcu(old, &subsys->namespaces, dev_link) {
> +		list_for_each_entry_rcu(old, &subsys->namespaces, dev_link,
> +							subsys_lock_held()) {
>  			BUG_ON(ns->nsid == old->nsid);
>  			if (ns->nsid < old->nsid)
>  				break;

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

* Re: [PATCH] drivers: nvme: target: core: Pass lockdep expression to RCU lists
@ 2020-01-10 16:31   ` Keith Busch
  0 siblings, 0 replies; 12+ messages in thread
From: Keith Busch @ 2020-01-10 16:31 UTC (permalink / raw)
  To: Amol Grover
  Cc: Sagi Grimberg, Chaitanya Kulkarni, Paul E . McKenney,
	linux-kernel, linux-nvme, Joel Fernandes, linux-kernel-mentees,
	Christoph Hellwig, Madhuparna Bhowmik

On Fri, Jan 10, 2020 at 06:53:58PM +0530, Amol Grover wrote:
> +#define subsys_lock_held() \
> +	lockdep_is_held(&subsys->lock)

This macro requires "struct nvmet_subsys *subsys" was previously declared
in the function using it, which isn't obvious when looking at the users. I
don't think that's worth the conciseness.

> @@ -555,7 +558,8 @@ int nvmet_ns_enable(struct nvmet_ns *ns)
>  	} else {
>  		struct nvmet_ns *old;
>  
> -		list_for_each_entry_rcu(old, &subsys->namespaces, dev_link) {
> +		list_for_each_entry_rcu(old, &subsys->namespaces, dev_link,
> +							subsys_lock_held()) {
>  			BUG_ON(ns->nsid == old->nsid);
>  			if (ns->nsid < old->nsid)
>  				break;

_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [Linux-kernel-mentees] [PATCH] drivers: nvme: target: core: Pass lockdep expression to RCU lists
@ 2020-01-10 16:31   ` Keith Busch
  0 siblings, 0 replies; 12+ messages in thread
From: Keith Busch @ 2020-01-10 16:31 UTC (permalink / raw)
  To: Amol Grover
  Cc: Sagi Grimberg, Chaitanya Kulkarni, Paul E . McKenney,
	linux-kernel, linux-nvme, Joel Fernandes, linux-kernel-mentees,
	Christoph Hellwig

On Fri, Jan 10, 2020 at 06:53:58PM +0530, Amol Grover wrote:
> +#define subsys_lock_held() \
> +	lockdep_is_held(&subsys->lock)

This macro requires "struct nvmet_subsys *subsys" was previously declared
in the function using it, which isn't obvious when looking at the users. I
don't think that's worth the conciseness.

> @@ -555,7 +558,8 @@ int nvmet_ns_enable(struct nvmet_ns *ns)
>  	} else {
>  		struct nvmet_ns *old;
>  
> -		list_for_each_entry_rcu(old, &subsys->namespaces, dev_link) {
> +		list_for_each_entry_rcu(old, &subsys->namespaces, dev_link,
> +							subsys_lock_held()) {
>  			BUG_ON(ns->nsid == old->nsid);
>  			if (ns->nsid < old->nsid)
>  				break;
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

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

* Re: [PATCH] drivers: nvme: target: core: Pass lockdep expression to RCU lists
  2020-01-10 16:31   ` Keith Busch
  (?)
@ 2020-01-10 17:10     ` Amol Grover
  -1 siblings, 0 replies; 12+ messages in thread
From: Amol Grover @ 2020-01-10 17:10 UTC (permalink / raw)
  To: Keith Busch
  Cc: Christoph Hellwig, Sagi Grimberg, Chaitanya Kulkarni, linux-nvme,
	linux-kernel, linux-kernel-mentees, Joel Fernandes,
	Madhuparna Bhowmik, Paul E . McKenney

On Sat, Jan 11, 2020 at 01:31:34AM +0900, Keith Busch wrote:
> On Fri, Jan 10, 2020 at 06:53:58PM +0530, Amol Grover wrote:
> > +#define subsys_lock_held() \
> > +	lockdep_is_held(&subsys->lock)
> 
> This macro requires "struct nvmet_subsys *subsys" was previously declared
> in the function using it, which isn't obvious when looking at the users. I
> don't think that's worth the conciseness.
> 

Hey Keith,
If I understand correctly, you're saying `*subsys` is always declared in the
function using it, right? I too think, this could cause confusion to the person
going through the code, I'll fix it right away.

Thanks
Amol

> > @@ -555,7 +558,8 @@ int nvmet_ns_enable(struct nvmet_ns *ns)
> >  	} else {
> >  		struct nvmet_ns *old;
> >  
> > -		list_for_each_entry_rcu(old, &subsys->namespaces, dev_link) {
> > +		list_for_each_entry_rcu(old, &subsys->namespaces, dev_link,
> > +							subsys_lock_held()) {
> >  			BUG_ON(ns->nsid == old->nsid);
> >  			if (ns->nsid < old->nsid)
> >  				break;

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

* Re: [PATCH] drivers: nvme: target: core: Pass lockdep expression to RCU lists
@ 2020-01-10 17:10     ` Amol Grover
  0 siblings, 0 replies; 12+ messages in thread
From: Amol Grover @ 2020-01-10 17:10 UTC (permalink / raw)
  To: Keith Busch
  Cc: Sagi Grimberg, Chaitanya Kulkarni, Paul E . McKenney,
	linux-kernel, linux-nvme, Joel Fernandes, linux-kernel-mentees,
	Christoph Hellwig, Madhuparna Bhowmik

On Sat, Jan 11, 2020 at 01:31:34AM +0900, Keith Busch wrote:
> On Fri, Jan 10, 2020 at 06:53:58PM +0530, Amol Grover wrote:
> > +#define subsys_lock_held() \
> > +	lockdep_is_held(&subsys->lock)
> 
> This macro requires "struct nvmet_subsys *subsys" was previously declared
> in the function using it, which isn't obvious when looking at the users. I
> don't think that's worth the conciseness.
> 

Hey Keith,
If I understand correctly, you're saying `*subsys` is always declared in the
function using it, right? I too think, this could cause confusion to the person
going through the code, I'll fix it right away.

Thanks
Amol

> > @@ -555,7 +558,8 @@ int nvmet_ns_enable(struct nvmet_ns *ns)
> >  	} else {
> >  		struct nvmet_ns *old;
> >  
> > -		list_for_each_entry_rcu(old, &subsys->namespaces, dev_link) {
> > +		list_for_each_entry_rcu(old, &subsys->namespaces, dev_link,
> > +							subsys_lock_held()) {
> >  			BUG_ON(ns->nsid == old->nsid);
> >  			if (ns->nsid < old->nsid)
> >  				break;

_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [Linux-kernel-mentees] [PATCH] drivers: nvme: target: core: Pass lockdep expression to RCU lists
@ 2020-01-10 17:10     ` Amol Grover
  0 siblings, 0 replies; 12+ messages in thread
From: Amol Grover @ 2020-01-10 17:10 UTC (permalink / raw)
  To: Keith Busch
  Cc: Sagi Grimberg, Chaitanya Kulkarni, Paul E . McKenney,
	linux-kernel, linux-nvme, Joel Fernandes, linux-kernel-mentees,
	Christoph Hellwig

On Sat, Jan 11, 2020 at 01:31:34AM +0900, Keith Busch wrote:
> On Fri, Jan 10, 2020 at 06:53:58PM +0530, Amol Grover wrote:
> > +#define subsys_lock_held() \
> > +	lockdep_is_held(&subsys->lock)
> 
> This macro requires "struct nvmet_subsys *subsys" was previously declared
> in the function using it, which isn't obvious when looking at the users. I
> don't think that's worth the conciseness.
> 

Hey Keith,
If I understand correctly, you're saying `*subsys` is always declared in the
function using it, right? I too think, this could cause confusion to the person
going through the code, I'll fix it right away.

Thanks
Amol

> > @@ -555,7 +558,8 @@ int nvmet_ns_enable(struct nvmet_ns *ns)
> >  	} else {
> >  		struct nvmet_ns *old;
> >  
> > -		list_for_each_entry_rcu(old, &subsys->namespaces, dev_link) {
> > +		list_for_each_entry_rcu(old, &subsys->namespaces, dev_link,
> > +							subsys_lock_held()) {
> >  			BUG_ON(ns->nsid == old->nsid);
> >  			if (ns->nsid < old->nsid)
> >  				break;
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

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

end of thread, other threads:[~2020-01-10 17:10 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-10 13:23 [PATCH] drivers: nvme: target: core: Pass lockdep expression to RCU lists Amol Grover
2020-01-10 13:23 ` [Linux-kernel-mentees] " Amol Grover
2020-01-10 13:23 ` Amol Grover
2020-01-10 15:47 ` Joel Fernandes
2020-01-10 15:47   ` [Linux-kernel-mentees] " Joel Fernandes
2020-01-10 15:47   ` Joel Fernandes
2020-01-10 16:31 ` Keith Busch
2020-01-10 16:31   ` [Linux-kernel-mentees] " Keith Busch
2020-01-10 16:31   ` Keith Busch
2020-01-10 17:10   ` Amol Grover
2020-01-10 17:10     ` [Linux-kernel-mentees] " Amol Grover
2020-01-10 17:10     ` Amol Grover

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.