From patchwork Fri Jul 27 08:22:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jia-Ju Bai X-Patchwork-Id: 950039 X-Patchwork-Delegate: jeffrey.t.kirsher@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=osuosl.org (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="iT1Aw/tH"; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41cMQs3W7Xz9s0n for ; Fri, 27 Jul 2018 18:22:45 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 9B4702E379; Fri, 27 Jul 2018 08:22:43 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id G5LWHVf5rtEY; Fri, 27 Jul 2018 08:22:41 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id ACD0B2E39A; Fri, 27 Jul 2018 08:22:41 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id AD9541C2AD7 for ; Fri, 27 Jul 2018 08:22:39 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id AA3AC88733 for ; Fri, 27 Jul 2018 08:22:39 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3on6k4mZg3Np for ; Fri, 27 Jul 2018 08:22:39 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pl0-f66.google.com (mail-pl0-f66.google.com [209.85.160.66]) by whitealder.osuosl.org (Postfix) with ESMTPS id 4AE0F88729 for ; Fri, 27 Jul 2018 08:22:39 +0000 (UTC) Received: by mail-pl0-f66.google.com with SMTP id s17-v6so2011386plp.7 for ; Fri, 27 Jul 2018 01:22:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=/gzMd54Ec+OtZaWMQabcpGO3Adpp6UPzv3QK9xSICBM=; b=iT1Aw/tHcOrtcvZTWUUffBXO61lXo8j9RsD3zivpcsABkx471mCgVzWQ3E+TPox6zH znfNN73ogmlyWH5jQr13cKH/bP4GXYO/0bgwU7H1XaiXSq9h7Lczw/T9JVosVCXv2IkP tWArHaGeDdIQoTTlkplXvLUbzQNvEJaXQ47LSF+/6NxRgKmhTWawEzF/eugtRBwtlzt1 t7QZ7LgJipNRBAjY5QQJjuRHmBmF96wMQinVO6qt8QXU6aUM5TxdRWDa6hb37FnOZgfU gE7zaIpjbCozWm0ijVCYWXbMHo3umOHEwfYDfEWDTcP4yzAjWeO7aN/SW+guGy4eUTn3 fC0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=/gzMd54Ec+OtZaWMQabcpGO3Adpp6UPzv3QK9xSICBM=; b=Rmjr4+CELMj6DC58gQbaHffpQ9/snN/iW7jax7g231ubCY6o1Yw1ao4A41YFZE4XNk bMAFIehu0KRK0i6OIZVtky5c3DM7Ux/e2Wy9QcS1LkMNWvexFoLOjLRHZBXu5X1A0CgU UwEBIwL5D554Y60vYLnq4AxDEuewCv2YJxf6LCGfmSREWoOJSc70F7rs947FJM59DU8f w2ME9hM4rFHSzrRyA1xJZ5Qj6yy7OQHOQN37wjCy5nifGbjBvF44EOL8yjQHbGDk98JL wC3Nk06xdBUcBHwUIZn4RuE6ozTnGe9JvU8c7UU3J1iHrNqqC2Vm53R2FHTKbtlzIPCS VciQ== X-Gm-Message-State: AOUpUlHwIias/p7/yqwqdRklfUHmHuypl9RI7qGBlQMOm7bOimvvbm6t XVwFRB9smTWjd7N10mzqG+I= X-Google-Smtp-Source: AAOMgpcppLIQ8h6bhdFicM/GXHwGJlnqyA/0iF+82wSFCSzUKgVDE/XUnfu9a8qQiIPgTu9Kf34lvw== X-Received: by 2002:a17:902:28a4:: with SMTP id f33-v6mr5043668plb.297.1532679758992; Fri, 27 Jul 2018 01:22:38 -0700 (PDT) Received: from localhost.localdomain ([2402:f000:1:4414:6c14:7712:e625:1be4]) by smtp.gmail.com with ESMTPSA id d132-v6sm4573023pga.10.2018.07.27.01.22.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Jul 2018 01:22:38 -0700 (PDT) From: Jia-Ju Bai To: jeffrey.t.kirsher@intel.com Date: Fri, 27 Jul 2018 16:22:31 +0800 Message-Id: <20180727082231.3798-1-baijiaju1990@gmail.com> X-Mailer: git-send-email 2.17.0 Subject: [Intel-wired-lan] [PATCH] net: intel: ixgbe: Replace GFP_ATOMIC with GFP_KERNEL X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, Jia-Ju Bai , intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" ixgbe_fcoe_ddp_setup(), ixgbe_setup_fcoe_ddp_resources() and ixgbe_sw_init() are never called in atomic context. They call kmalloc(), dma_pool_alloc() and kzalloc() with GFP_ATOMIC, which is not necessary. GFP_ATOMIC can be replaced with GFP_KERNEL. This is found by a static analysis tool named DCNS written by myself. Signed-off-by: Jia-Ju Bai Signed-off-by: Jia-Ju Bai Acked-by: Sebastian Basierski Signed-off-by: Jia-Ju Bai --- drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c | 4 ++-- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c index 7a09a40e4472..ff7ed77ce224 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c @@ -217,7 +217,7 @@ static int ixgbe_fcoe_ddp_setup(struct net_device *netdev, u16 xid, } /* alloc the udl from per cpu ddp pool */ - ddp->udl = dma_pool_alloc(ddp_pool->pool, GFP_ATOMIC, &ddp->udp); + ddp->udl = dma_pool_alloc(ddp_pool->pool, GFP_KERNEL, &ddp->udp); if (!ddp->udl) { e_err(drv, "failed allocated ddp context\n"); goto out_noddp_unmap; @@ -785,7 +785,7 @@ int ixgbe_setup_fcoe_ddp_resources(struct ixgbe_adapter *adapter) return 0; /* Extra buffer to be shared by all DDPs for HW work around */ - buffer = kmalloc(IXGBE_FCBUFF_MIN, GFP_ATOMIC); + buffer = kmalloc(IXGBE_FCBUFF_MIN, GFP_KERNEL); if (!buffer) return -ENOMEM; diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index afadba99f7b8..fe4a6125576d 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -6138,7 +6138,7 @@ static int ixgbe_sw_init(struct ixgbe_adapter *adapter, adapter->mac_table = kzalloc(sizeof(struct ixgbe_mac_addr) * hw->mac.num_rar_entries, - GFP_ATOMIC); + GFP_KERNEL); if (!adapter->mac_table) return -ENOMEM;