linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Bart Van Assche <bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
Cc: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>,
	Sagi Grimberg <sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>,
	Laurence Oberman
	<loberman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	"linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH 11/11] IB/srp: Prevent mapping failures
Date: Sun, 24 Apr 2016 11:35:38 +0300	[thread overview]
Message-ID: <20160424083538.GF7974@leon.nu> (raw)
In-Reply-To: <571A94AF.7000609-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>

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

On Fri, Apr 22, 2016 at 02:16:31PM -0700, Bart Van Assche wrote:
> If both max_sectors and the queue_depth are high enough it can
> happen that the MR pool is depleted temporarily. This causes
> the SRP initiator to report mapping failures. Although the SRP
> initiator recovers from such mapping failures, prevent that
> this can happen by limiting max_sectors.
> 
> Reported-by: Laurence Oberman <loberman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> Signed-off-by: Bart Van Assche <bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
> Cc: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
> Cc: Sagi Grimberg <sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
> ---
>  drivers/infiniband/ulp/srp/ib_srp.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
> index a173ec4..ebd4d90 100644
> --- a/drivers/infiniband/ulp/srp/ib_srp.c
> +++ b/drivers/infiniband/ulp/srp/ib_srp.c
> @@ -3172,6 +3172,7 @@ static ssize_t srp_create_target(struct device *dev,
>  	struct srp_device *srp_dev = host->srp_dev;
>  	struct ib_device *ibdev = srp_dev->dev;
>  	int ret, node_idx, node, cpu, i;
> +	unsigned int max_max_sectors;
>  	bool multich = false;
>  
>  	target_host = scsi_host_alloc(&srp_template,
> @@ -3228,6 +3229,25 @@ static ssize_t srp_create_target(struct device *dev,
>  		target->sg_tablesize = target->cmd_sg_cnt;
>  	}
>  
> +	if (srp_dev->use_fast_reg || srp_dev->use_fmr) {
> +		/*
> +		 * FR and FMR can only map one HCA page per entry. If the
> +		 * start address is not aligned on a HCA page boundary two
> +		 * entries will be used for the head and the tail although
> +		 * these two entries combined contain at most one HCA page of
> +		 * data. Hence the "- 1" in the calculation below.
> +		 */
> +		max_max_sectors = (srp_dev->max_pages_per_mr - 1) <<
> +				  (ilog2(srp_dev->mr_page_size) - 9);

From my understanding, srp_dev->max_pages_per_mr can be equal to 1, in
case device will advertise it.

Is this understanding correct?
Will the code work in such case?

> +		if (target->scsi_host->max_sectors > max_max_sectors) {
> +			shost_printk(KERN_WARNING, target->scsi_host,
> +				     PFX "Reducing max_sectors from %d to %d\n",
> +				     target->scsi_host->max_sectors,
> +				     max_max_sectors);
> +			target->scsi_host->max_sectors = max_max_sectors;
> +		}
> +	}
> +
>  	target_host->sg_tablesize = target->sg_tablesize;
>  	target->mr_pool_size = target->scsi_host->can_queue;
>  	target->indirect_size = target->sg_tablesize *
> -- 
> 2.8.1
> 
> --
> 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

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2016-04-24  8:35 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-22 21:11 [PATCH 0/11] More SRP patches for kernel v4.7 Bart Van Assche
     [not found] ` <571A936F.7040409-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-04-22 21:12   ` [PATCH 01/11] IB/srp: Fix a spelling error in a source code comment Bart Van Assche
     [not found]     ` <571A93AA.9000605-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-05-03  9:26       ` Christoph Hellwig
2016-04-22 21:12   ` [PATCH 02/11] IB/srp: Fix a comment Bart Van Assche
     [not found]     ` <571A93CF.9050506-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-04-26 20:52       ` Sagi Grimberg
2016-05-03  9:26       ` Christoph Hellwig
2016-04-22 21:13   ` [PATCH 03/11] IB/srp: Document srp_map_data() return value Bart Van Assche
     [not found]     ` <571A93E5.7030807-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-05-03  9:27       ` Christoph Hellwig
2016-04-22 21:13   ` [PATCH 04/11] IB/srp: Fix srp_map_data() error paths Bart Van Assche
     [not found]     ` <571A93FF.8020102-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-04-26 20:53       ` Sagi Grimberg
2016-05-03  9:28       ` Christoph Hellwig
2016-04-22 21:13   ` [PATCH 05/11] IB/srp: Introduce target->mr_pool_size Bart Van Assche
     [not found]     ` <571A9415.4090002-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-05-03  9:28       ` Christoph Hellwig
2016-04-22 21:14   ` [PATCH 06/11] IB/srp: Avoid that mapping failure triggers an infinite loop Bart Van Assche
     [not found]     ` <571A9427.8010306-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-05-03  9:29       ` Christoph Hellwig
2016-04-22 21:14   ` [PATCH 07/11] IB/srp: Move code out of a loop Bart Van Assche
     [not found]     ` <571A9443.6000600-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-04-26 21:00       ` Sagi Grimberg
2016-05-03  9:29       ` Christoph Hellwig
2016-04-22 21:15   ` [PATCH 08/11] IB/srp: Move common code into the caller Bart Van Assche
     [not found]     ` <571A9458.3050904-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-04-26 21:00       ` Sagi Grimberg
2016-05-03  9:29       ` Christoph Hellwig
2016-04-22 21:15   ` [PATCH 09/11] IB/srp: Fix a NULL pointer dereference Bart Van Assche
     [not found]     ` <571A9472.5050202-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-04-26 21:04       ` Sagi Grimberg
     [not found]         ` <571FD7F4.4090006-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
2016-04-27  6:20           ` Leon Romanovsky
     [not found]             ` <20160427062053.GK7974-2ukJVAZIZ/Y@public.gmane.org>
2016-04-27 14:22               ` Bart Van Assche
2016-04-27 15:39               ` Bart Van Assche
2016-04-27 19:50           ` Bart Van Assche
2016-05-03  9:30       ` Christoph Hellwig
     [not found]         ` <20160503093032.GJ19931-jcswGhMUV9g@public.gmane.org>
2016-05-03 20:57           ` Bart Van Assche
     [not found]             ` <5729109E.6040500-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-05-03 21:01               ` Laurence Oberman
2016-04-22 21:16   ` [PATCH 10/11] IB/srp: Do not register memory if register_always = -1 Bart Van Assche
     [not found]     ` <571A9490.9010003-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-05-03  9:30       ` Christoph Hellwig
2016-04-22 21:16   ` [PATCH 11/11] IB/srp: Prevent mapping failures Bart Van Assche
     [not found]     ` <571A94AF.7000609-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-04-23 22:12       ` Laurence Oberman
2016-04-24  8:35       ` Leon Romanovsky [this message]
     [not found]         ` <20160424083538.GF7974-2ukJVAZIZ/Y@public.gmane.org>
2016-04-24 22:44           ` Laurence Oberman
2016-04-25  0:48           ` Bart Van Assche
     [not found]             ` <571D6975.2020905-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-04-25  5:54               ` Leon Romanovsky
     [not found]                 ` <20160425055433.GG7974-2ukJVAZIZ/Y@public.gmane.org>
2016-04-25  9:46                   ` Sagi Grimberg
     [not found]                     ` <571DE793.6090705-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
2016-04-25 15:53                       ` Leon Romanovsky
     [not found]                         ` <20160425155320.GH7974-2ukJVAZIZ/Y@public.gmane.org>
2016-04-25 16:16                           ` Bart Van Assche
     [not found]                             ` <571E42D2.70705-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-04-26 14:12                               ` Leon Romanovsky
     [not found]                                 ` <20160426141229.GI7974-2ukJVAZIZ/Y@public.gmane.org>
2016-04-26 21:08                                   ` Sagi Grimberg
     [not found]                                     ` <571FD8D3.1060403-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
2016-04-26 23:10                                       ` Bart Van Assche
2016-04-26 21:06       ` Sagi Grimberg
2016-05-03  9:33       ` Christoph Hellwig
     [not found]         ` <20160503093307.GL19931-jcswGhMUV9g@public.gmane.org>
2016-05-03 21:13           ` Bart Van Assche
     [not found]             ` <5729147C.5000904-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-05-03 21:23               ` Laurence Oberman
2016-05-04  9:09               ` Christoph Hellwig
     [not found]                 ` <20160504090908.GA14787-jcswGhMUV9g@public.gmane.org>
2016-05-04 16:17                   ` Bart Van Assche
2016-05-04 23:44           ` Bart Van Assche
     [not found]             ` <572A8975.9060606-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-05-05 14:06               ` Christoph Hellwig
     [not found]                 ` <20160505140616.GA15000-jcswGhMUV9g@public.gmane.org>
2016-05-05 19:50                   ` Bart Van Assche
2016-05-05 19:58                   ` Laurence Oberman
     [not found]                     ` <2102017158.34060891.1462478304470.JavaMail.zimbra-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-05 20:14                       ` Bart Van Assche
     [not found]                         ` <572BA98F.4090109-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-05-05 20:17                           ` Bart Van Assche
     [not found]                             ` <572BAA6F.1060607-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-05-05 20:55                               ` Laurence Oberman
     [not found]                                 ` <804753248.34153510.1462481756460.JavaMail.zimbra-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-05 21:40                                   ` Bart Van Assche
     [not found]                                     ` <572BBDC0.5070205-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-05-05 22:01                                       ` Laurence Oberman
     [not found]                                         ` <1133135399.34245490.1462485666601.JavaMail.zimbra-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-05 22:46                                           ` Bart Van Assche
     [not found]                                             ` <572BCD59.7010701-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-05-09 22:50                                               ` Laurence Oberman
     [not found]                                                 ` <169904890.34764265.1462834206901.JavaMail.zimbra-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-09 22:55                                                   ` Bart Van Assche
2016-05-05 20:44   ` [PATCH 0/11] More SRP patches for kernel v4.7 Doug Ledford
     [not found]     ` <f406cd39-c6dc-d458-0ab0-c400fdd5b243-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-05 20:50       ` Bart Van Assche

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160424083538.GF7974@leon.nu \
    --to=leon-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=hch-jcswGhMUV9g@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=loberman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).