Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2101387ybi; Thu, 4 Jul 2019 05:15:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqyZChJqHMe3IYE+mOF5t3VyM82p7ZOzaHGafCauj9J6fK8WV52h9vuT/RqR/mTBrlZ36Z7a X-Received: by 2002:a17:902:f81:: with SMTP id 1mr48416039plz.191.1562242529344; Thu, 04 Jul 2019 05:15:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562242529; cv=none; d=google.com; s=arc-20160816; b=w1TQPULADNmabd9ZYQ2pgNXlX6DjlS1PyJjZ3abvOwptL2FXFg8us0xqU7OjMqmaNr OxImtmSPlC8SXAoOBNzhK6CBNmFMtZVMOtLZ1IP4Ketc3nuJ+qF8M5KssGSqZPu9FgI+ g+Pt3mc+FEvij4xRwcXv4zLS9zRSgcCjIwXNYVruyYxkv3mpFkqAs5Latve/J1VVjzbK l7pl6k4H8skRLSdf6GkDRxA8qf1xK2g0ihkz+58aHOYpkHtBJeMmWwzWTAYa0oh+7O04 yKsDmrH7k4DBGPUb8pr4CojhE5/LI6Zc9qmEOMjo+X/WywZ9S81zIF4iaGDHQLULcLPw vdgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=9cNGGl+FLilA8PMo/2823HsEW5aV7LEQGtBmo7DnFEc=; b=r20kzi0qBuaLOjDZpe9BHaOTfMFiaK4j1B91gsefE6VwGRdZdrDdKPijYeh18psbFt hYEuHEuOU8hDroTCQEtD/XglW1dJQwDlZe4JGEMhhxZI1jtlGi6EhQENlhrW5XXKHje1 aNFcQ+Rs7MW2531SDlUpxwLdy43zf/pjxl6OlSYaOgdmwFq90W0If5vaCtCIXZpUj8ba XMY+ldmXQNzzvlHXWf1nKeph8ukTb0cc0BWPen0hobv+8Gdr+Ke9mjGsc0f4Z+V5CTIW yofHg8FIPA76oWK8847uvV28CAf7yK+T/LJf2taCr56cjHj5ur/vXOdCEcx4g/1uFwKM WcAQ== 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 24si5451351pgo.350.2019.07.04.05.15.14; Thu, 04 Jul 2019 05:15:29 -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; 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 S1727725AbfGDMOs (ORCPT + 99 others); Thu, 4 Jul 2019 08:14:48 -0400 Received: from mail-qk1-f194.google.com ([209.85.222.194]:35156 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727615AbfGDMOr (ORCPT ); Thu, 4 Jul 2019 08:14:47 -0400 Received: by mail-qk1-f194.google.com with SMTP id r21so5101123qke.2; Thu, 04 Jul 2019 05:14:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9cNGGl+FLilA8PMo/2823HsEW5aV7LEQGtBmo7DnFEc=; b=CM+vpFVspPTYEDMdGio5Ui9f86Lxh9bIBdEOQ40wOW2Cth2CmaKfsJuJNRac3WZesM hIXh1x3Hc15t1IlJ+FiYTYvLUlu7qefK5hkVyodgPF3jpy7ys7sZTt6XVw9CBOBsf8FL Pf/KRHPP7fQPRBFsgVOuDiM6qi2pcXoaKIBNfKdWkXeKVP7ari5H7NwH7xKL64OWllY7 C9i/2RpOiDXU7VN11NAfQ8LtnjP0OXVBs34D1aDLhUev28c/4cTprNrfamCbWysB8CFU F4xXJBas7rKl8wljGWN/QsdPzgWim3n9jV28Ri2qMDLfQt28MehKbFfuAnksp476OTBT /l6w== X-Gm-Message-State: APjAAAXLkvkchE09EP+Vb6NEaywCKXMdOPHue2ExUFrnAQCfoIpeDWce OgbXxks9gRpOH9uQj/6jTkVo5it/cw5YJrWh01k= X-Received: by 2002:a37:76c5:: with SMTP id r188mr34670161qkc.394.1562242486886; Thu, 04 Jul 2019 05:14:46 -0700 (PDT) MIME-Version: 1.0 References: <1b254bb7fc6044c5e6e2fdd9e00088d1d13a808b.1562149883.git.joabreu@synopsys.com> <20190704120018.4523a119@carbon> <20190704103057.GA29734@apalos> In-Reply-To: <20190704103057.GA29734@apalos> From: Arnd Bergmann Date: Thu, 4 Jul 2019 14:14:28 +0200 Message-ID: Subject: Re: [PATCH net-next 3/3] net: stmmac: Introducing support for Page Pool To: Ilias Apalodimas Cc: Jesper Dangaard Brouer , Jose Abreu , Joao Pinto , Alexandre Torgue , Maxime Ripard , Networking , Linux Kernel Mailing List , "David S . Miller" , Chen-Yu Tsai , Maxime Coquelin , Giuseppe Cavallaro , linux-stm32@st-md-mailman.stormreply.com, Linux ARM Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 4, 2019 at 12:31 PM Ilias Apalodimas wrote: > > On Wed, 3 Jul 2019 12:37:50 +0200 > > Jose Abreu wrote: > 1. page pool allocs packet. The API doesn't sync but i *think* you don't have to > explicitly since the CPU won't touch that buffer until the NAPI handler kicks > in. On the napi handler you need to dma_sync_single_for_cpu() and process the > packet. > So bvottom line i *think* we can skip the dma_sync_single_for_device() on the > initial allocation *only*. If am terribly wrong please let me know :) I think you have to do a sync_single_for_device /somewhere/ before the buffer is given to the device. On a non-cache-coherent machine with a write-back cache, there may be dirty cache lines that get written back after the device DMA's data into it (e.g. from a previous memset from before the buffer got freed), so you absolutely need to flush any dirty cache lines on it first. You may also need to invalidate the cache lines in the following sync_single_for_cpu() to eliminate clean cache lines with stale data that got there when speculatively reading between the cache-invalidate and the DMA. Arnd