From patchwork Fri Jul 29 04:58:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roland Dreier X-Patchwork-Id: 9252071 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6F882601C0 for ; Fri, 29 Jul 2016 04:58:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A38727F17 for ; Fri, 29 Jul 2016 04:58:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D61E27F8C; Fri, 29 Jul 2016 04:58:55 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 A471127F17 for ; Fri, 29 Jul 2016 04:58:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750835AbcG2E6u (ORCPT ); Fri, 29 Jul 2016 00:58:50 -0400 Received: from mail-pf0-f182.google.com ([209.85.192.182]:34622 "EHLO mail-pf0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750822AbcG2E6t (ORCPT ); Fri, 29 Jul 2016 00:58:49 -0400 Received: by mail-pf0-f182.google.com with SMTP id p64so28873812pfb.1 for ; Thu, 28 Jul 2016 21:58:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google; h=sender:from:to:cc:subject:date:message-id; bh=EfALfNB4rHJEZU37yonor3ywf45SQ8MMHpWPjjiwX+g=; b=O/p4ARrtF7nd5P8sARJpqwY0Kl7pFeemlZYPCrNy/1TGcJfmAkr4fqtQVEOkppkE1b 3q/ofoNkq9+D8p7Xdrak0mnb4aeNTeMKqll0wwCC7lnfoBLJrQV9eitc0mGMkBb0ZM7B 6q2fjQcY4HiQv60E1g4NAJYZc0sWQNfJ0edQQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=EfALfNB4rHJEZU37yonor3ywf45SQ8MMHpWPjjiwX+g=; b=Z9dQGXEqvqVDGcHrdnsvMrKIlofN6yAaJjSrrLpkaKnWZFD08CXPKCP/zGv+bQSa9g eDRTfuIUh7yUpAxPCs1IKiPu44NRd7BAosvyuorCXBXqstk6fiuc1J8iwcjR2UoKj6my tCnte+OInq6YMnVh+9ZHdArbL8tY8yxFAa4ecK90K0YQbV4I1sLTYDTlCK8YVUJzqg7L oJbZmUSzYQL4Tr1cZquHsVA6bCEozas8PT5BMOuhoLZboEmIWk8/gKsFBivmARerCW8R d7O/76gRR6EEk9KzK+YvPJ/UtoeezGvYwd1wBjn6z3wg7m/PjEbSdDk6YgjYXf+DbLlz FRfA== X-Gm-Message-State: AEkooutUWckVirpqK1gQk4zwAwtha4EzNjs2M70qDIOBusMK/unJx1wrzYHMZ/QKI1Sgy7GS X-Received: by 10.98.97.7 with SMTP id v7mr65433827pfb.49.1469768328779; Thu, 28 Jul 2016 21:58:48 -0700 (PDT) Received: from roland-t440p.purestorage.com ([2001:470:1f05:221:40bb:149:7900:7883]) by smtp.gmail.com with ESMTPSA id c82sm20762097pfb.72.2016.07.28.21.58.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Jul 2016 21:58:48 -0700 (PDT) From: Roland Dreier To: Yishai Hadas , Doug Ledford Cc: linux-rdma@vger.kernel.org Subject: [PATCH] IB/mlx4: Allocation of CQ resize structure doesn't need to be atomic Date: Thu, 28 Jul 2016 21:58:43 -0700 Message-Id: <1469768323-8093-1-git-send-email-roland@kernel.org> X-Mailer: git-send-email 2.7.4 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 From: Roland Dreier We allocate a small tracking structure as part of mlx4_ib_resize_cq(). However, we don't need to use GFP_ATOMIC -- immediately after the allocation, we call mlx4_cq_resize(), which allocates a command mailbox with GFP_KERNEL and then sleeps on a firmware command, so we better not be in an atomic context. This actually has a real impact, because when this GFP_ATOMIC allocation fails (and GFP_ATOMIC does fail in practice) then a userspace consumer resizing a CQ will get a spurious failure that we can easily avoid. Signed-off-by: Roland Dreier Reviewed-by: Leon Romanovsky --- drivers/infiniband/hw/mlx4/cq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c index 9f8b516eb2b0..d6fc8a6e8c33 100644 --- a/drivers/infiniband/hw/mlx4/cq.c +++ b/drivers/infiniband/hw/mlx4/cq.c @@ -288,7 +288,7 @@ static int mlx4_alloc_resize_buf(struct mlx4_ib_dev *dev, struct mlx4_ib_cq *cq, if (cq->resize_buf) return -EBUSY; - cq->resize_buf = kmalloc(sizeof *cq->resize_buf, GFP_ATOMIC); + cq->resize_buf = kmalloc(sizeof *cq->resize_buf, GFP_KERNEL); if (!cq->resize_buf) return -ENOMEM; @@ -316,7 +316,7 @@ static int mlx4_alloc_resize_umem(struct mlx4_ib_dev *dev, struct mlx4_ib_cq *cq if (ib_copy_from_udata(&ucmd, udata, sizeof ucmd)) return -EFAULT; - cq->resize_buf = kmalloc(sizeof *cq->resize_buf, GFP_ATOMIC); + cq->resize_buf = kmalloc(sizeof *cq->resize_buf, GFP_KERNEL); if (!cq->resize_buf) return -ENOMEM;