public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <Bart.VanAssche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
To: "maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org"
	<maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	"linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Cc: "israelr-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org"
	<israelr-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: Re: [PATCHv1 1/1] IB/srp: fix invalid indirect_sg_entries parameter value
Date: Tue, 3 Jan 2017 17:59:49 +0000	[thread overview]
Message-ID: <1483466372.16249.1.camel@sandisk.com> (raw)
In-Reply-To: <1483451474-8096-1-git-send-email-maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

On Tue, 2017-01-03 at 15:51 +0200, Max Gurtovoy wrote:
> From: Israel Rukshin <israelr@mellanox.com>
> 
> After setting indirect_sg_entries module_param to huge value (e.g 500,000),
> srp_alloc_req_data() fails to allocate indirect descriptors for the request
> ring (kmalloc fails). This commit enforces the maximum value of indirect_sg_entries
> to be SG_MAX_SEGMENTS as signified in module param description.
> 
> Signed-off-by: Israel Rukshin <israelr@mellanox.com>
> Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
> ---
>  drivers/infiniband/ulp/srp/ib_srp.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
> index 0f67cf9..ccdd2c2 100644
> --- a/drivers/infiniband/ulp/srp/ib_srp.c
> +++ b/drivers/infiniband/ulp/srp/ib_srp.c
> @@ -3676,6 +3676,7 @@ static struct srp_function_template ib_srp_transport_functions = {
>  static int __init srp_init_module(void)
>  {
>  	int ret;
> +	unsigned int max_indirect_sg_entries = SG_MAX_SEGMENTS;
>  
>  	if (srp_sg_tablesize) {
>  		pr_warn("srp_sg_tablesize is deprecated, please use cmd_sg_entries\n");
> @@ -3699,6 +3700,12 @@ static int __init srp_init_module(void)
>  		indirect_sg_entries = cmd_sg_entries;
>  	}
>  
> +	if (indirect_sg_entries > max_indirect_sg_entries) {
> +		pr_warn("Clamping indirect_sg_entries to %u\n",
> +			max_indirect_sg_entries);
> +		indirect_sg_entries = max_indirect_sg_entries;
> +	}
> +
>  	srp_remove_wq = create_workqueue("srp_remove");
>  	if (!srp_remove_wq) {
>  		ret = -ENOMEM;

Hello Max,

That's a good catch, but why has the max_indirect_sg_entries variable been
introduced? Can it be left out?

Thanks,

Bart.

  parent reply	other threads:[~2017-01-03 17:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-03 13:51 [PATCHv1 1/1] IB/srp: fix invalid indirect_sg_entries parameter value Max Gurtovoy
     [not found] ` <1483451474-8096-1-git-send-email-maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2017-01-03 17:59   ` Bart Van Assche [this message]
     [not found]     ` <1483466372.16249.1.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-03 19:05       ` Laurence Oberman
  -- strict thread matches above, loose matches on Subject: below --
2017-01-03 13:45 [PATCH 0/1 v2] ib_srp mr allocation failure Max Gurtovoy
     [not found] ` <1483451133-6308-1-git-send-email-maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2017-01-03 13:45   ` [PATCHv1 1/1] IB/srp: fix invalid indirect_sg_entries parameter value Max Gurtovoy

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=1483466372.16249.1.camel@sandisk.com \
    --to=bart.vanassche-xdaiopvojttbdgjk7y7tuq@public.gmane.org \
    --cc=israelr-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=maxg-VPRAkNaXOzVWk0Htik3J/w@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