From patchwork Thu Dec 20 10:05:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuval Shaia X-Patchwork-Id: 10738739 X-Patchwork-Delegate: jgg@ziepe.ca Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 10D0A14E2 for ; Thu, 20 Dec 2018 10:05:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F334428745 for ; Thu, 20 Dec 2018 10:05:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E67292874A; Thu, 20 Dec 2018 10:05:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A313028745 for ; Thu, 20 Dec 2018 10:05:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729723AbeLTKFu (ORCPT ); Thu, 20 Dec 2018 05:05:50 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:46696 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728687AbeLTKFu (ORCPT ); Thu, 20 Dec 2018 05:05:50 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wBK9wmhU019523; Thu, 20 Dec 2018 10:05:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : mime-version : content-transfer-encoding; s=corp-2018-07-02; bh=488T4I6RrbTs9SnFTQxjxtiHXpr84vk6fspSrgpPH/U=; b=HxGOa909pVECgcpclqkPYbli2mfb3SrBNNhCgkiuG/zRVMVsb5367MbFpyJ3NfT2tbN8 nunnNJUkBexmHZjuLOtGTTwDOuPkkdogdwolGEldKBWP6iJSGCg98N6nIkqDpcSqzYlZ hk+SMryIbMEeo11QCHArOKejjU7L3qgUtLdy712FUK2U23aayA8Lz5L5PAONkw1kILa9 TA4MIrg6jU63Ss9jv3ep32fmGgGr4vd9ciyPzyZ+UC484qIcQqH3ZudaIohunaMr8wgv ZaZGbeY1mxjoxesZMaO34I8aX2c+AcUrZWChg7CF020LU/8N3nUNRrXI+9DGkWhS7Bkf Vw== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2130.oracle.com with ESMTP id 2pfh3a6dmh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Dec 2018 10:05:42 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id wBKA5fKL016447 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Dec 2018 10:05:41 GMT Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id wBKA5fcj012810; Thu, 20 Dec 2018 10:05:41 GMT Received: from lap1.nl.oracle.com (/10.175.19.37) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 20 Dec 2018 02:05:40 -0800 From: Yuval Shaia To: dledford@redhat.com, jgg@ziepe.ca, leon@kernel.org, yuval.shaia@oracle.com, jackm@dev.mellanox.co.il, parav@mellanox.com, linux-rdma@vger.kernel.org Subject: [PATCH v2] IB/core: Warn if can't pin memory Date: Thu, 20 Dec 2018 12:05:31 +0200 Message-Id: <20181220100531.7755-1-yuval.shaia@oracle.com> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9112 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812200083 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When memory registration is needed for page count which exceeds the allowed lock limit the function exits with an error but no error is printed. Since this is a case that system administrator can fix (rlimit etc) we need to give an alert. This is not a data patch so performance penalty is not a consideration. Signed-off-by: Yuval Shaia --- v0 -> v1: * Accept Leon's comment pr_err to pr_err_ratelimited v1 -> v2: * Comments from Gal (d -> lu, _func__ -> __func__) --- drivers/infiniband/core/umem.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c index c6144df47ea4..d6a66bd4f55a 100644 --- a/drivers/infiniband/core/umem.c +++ b/drivers/infiniband/core/umem.c @@ -164,6 +164,8 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr, if (check_add_overflow(mm->pinned_vm, npages, &new_pinned) || (new_pinned > lock_limit && !capable(CAP_IPC_LOCK))) { up_write(&mm->mmap_sem); + pr_err_ratelimited("%s: Can't pin memory, requested %lu, limit %lu, ipc_lock off\n", + __func__, new_pinned, lock_limit); ret = -ENOMEM; goto out; }