From patchwork Sun Oct 22 00:51:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander H Duyck X-Patchwork-Id: 828975 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.137; helo=fraxinus.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="phfjhGqx"; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yKLb70llVz9t2W for ; Sun, 22 Oct 2017 11:52:01 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 44704871E1; Sun, 22 Oct 2017 00:51:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qHfclgmKwpuU; Sun, 22 Oct 2017 00:51:56 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 677388724A; Sun, 22 Oct 2017 00:51:56 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id BAA241CEF17 for ; Sun, 22 Oct 2017 00:51:54 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id B05A42E156 for ; Sun, 22 Oct 2017 00:51:54 +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 o0BtKeTds+5N for ; Sun, 22 Oct 2017 00:51:53 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-io0-f196.google.com (mail-io0-f196.google.com [209.85.223.196]) by silver.osuosl.org (Postfix) with ESMTPS id 57BBD26162 for ; Sun, 22 Oct 2017 00:51:53 +0000 (UTC) Received: by mail-io0-f196.google.com with SMTP id b186so16767341iof.8 for ; Sat, 21 Oct 2017 17:51:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:date:message-id:user-agent:mime-version :content-transfer-encoding; bh=Y6iz7jWh4724dUF5BqqobB55GMzGDQkbUQOi6fv3r+c=; b=phfjhGqxvEFGQIZj3r+DVklLKje7bsFWJfD3jCpjh76Oif+kC4XmAsW4OsVdB8C1f+ iN9LQ9mP5LydmhuVDmtreRav8TcqDee1/ngLUaa+1Z0B3+rDPEcI+fxs1ikx5JR9rlmX X0Mwm/MAZ66NSmvloVOwrdUN5Y132FJIcu3DeusAMge+S3eycnWpaanbz8zcX4hkUc5b 9veVoJvJpo8FiWRH0zDwOpLYZtB4zBrr1X6utGBqZkzVqSCnDkyaCYQLklbqvYgtkWgo UR4pGxJ5Erh9HFNtJxHNMHGJ7hd/vwQuNMxoVep1Ye7xU0Q7N7K1JrPB0/M30/ImftZO CozA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:date:message-id:user-agent :mime-version:content-transfer-encoding; bh=Y6iz7jWh4724dUF5BqqobB55GMzGDQkbUQOi6fv3r+c=; b=IxXbgK8nRzwqIjHyVYAHPuqOqBTUvx0iq1yYMQT9tlf8F5ASxnnZL1x0PmgiVmJF0r uw3S0m1PPsKcN3Goo1rutiZMMkifgQk2k3R027cyd7Gsedh9jHj/3bORrt7KNPRgORX0 eJi+h2l4A98wzKeFlfhBCKllU1eCzQD5r5Q3gUrqys7PuHVDumpZk4pTnUM6z+mctCQq 8GUk4MKwM8D/lZ75KUD1IxnbFLyJHmusPBn9bYE/UgesNGa+5MCIf/Wwe/M4YKkNBLOV E7GC/GQ8I5aCWR2et5UyxgPqKFhcwjHOBAE1a0HJQ0KmptNouJYTDyGAHquuBrTyFDo+ 3CYQ== X-Gm-Message-State: AMCzsaUBxj18N/hKDFc5SKtpMbZfxDTq1WhTiOr+AKZdzUSKvKoSx958 0Upm700F2zodZWBZsCGPOyU= X-Google-Smtp-Source: ABhQp+R/Liy9Y+ZAViUjc1eiPMxAHEJK0Ez3EC7Qoa6NVKiOpbghpALBXoimZnfIkmcjn4en4VdFfA== X-Received: by 10.107.102.13 with SMTP id a13mr12183719ioc.185.1508633512572; Sat, 21 Oct 2017 17:51:52 -0700 (PDT) Received: from localhost.localdomain ([2001:470:b:9c3:9e5c:8eff:fe4f:f2d0]) by smtp.gmail.com with ESMTPSA id q72sm960023itb.0.2017.10.21.17.51.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 21 Oct 2017 17:51:51 -0700 (PDT) From: Alexander Duyck To: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org, akp@cohaesio.com, pstaszewski@itcare.pl Date: Sat, 21 Oct 2017 17:51:50 -0700 Message-ID: <20171022005030.19175.91947.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Subject: [Intel-wired-lan] [jkirsher/next-queue PATCH] i40e/i40evf: Revert "i40e/i40evf: bump tail only in multiples of 8" X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" From: Alexander Duyck This reverts commit 11f29003d6376fb123b7c3779dba49bb56fb0815. I am reverting this as I am fairly certain this can result in a memory leak when combined with the current page recycling scheme. Specifically we end up attempting to allocate fewer buffers than we recycled and this results in us rewinding the next to alloc pointer which leads to leaks when we overwrite the rx_buffer_info when processing the next frame. Fixes: 11f29003d637 ("i40e/i40evf: bump tail only in multiples of 8") Signed-off-by: Alexander Duyck Tested-by: Andrew Bowers --- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 9 --------- drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 9 --------- 2 files changed, 18 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c index edbc94c4353d..487e2f483fa1 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c @@ -1407,15 +1407,6 @@ bool i40e_alloc_rx_buffers(struct i40e_ring *rx_ring, u16 cleaned_count) union i40e_rx_desc *rx_desc; struct i40e_rx_buffer *bi; - /* Hardware only fetches new descriptors in cache lines of 8, - * essentially ignoring the lower 3 bits of the tail register. We want - * to ensure our tail writes are aligned to avoid unnecessary work. We - * can't simply round down the cleaned count, since we might fail to - * allocate some buffers. What we really want is to ensure that - * next_to_used + cleaned_count produces an aligned value. - */ - cleaned_count -= (ntu + cleaned_count) & 0x7; - /* do nothing if no valid netdev defined */ if (!rx_ring->netdev || !cleaned_count) return false; diff --git a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c index 6806ada11490..fe817e2b6fef 100644 --- a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c @@ -711,15 +711,6 @@ bool i40evf_alloc_rx_buffers(struct i40e_ring *rx_ring, u16 cleaned_count) union i40e_rx_desc *rx_desc; struct i40e_rx_buffer *bi; - /* Hardware only fetches new descriptors in cache lines of 8, - * essentially ignoring the lower 3 bits of the tail register. We want - * to ensure our tail writes are aligned to avoid unnecessary work. We - * can't simply round down the cleaned count, since we might fail to - * allocate some buffers. What we really want is to ensure that - * next_to_used + cleaned_count produces an aligned value. - */ - cleaned_count -= (ntu + cleaned_count) & 0x7; - /* do nothing if no valid netdev defined */ if (!rx_ring->netdev || !cleaned_count) return false;