Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp934139imm; Mon, 21 May 2018 17:35:31 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoTV6BcRbBRDWn2yqpqNcAVOHSey1AhUmGCHlbhAo9BVe2Ee0h9kdS2iBLfVKmIAkWcVSyY X-Received: by 2002:a65:5244:: with SMTP id q4-v6mr17164317pgp.201.1526949331113; Mon, 21 May 2018 17:35:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526949331; cv=none; d=google.com; s=arc-20160816; b=leWZc7DM8PFz02nOpxoXJ0hBkcI28vP1JIsGFNW3kmz6Jw+SmysJM/1SOBWobKfIyt gerbRU/302KTgAht7g51a60+rF+R+HOFAYl2iFaspvpdfBc7TKxilB98GzMbFYRS38SS jlm20oXUkTPnw+jH1w+cxsXF8864hzcT0uXxWcQvo/fidP5AuFZHRQdU45ffx9NVtrcY /ObvZ7jryJIdkRmpV0vSupy0dePoglX/7tAF9GB+zrFsAAu9LJZlRWkQzaYw3Bz+exft 5hRHuz2pYNSkOQ/t9LpusFhPow8JdXoekCUTKKDrHpd3S9vn9yLmAUUPYzj3+fU579PJ WBXQ== 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:dkim-signature:arc-authentication-results; bh=3uD/qME+c3Bo6212xXxZHcC8x21MEAgORMua1cH4kps=; b=acREvPov2dwUiWwBqtlIZDIwoZNbbumMPUiy8ASFE3Is4sQmG/YxKh2rt1iaYXyyvb R9tEH/UGJpYMjbb9EO5EzoSTl7PbPWeSwMVFebyUw0L/F7SZ3o1E/fsjhBLgX7s//SIV dQQUanSN++44uT+2X06CiKawmbTlpX1UdBx8/sTmIUZfs+T8k0sPcn/0a5CbW7cCTzuD dUS+PIYFY4xiqNE8rmwwB7GN5rPb3CoK2PJZTUH/z+qgytPbvZCSk8NJYr8VM0+zfUO1 pyP5sjNiongfFEDbpLkXjrasdaRqvU3JBQ4qflXhR1yis/EotIOUP7QvMj57W2JrqC2s LefQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kudzu-us.20150623.gappssmtp.com header.s=20150623 header.b=E6X8dSnj; 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 u14-v6si15314889pfa.84.2018.05.21.17.35.16; Mon, 21 May 2018 17:35:31 -0700 (PDT) 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; dkim=pass header.i=@kudzu-us.20150623.gappssmtp.com header.s=20150623 header.b=E6X8dSnj; 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 S1751880AbeEVAfH (ORCPT + 99 others); Mon, 21 May 2018 20:35:07 -0400 Received: from mail-yb0-f194.google.com ([209.85.213.194]:40627 "EHLO mail-yb0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751604AbeEVAfG (ORCPT ); Mon, 21 May 2018 20:35:06 -0400 Received: by mail-yb0-f194.google.com with SMTP id o80-v6so5723398ybc.7 for ; Mon, 21 May 2018 17:35:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kudzu-us.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=3uD/qME+c3Bo6212xXxZHcC8x21MEAgORMua1cH4kps=; b=E6X8dSnjpSga9wWroQRspOp3sVaRRPaAZlvs6le3G85IXyPl/sBBMp+Q+botac7SWs IXFIugt6vmBsdKOwNpXfpsvxxrlTmkV002qiaHE3bG7adD/0XCor+npftDsZXu34UWca 2pg89gzAAiEEb9vb3QQ2224WByhpr/UgX8FhYQkuZZk8tSPj7V5oeejB1J0SsxJnySbU Uv45Xf3AKS2x929uh6Pqb2VqPST0p4totqKbsU3sQz4TsdwnFWS0tTqrQVBs1i+cbiie gGugaTHQ8Z5K2Tg4EskrbEGGVyBdxnLGygfLc0yFO+wajbfuLIXZjhrfOmfli+GSX6mS +TAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=3uD/qME+c3Bo6212xXxZHcC8x21MEAgORMua1cH4kps=; b=AuniyhdSmOqLBsqtS31zPOBcq2kwxDMFNFXCAXk/HCvToazQL1biSVbIdXNtCgMXvK 01ek3ya0XJQAvTIvIIXWNOnvIhZfkkhuALNTOLr+7dbPx/OzgnW0RskSoJoJj1n3xUZu IvL8Fs3zIWgSi4pdJEdMKKFSNFvNetd9afW0mXe/FCKNBDTvoCKeMLH+kFDRfEQScjPf TLdf5xHc1bfnYi+/Am4aZwD8WseODl7Mywr6aV2b5aq1cYP87/2fq8JZN/nolWrnweX/ 1VKpU/Vm5rk98nLy+fLKZuCYNR7XgvvnkSj9yRKoFCeAh2UqIjW/XTIMsLcuLQxZNHGt mhPQ== X-Gm-Message-State: ALKqPwfUYP7Ytu2fZ7jKGAG4KEVaqjatehfogxOdXCAakE9I7BJx95JJ eygnBLrbEedzbkWveRVyqwPcGg== X-Received: by 2002:a25:f80f:: with SMTP id u15-v6mr8183375ybd.459.1526949305425; Mon, 21 May 2018 17:35:05 -0700 (PDT) Received: from kudzu.us (76-230-155-4.lightspeed.rlghnc.sbcglobal.net. [76.230.155.4]) by smtp.gmail.com with ESMTPSA id t124-v6sm6321470ywe.107.2018.05.21.17.35.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 May 2018 17:35:05 -0700 (PDT) Date: Mon, 21 May 2018 20:35:03 -0400 From: Jon Mason To: Jia-Ju Bai Cc: dave.jiang@intel.com, Allen.Hubbe@emc.com, linux-ntb@googlegroups.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] ntb: ntb_transport: Replace GFP_ATOMIC with GFP_KERNEL in ntb_transport_create_queue Message-ID: <20180522003503.GA3255@kudzu.us> References: <1523366274-31737-1-git-send-email-baijiaju1990@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1523366274-31737-1-git-send-email-baijiaju1990@gmail.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 10, 2018 at 09:17:54PM +0800, Jia-Ju Bai wrote: > ntb_transport_create_queue() is never called in atomic context. > > ntb_transport_create_queue() is only called by ntb_netdev_probe(), > which is set as ".probe" in struct ntb_transport_client. > > Despite never getting called from atomic context, > ntb_transport_create_queue() calls kzalloc_node() with GFP_ATOMIC, > which does not sleep for allocation. > GFP_ATOMIC is not necessary and can be replaced with GFP_KERNEL, > which can sleep and improve the possibility of sucessful allocation. > > This is found by a static analysis tool named DCNS written by myself. > And I also manually check it > > Signed-off-by: Jia-Ju Bai Both patches have been applied to my ntb-next branch. Thanks, Jon > --- > drivers/ntb/ntb_transport.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c > index f58d8e3..2c0c8bc 100644 > --- a/drivers/ntb/ntb_transport.c > +++ b/drivers/ntb/ntb_transport.c > @@ -1825,7 +1825,7 @@ struct ntb_transport_qp * > qp->rx_dma_chan ? "DMA" : "CPU"); > > for (i = 0; i < NTB_QP_DEF_NUM_ENTRIES; i++) { > - entry = kzalloc_node(sizeof(*entry), GFP_ATOMIC, node); > + entry = kzalloc_node(sizeof(*entry), GFP_KERNEL, node); > if (!entry) > goto err1; > > @@ -1836,7 +1836,7 @@ struct ntb_transport_qp * > qp->rx_alloc_entry = NTB_QP_DEF_NUM_ENTRIES; > > for (i = 0; i < qp->tx_max_entry; i++) { > - entry = kzalloc_node(sizeof(*entry), GFP_ATOMIC, node); > + entry = kzalloc_node(sizeof(*entry), GFP_KERNEL, node); > if (!entry) > goto err2; > > -- > 1.9.1 >