Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp721980yba; Fri, 26 Apr 2019 07:44:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqzlY4VCJQdSsltBJN08BtzBKW/CkTcW52NfXRPSk7ioCH2tvIh9I/RFq8L/YlRtekVKHJDF X-Received: by 2002:a63:f444:: with SMTP id p4mr44102852pgk.32.1556289878170; Fri, 26 Apr 2019 07:44:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556289878; cv=none; d=google.com; s=arc-20160816; b=xEI/PQp8+yrifZ1mdBwV7+8Nfqyf76atrAw4KCkFOU6U9UuQp2984oru0Xn0n2pm28 fi8VTlfzqkA3Hju83X1yP3zwiqy8aLILFQkwaTytQdUPyzo+hBrUhQl6H0NOMPr1Hw/d eNK9gYakvWXVKkgeMpAvS7eTjK3PZjAai9PJuq/eMhMRB0FHN+sFCF2Wq0Wc5NYoc4As eUFhZCLdki/YK7fwEenD/HzOBatt0qgLJ0oWWpuijkU8MRqJ7+qw4kudIdApC5fiaoQR e6fVlJFCE8LhdxuqcUfmeBwythocO6X07HV4WbTvnZBGhaQrs/2LOpg2etANKheNLt3Q +vJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=0aIc/7cK83t/6MyYKgb3Ufhc6HktIfLIQbp6Rv0HUSU=; b=DDFiRGR5Wjg+WO8qZfqyVsKcANaNUe+F9ZDJcmaUdDRZNRai4SdZI6gEnJs2PAEIzL GXu/COGDWr2Zg/TcjHXjG8ynx6QD0GtZiHimQItBLxRVZekwwSKtcuZ59hmk8CIKVh32 f+jD/MakMfiHEsmk9vbmz3tKOQrZ3oxZPOPtd4ZyIEt9IlbPkUg+hxE3bzsKwUGt1vCY j9ksNIOjcHIA03TKyCfaN8VeKZ12N4cI0FPurGH8ks0jTfViUuFLUmJFWNn6d5IWwbQk dVY9ZYh3wfRvJ4DNfpc/9MP68H4fP8oxFc3H59vVcTlzADvxu/C3SvzdDIMijxUze68F +x4w== 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 w10si2613783pgp.356.2019.04.26.07.44.22; Fri, 26 Apr 2019 07:44:38 -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 S1726435AbfDZOnZ (ORCPT + 99 others); Fri, 26 Apr 2019 10:43:25 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:43280 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726120AbfDZOnY (ORCPT ); Fri, 26 Apr 2019 10:43:24 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 297FB80D; Fri, 26 Apr 2019 07:43:24 -0700 (PDT) Received: from [10.1.196.75] (e110467-lin.cambridge.arm.com [10.1.196.75]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 672C73F5C1; Fri, 26 Apr 2019 07:43:22 -0700 (PDT) Subject: Re: [PATCH 08/12] net: ll_temac: Fix iommu/swiotlb leak To: Andrew Lunn , Esben Haabendal Cc: netdev@vger.kernel.org, YueHaibing , Michal Simek , linux-kernel@vger.kernel.org, Yang Wei , Luis Chamberlain , "David S. Miller" , linux-arm-kernel@lists.infradead.org References: <20190426073231.4008-1-esben@geanix.com> <20190426073231.4008-9-esben@geanix.com> <20190426142103.GI14432@lunn.ch> From: Robin Murphy Message-ID: <0aab6152-82c6-b53f-6b9b-0905995de43a@arm.com> Date: Fri, 26 Apr 2019 15:43:20 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190426142103.GI14432@lunn.ch> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 26/04/2019 15:21, Andrew Lunn wrote: > On Fri, Apr 26, 2019 at 09:32:27AM +0200, Esben Haabendal wrote: >> Unmap the actual buffer length, not the amount of data received. > > Hi Esben > > The patch Subject does not seem to match the content? > > Also, there can be performance advantages of just unmapping the > received length. The unmap operation does a cache invalidate, which > can be expensive. Consider the effort of unmapping a 64 byte ACK vs 9K > jumbo frame? If the size passed to dma_unmap_*() is not the same as was passed to the corresponding dma_map_*(), that is fundamentally incorrect use of the API and may lead to warnings, resource exhaustion, or possibly even corruption and crashes for some DMA API implementations. If there's a case where you just need to look at a small part of the buffer right now, but can unmap the whole thing properly later. then dma_sync_single_*() does allow operating on partial buffers. Even better, if you're able to recycle buffers in your Rx pool you could potentially replace the unmap/map dance altogether with some careful use of sync_single. Robin. > > Andrew > >> Signed-off-by: Esben Haabendal >> --- >> drivers/net/ethernet/xilinx/ll_temac_main.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c >> index 309f149..56d8077 100644 >> --- a/drivers/net/ethernet/xilinx/ll_temac_main.c >> +++ b/drivers/net/ethernet/xilinx/ll_temac_main.c >> @@ -821,7 +821,7 @@ static void ll_temac_recv(struct net_device *ndev) >> length = be32_to_cpu(cur_p->app4) & 0x3FFF; >> >> dma_unmap_single(ndev->dev.parent, be32_to_cpu(cur_p->phys), >> - length, DMA_FROM_DEVICE); >> + XTE_MAX_JUMBO_FRAME_SIZE, DMA_FROM_DEVICE); >> >> skb_put(skb, length); >> skb->protocol = eth_type_trans(skb, ndev); >> -- >> 2.4.11 >> > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel >