Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1451534imu; Wed, 23 Jan 2019 17:54:40 -0800 (PST) X-Google-Smtp-Source: ALg8bN7bmgH9Eb7dC2ep/dlkWv9VQO2jnl+P7IAOoGfSxmtmYrSBNL52r8uudtTnJC5mtmR6F5n6 X-Received: by 2002:a63:df50:: with SMTP id h16mr4197016pgj.421.1548294880597; Wed, 23 Jan 2019 17:54:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548294880; cv=none; d=google.com; s=arc-20160816; b=pvRzc7cNR2yvYDxWZs8iYMk4ZRFN7ICnzTdOVXno61ClkUkuXZtS95sIb+o+4ZZZ/N PAaJrKvNEUFwNhJOr2Rp5DwN7rHO1Dz/zNutYUnSic5ClmTii+7heVVKGBrRHKxpgczo eVZsieE20WeWjAMCfROuHpizgho7UawlYerMGI7cOswohtc9MyooP6LScs8LVxvfNBDf Q25ljPIBcxmkyhNRce+BwpY/E2aEzwqa+JJHlrNwYZtgNhjFby+s6MMHrV58TJCPVjT/ v1r73uPexAAZuyc7nL7ezgLrFbwkU834S8n/+HPrg5nnWn7ZBnfQDxQIaQ6AnKlN4AfC kUnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=On6WbXX03Goctpqy1o4AYsEYfEBHH+rR/gtULcpdFVs=; b=zjC/SX1/0XjEJNLw69c/akJZRQAeJOjZbf0HWIhPXXYpoqG57WnhLK2RFgAQ7vXpK4 +viQfbRtLiCceoBte2VmBjDjvJXqwUJ7zk2z1f3ihjaYbFKOu/mhpEMJWPWzmJ3NoH2P 97uAktnNQLABW3DocPa6/xqd29sxp2BKPsAy3En53r7JU2D813x90Ao1PTvFZ9PyK/ww u+yOcRjaBwfzOPBzitssBxaINzJkg9RI2pBfQDWPu4VTDweYla4iRxqUVdYWD+YXE3Vj E+bu4SrJTCU8laN9w5tRm3l0nTGQdQ8CRgtjhoII/qgv95Jfw6qjF0wDei4HuZup0xpZ mTTQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l30si20601686plg.113.2019.01.23.17.54.25; Wed, 23 Jan 2019 17:54:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727111AbfAXByN (ORCPT + 99 others); Wed, 23 Jan 2019 20:54:13 -0500 Received: from 178.115.242.59.static.drei.at ([178.115.242.59]:36604 "EHLO mail.osadl.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726310AbfAXByN (ORCPT ); Wed, 23 Jan 2019 20:54:13 -0500 Received: by mail.osadl.at (Postfix, from userid 1001) id 4CB4A5C0FB6; Thu, 24 Jan 2019 02:53:52 +0100 (CET) Date: Thu, 24 Jan 2019 02:53:52 +0100 From: Nicholas Mc Guire To: Steve Wise Cc: Jason Gunthorpe , Nicholas Mc Guire , Doug Ledford , Raju Rangoju , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC] iw_cxgb4: drop check - dead code Message-ID: <20190124015352.GA30939@osadl.at> References: <1547947633-10515-1-git-send-email-hofrat@osadl.org> <20190123183008.GA15698@ziepe.ca> <91af1982-e309-476e-cfa4-2f6ef1ee598b@opengridcomputing.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <91af1982-e309-476e-cfa4-2f6ef1ee598b@opengridcomputing.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 23, 2019 at 12:45:11PM -0600, Steve Wise wrote: > > > On 1/23/2019 12:30 PM, Jason Gunthorpe wrote: > > On Sun, Jan 20, 2019 at 02:27:13AM +0100, Nicholas Mc Guire wrote: > >> The kmalloc is called with | __GFP_NOFAIL so there is no point in > >> checking the return value - it either returns valid storage or it would > >> hang/terminate there. But it is not possible to say if the use of > >> __GFP_NOFAIL is really needed and the check should be removed or > >> vice-versa (use of __GFP_NOFAIL should be only in exceptional > >> cases as I understand it and alloc_srq_queue() is called in quite > >> a few places) > >> In either way it would need fixing. > >> > >> Signed-off-by: Nicholas Mc Guire > >> Fixes: 6a0b6174d35a ("rdma/cxgb4: Add support for kernel mode SRQ's") > >> --- > > > > Steve? It seems weird to have NOFAIL and then have an error unwind > > path, what is the deal here? > > > >> diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c > >> index 917ce5c..c2a12ba 100644 > >> --- a/drivers/infiniband/hw/cxgb4/qp.c > >> +++ b/drivers/infiniband/hw/cxgb4/qp.c > >> @@ -2597,8 +2597,6 @@ static int alloc_srq_queue(struct c4iw_srq *srq, struct c4iw_dev_ucontext *uctx, > >> wr_len = sizeof(*res_wr) + sizeof(*res); > >> > >> skb = alloc_skb(wr_len, GFP_KERNEL | __GFP_NOFAIL); > >> - if (!skb) > >> - goto err_free_queue; > >> set_wr_txq(skb, CPL_PRIORITY_CONTROL, 0); > >> > >> res_wr = (struct fw_ri_res_wr *)__skb_put(skb, wr_len); > >> -- > >> 2.1.4 > >> > > The other queue allocations in qp.c don't use __GFP_NOFAIL. So either > leave it and remove the error check as per this patch, or remove the > NOFAIL and leave the check. > > I suggest you remove the __GFP_NOFAIL, since I have a recollection that > using it was frowned upon. In this case, if there is no memory > available it is reasonable to return that error to the user creating the > srq... > thanks for taking care of this - I simply did not have enough context to decide if there would be some special reason for this allocation to need __GFP_NOFAIL - keeping its use to a minimum though is the best solution. thx! hofrat