Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp781547yba; Fri, 26 Apr 2019 08:38:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqyjWKeA+J87Ux6HBEj6JWU2E3TmhSZgGtULT6Pyjtq1AN1hPs/tQmClJctx2hgalT3jqWP7 X-Received: by 2002:a62:6342:: with SMTP id x63mr680705pfb.34.1556293134057; Fri, 26 Apr 2019 08:38:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556293134; cv=none; d=google.com; s=arc-20160816; b=Fu3E+nt8Vc28YuYEVsg8QNucHRi/vUdkxgXTKFZak5uOQtj1I6si+/qNX4eG+qjoEn HDuXmwZWb3Q87Vra8rLoXV+G/+hrPaHb6rzPjhgTjH//va4TukkFUMIU2ImWtvYEMyrE BEnnVpYDeB/crMaIK4PuSQYexGcP9WqLX9e3gZBYwn2mszr9EFrzdlLbi9O8noibGpEF X8fimEeT1aDCMCM/pYyfil5gTHF2RX2bLedAVVPpelI6y2Fhj+T+BQWq4W6+RVxxJ6tA nLHygQ1wKHxGhrheNNNHOUUc6k+eLX14i1tk67ApwfO/ss78zc/gdKrWAw6Z1brc+Bak TwOQ== 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; bh=UvVB9YW+Vf/5xEb1JhQ4wi6DLqMa8+rWR925tLl65eQ=; b=n2h1eodzJfCoqJBcY7oA7bjBe7cq0paQkXSeDS7pvDWPRek3x9I5JvscRPgmweQ/KQ fplByH9lD107zJkMqyX07O9DHB58JdHaiNmOamJYJecFH+n+cSxi0jP3SsJrQAg6Fn4P Pstv6RRf++SXmpl2q5JZsCLyMZikARERnmiH3jpfXpGOFKOxUYaHnH5vRAOZw58kzuWC F7dngDD7RlxhaUGCfUTsVa0/GUQn/1gbDJHrVC6I2trJW3a98PpeNUVHGM2g5o+tRLF+ m17Is+0yVDO8JKmcRHxm9a9LBBZUuXsTsh+sl0Rt55oZT/1AisKOGJUFcJcH8J6lQu37 3/jA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lunn.ch header.s=20171124 header.b=1V4l2rJN; 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 y12si26328386plp.47.2019.04.26.08.38.38; Fri, 26 Apr 2019 08:38:54 -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=fail header.i=@lunn.ch header.s=20171124 header.b=1V4l2rJN; 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 S1726451AbfDZPhs (ORCPT + 99 others); Fri, 26 Apr 2019 11:37:48 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:45652 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726255AbfDZPhr (ORCPT ); Fri, 26 Apr 2019 11:37:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=UvVB9YW+Vf/5xEb1JhQ4wi6DLqMa8+rWR925tLl65eQ=; b=1V4l2rJNC2XkmV+VPpYk6e05n1 yhh4hA0pIi1FbejNCY/aQODoLBKLKb/ghS6x1aPtipzeL3xTxF4PBWq0RSCGhoTl178rMUBG/3tCO nqv8I5Rr18wzSZ9q08e0MM3B0aoKA5nY5sFt/QWC5HX6uTxmIuF3BaBLaTxQkMYagiN8=; Received: from andrew by vps0.lunn.ch with local (Exim 4.89) (envelope-from ) id 1hK2uv-000221-1a; Fri, 26 Apr 2019 17:37:37 +0200 Date: Fri, 26 Apr 2019 17:37:37 +0200 From: Andrew Lunn To: Robin Murphy Cc: Esben Haabendal , 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 Subject: Re: [PATCH 08/12] net: ll_temac: Fix iommu/swiotlb leak Message-ID: <20190426153737.GC4041@lunn.ch> References: <20190426073231.4008-1-esben@geanix.com> <20190426073231.4008-9-esben@geanix.com> <20190426142103.GI14432@lunn.ch> <0aab6152-82c6-b53f-6b9b-0905995de43a@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0aab6152-82c6-b53f-6b9b-0905995de43a@arm.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 26, 2019 at 03:43:20PM +0100, Robin Murphy wrote: > 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. Hi Robin Thanks for the info. I went back to the driver i was thinking of, and it is using dma_sync_single_range_for_cpu() for just the received packet length. Sorry for the mixup. Andrew