linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] IB/core: Print error when umem fails due to locked memory limit.
@ 2015-10-15 14:21 j.glisse-Re5JQEeQqe8AvxtiuMwx3w
  2015-10-15 16:02 ` Doug Ledford
  0 siblings, 1 reply; 2+ messages in thread
From: j.glisse-Re5JQEeQqe8AvxtiuMwx3w @ 2015-10-15 14:21 UTC (permalink / raw)
  To: linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: Jérôme Glisse, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	Haggai Eran, Sagi Grimberg, Shachar Raindel, Doug Ledford

From: Jérôme Glisse <jglisse-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

It can be rather tedious to find why userspace is failing when only
thing kernel report is -ENOMEM. This add an error message so that
user can figure out why they are getting -ENOMEM.

Signed-off-by: Jérôme Glisse <jglisse-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
cc: <linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Cc: Haggai Eran <haggaie-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Cc: Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Cc: Shachar Raindel <raindel-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Cc: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 drivers/infiniband/core/umem.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
index 38acb3c..a66929e 100644
--- a/drivers/infiniband/core/umem.c
+++ b/drivers/infiniband/core/umem.c
@@ -169,6 +169,7 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr,
 	lock_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT;
 
 	if ((locked > lock_limit) && !capable(CAP_IPC_LOCK)) {
+		pr_err("locked memory quota exhausted (see ulimit -l)\n");
 		ret = -ENOMEM;
 		goto out;
 	}
-- 
1.8.3.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

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

* Re: [PATCH] IB/core: Print error when umem fails due to locked memory limit.
  2015-10-15 14:21 [PATCH] IB/core: Print error when umem fails due to locked memory limit j.glisse-Re5JQEeQqe8AvxtiuMwx3w
@ 2015-10-15 16:02 ` Doug Ledford
  0 siblings, 0 replies; 2+ messages in thread
From: Doug Ledford @ 2015-10-15 16:02 UTC (permalink / raw)
  To: j.glisse, linux-kernel
  Cc: Jérôme Glisse, linux-rdma, Haggai Eran, Sagi Grimberg,
	Shachar Raindel

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

On 10/15/2015 10:21 AM, j.glisse@gmail.com wrote:
> From: Jérôme Glisse <jglisse@redhat.com>
> 
> It can be rather tedious to find why userspace is failing when only
> thing kernel report is -ENOMEM. This add an error message so that
> user can figure out why they are getting -ENOMEM.
> 
> Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
> cc: <linux-rdma@vger.kernel.org>
> Cc: Haggai Eran <haggaie@mellanox.com>
> Cc: Sagi Grimberg <sagig@mellanox.com>
> Cc: Shachar Raindel <raindel@mellanox.com>
> Cc: Doug Ledford <dledford@redhat.com>
> ---
>  drivers/infiniband/core/umem.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
> index 38acb3c..a66929e 100644
> --- a/drivers/infiniband/core/umem.c
> +++ b/drivers/infiniband/core/umem.c
> @@ -169,6 +169,7 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr,
>  	lock_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT;
>  
>  	if ((locked > lock_limit) && !capable(CAP_IPC_LOCK)) {
> +		pr_err("locked memory quota exhausted (see ulimit -l)\n");
>  		ret = -ENOMEM;
>  		goto out;
>  	}
> 

This looks like it could easily cause a flood of messages (possibly even
enough to DoS the machine).  Please convert this to some sort of rate
limited output (preferably, you would issue this warning only once per
task, and the error would include the command name).

-- 
Doug Ledford <dledford@redhat.com>
              GPG KeyID: 0E572FDD



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]

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

end of thread, other threads:[~2015-10-15 16:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-15 14:21 [PATCH] IB/core: Print error when umem fails due to locked memory limit j.glisse-Re5JQEeQqe8AvxtiuMwx3w
2015-10-15 16:02 ` 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).