linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/1 v2] ib_srp mr allocation failure
@ 2016-12-28 10:48 Max Gurtovoy
       [not found] ` <1482922108-3243-1-git-send-email-maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Max Gurtovoy @ 2016-12-28 10:48 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA, bvanassche-HInyCGIudOg,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: Israel Rukshin

From: Israel Rukshin <israelr-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Changes from v1:
	- added "Fixes:"
	- Cc'ed stable kernel 4.7+

Israel Rukshin (1):
  IB/srp: fix mr allocation when the device supports sg gaps

 drivers/infiniband/ulp/srp/ib_srp.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

-- 
1.8.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 1/1 v2] IB/srp: fix mr allocation when the device supports sg gaps
       [not found] ` <1482922108-3243-1-git-send-email-maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
@ 2016-12-28 10:48   ` Max Gurtovoy
       [not found]     ` <1482922108-3243-2-git-send-email-maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Max Gurtovoy @ 2016-12-28 10:48 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA, bvanassche-HInyCGIudOg,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: Israel Rukshin, Max Gurtovoy

From: Israel Rukshin <israelr-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

If the device support arbitrary sg list mapping (device cap
IB_DEVICE_SG_GAPS_REG set) we allocate the memory regions with
IB_MR_TYPE_SG_GAPS.

Fixes: 509c5f33f4f6 ("IB/srp: Prevent mapping failures")
Cc: <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>        [4.7+]
Signed-off-by: Israel Rukshin <israelr-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Max Gurtovoy <maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Reviewed-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Reviewed-by: Mark Bloch <markb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 drivers/infiniband/ulp/srp/ib_srp.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 8ddc071..0f67cf9 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -371,6 +371,7 @@ static struct srp_fr_pool *srp_create_fr_pool(struct ib_device *device,
 	struct srp_fr_desc *d;
 	struct ib_mr *mr;
 	int i, ret = -EINVAL;
+	enum ib_mr_type mr_type;
 
 	if (pool_size <= 0)
 		goto err;
@@ -384,9 +385,13 @@ static struct srp_fr_pool *srp_create_fr_pool(struct ib_device *device,
 	spin_lock_init(&pool->lock);
 	INIT_LIST_HEAD(&pool->free_list);
 
+	if (device->attrs.device_cap_flags & IB_DEVICE_SG_GAPS_REG)
+		mr_type = IB_MR_TYPE_SG_GAPS;
+	else
+		mr_type = IB_MR_TYPE_MEM_REG;
+
 	for (i = 0, d = &pool->desc[0]; i < pool->size; i++, d++) {
-		mr = ib_alloc_mr(pd, IB_MR_TYPE_MEM_REG,
-				 max_page_list_len);
+		mr = ib_alloc_mr(pd, mr_type, max_page_list_len);
 		if (IS_ERR(mr)) {
 			ret = PTR_ERR(mr);
 			if (ret == -ENOMEM)
-- 
1.8.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 1/1 v2] IB/srp: fix mr allocation when the device supports sg gaps
       [not found]     ` <1482922108-3243-2-git-send-email-maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
@ 2016-12-28 11:25       ` Yuval Shaia
  2017-01-02  8:40       ` Bart Van Assche
  2017-01-24 16:04       ` Doug Ledford
  2 siblings, 0 replies; 5+ messages in thread
From: Yuval Shaia @ 2016-12-28 11:25 UTC (permalink / raw)
  To: Max Gurtovoy
  Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA, bvanassche-HInyCGIudOg,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, Israel Rukshin

Reviewed-by: Yuval Shaia <yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>

On Wed, Dec 28, 2016 at 12:48:28PM +0200, Max Gurtovoy wrote:
> From: Israel Rukshin <israelr-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> 
> If the device support arbitrary sg list mapping (device cap
> IB_DEVICE_SG_GAPS_REG set) we allocate the memory regions with
> IB_MR_TYPE_SG_GAPS.
> 
> Fixes: 509c5f33f4f6 ("IB/srp: Prevent mapping failures")
> Cc: <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>        [4.7+]
> Signed-off-by: Israel Rukshin <israelr-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Signed-off-by: Max Gurtovoy <maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Reviewed-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Reviewed-by: Mark Bloch <markb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> ---
>  drivers/infiniband/ulp/srp/ib_srp.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
> index 8ddc071..0f67cf9 100644
> --- a/drivers/infiniband/ulp/srp/ib_srp.c
> +++ b/drivers/infiniband/ulp/srp/ib_srp.c
> @@ -371,6 +371,7 @@ static struct srp_fr_pool *srp_create_fr_pool(struct ib_device *device,
>  	struct srp_fr_desc *d;
>  	struct ib_mr *mr;
>  	int i, ret = -EINVAL;
> +	enum ib_mr_type mr_type;
>  
>  	if (pool_size <= 0)
>  		goto err;
> @@ -384,9 +385,13 @@ static struct srp_fr_pool *srp_create_fr_pool(struct ib_device *device,
>  	spin_lock_init(&pool->lock);
>  	INIT_LIST_HEAD(&pool->free_list);
>  
> +	if (device->attrs.device_cap_flags & IB_DEVICE_SG_GAPS_REG)
> +		mr_type = IB_MR_TYPE_SG_GAPS;
> +	else
> +		mr_type = IB_MR_TYPE_MEM_REG;
> +
>  	for (i = 0, d = &pool->desc[0]; i < pool->size; i++, d++) {
> -		mr = ib_alloc_mr(pd, IB_MR_TYPE_MEM_REG,
> -				 max_page_list_len);
> +		mr = ib_alloc_mr(pd, mr_type, max_page_list_len);
>  		if (IS_ERR(mr)) {
>  			ret = PTR_ERR(mr);
>  			if (ret == -ENOMEM)
> -- 
> 1.8.4.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 1/1 v2] IB/srp: fix mr allocation when the device supports sg gaps
       [not found]     ` <1482922108-3243-2-git-send-email-maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  2016-12-28 11:25       ` Yuval Shaia
@ 2017-01-02  8:40       ` Bart Van Assche
  2017-01-24 16:04       ` Doug Ledford
  2 siblings, 0 replies; 5+ messages in thread
From: Bart Van Assche @ 2017-01-02  8:40 UTC (permalink / raw)
  To: maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
  Cc: israelr-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 400 bytes --]

On Wed, 2016-12-28 at 12:48 +0200, Max Gurtovoy wrote:
> If the device support arbitrary sg list mapping (device cap
> IB_DEVICE_SG_GAPS_REG set) we allocate the memory regions with
> IB_MR_TYPE_SG_GAPS.

Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>N‹§²æìr¸›yúèšØb²X¬¶Ç§vØ^–)Þº{.nÇ+‰·¥Š{±­ÙšŠ{ayº\x1dʇڙë,j\a­¢f£¢·hš‹»öì\x17/oSc¾™Ú³9˜uÀ¦æå‰È&jw¨®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿïêäz¹Þ–Šàþf£¢·hšˆ§~ˆmš

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

* Re: [PATCH 1/1 v2] IB/srp: fix mr allocation when the device supports sg gaps
       [not found]     ` <1482922108-3243-2-git-send-email-maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  2016-12-28 11:25       ` Yuval Shaia
  2017-01-02  8:40       ` Bart Van Assche
@ 2017-01-24 16:04       ` Doug Ledford
  2 siblings, 0 replies; 5+ messages in thread
From: Doug Ledford @ 2017-01-24 16:04 UTC (permalink / raw)
  To: Max Gurtovoy, bvanassche-HInyCGIudOg,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: Israel Rukshin

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

On Wed, 2016-12-28 at 12:48 +0200, Max Gurtovoy wrote:
> From: Israel Rukshin <israelr-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> 
> If the device support arbitrary sg list mapping (device cap
> IB_DEVICE_SG_GAPS_REG set) we allocate the memory regions with
> IB_MR_TYPE_SG_GAPS.
> 
> Fixes: 509c5f33f4f6 ("IB/srp: Prevent mapping failures")
> Cc: <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>        [4.7+]
> Signed-off-by: Israel Rukshin <israelr-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Signed-off-by: Max Gurtovoy <maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Reviewed-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Reviewed-by: Mark Bloch <markb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> 

The v2 version of this patch has been applied, thanks.

-- 
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
    GPG KeyID: B826A3330E572FDD
   
Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2017-01-24 16:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-28 10:48 [PATCH 0/1 v2] ib_srp mr allocation failure Max Gurtovoy
     [not found] ` <1482922108-3243-1-git-send-email-maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-12-28 10:48   ` [PATCH 1/1 v2] IB/srp: fix mr allocation when the device supports sg gaps Max Gurtovoy
     [not found]     ` <1482922108-3243-2-git-send-email-maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-12-28 11:25       ` Yuval Shaia
2017-01-02  8:40       ` Bart Van Assche
2017-01-24 16:04       ` Doug Ledford

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