Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp4132009imm; Mon, 15 Oct 2018 09:33:49 -0700 (PDT) X-Google-Smtp-Source: ACcGV63teN9ZGoah0eWQ8H0gyYP00GbBJpSawpQckozbspLSDDY9c4ESIj/RrL7/Kki07cSMuWAd X-Received: by 2002:a63:b518:: with SMTP id y24-v6mr16831125pge.436.1539621229626; Mon, 15 Oct 2018 09:33:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539621229; cv=none; d=google.com; s=arc-20160816; b=ybvDXNjwuJxXzokiTUfv+560RHCOBR9+JNhnFVkotkk4dQbBWC7xqp3nwTvQbgKYnY LWigX26p30AJrUSlK2jy4ofvOzdT4AdaPYq2I1NK3UUM8+jOlqSOfB9G/T3rijVSU+aJ YyhJuFUdboMp7kBiDWcCXE7f7nUMe+8MHBKzGVvSL/unE/RIlOqZOCPGQJfnhZNxcZW3 hpmm0jJxjBAUORPH3AkG/5y3n/fKqNN1XzLVamc7Z2svpyzsRiUNqPVcXrnG2nRzy1lB VizlubpE+LZC4fW8eA9cSeGirXcF70LOWMAlx+FNx/aqd880w01HuEoUOV+UMHZ+1kv8 OF5Q== 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 :references:in-reply-to:mime-version:dkim-signature; bh=KeUgfrRpWE72zBPh4Kygg+VGy+NEqZUncQZ0Fk0rFm0=; b=nidcDe6CXpno5rzEhrT7EEvkxgVpTsIb6M2L+ZDqNXX5iOnU0GshEemO6nbIw66t0o EHkqdNT1D2O1k8Il/b6MclCOEK9Cj5NHlau7CAYwJKHKaHvTG/ucW40KCmREekhJiARh DlF9TQv6gKtj5UBD6v/2OXdfqT57XElKzjsfde1PdMtj7V0WPpUuQVYQRorIguz+8ocu pmnIyedOoky7LzkjJwrRHcnvaxmpXi8ailvwSkqRthMM+0RWCkPJGr6mAt0r6fk1XiKT u9mRE7mOhyqhobe5BlC/mWgFAAtc0raQadsM/l8q/7GRrxILGSNMPvt8OjoU+1wQzrlc uQXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AhWrG6Mc; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b2-v6si11744695plm.25.2018.10.15.09.33.34; Mon, 15 Oct 2018 09:33:49 -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=pass header.i=@linaro.org header.s=google header.b=AhWrG6Mc; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726955AbeJPARc (ORCPT + 99 others); Mon, 15 Oct 2018 20:17:32 -0400 Received: from mail-wm1-f48.google.com ([209.85.128.48]:53089 "EHLO mail-wm1-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726528AbeJPARc (ORCPT ); Mon, 15 Oct 2018 20:17:32 -0400 Received: by mail-wm1-f48.google.com with SMTP id 189-v6so19577972wmw.2 for ; Mon, 15 Oct 2018 09:31:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=KeUgfrRpWE72zBPh4Kygg+VGy+NEqZUncQZ0Fk0rFm0=; b=AhWrG6McY7FU1bo66+AhpG/raP+asDFfc7wxmvwtRTg+M+T1xJlKSV+Nes8Oyo2TrX W33nP+LjVSkElhDRun3yNSPkb4ZHizLfXJEqIyodEv4UT0iQIKjoYu8jDwOs6rCtuyzg UBDREibVuviIxXNoMreI/hIlr9hQY17Fc+s0Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=KeUgfrRpWE72zBPh4Kygg+VGy+NEqZUncQZ0Fk0rFm0=; b=K1QA3oOsFeuS4N6/qPCN/A/631aJbHv2vrsssQrkP4pSjivuYMrq1u1OXhOOTb8RMY XWSlZXkMQzaXQh2zvBbaN8txokzfu98vwlQAZv1c56Cke0dfzPwGCIEcryKvE7J9Wo75 5hzCleGmrIc0Hf5+7Yr6gyBXsS+QbyS3wXW8CPrw3t9I71+qL5RRnmIT8UafvkEVpzBI n5PQUc4TagQHmwiOnisuLKlYeoFKabWRCS48lHcES7ltvSznz/3UBpmdHJv566uuAEYP lNM4OfrOuGckArPcCpnfax09XcgnkYZMw4UJiWWdpjdChs0STEuwbeAqo5rcEQkQu83l f7BA== X-Gm-Message-State: ABuFfoitS7TgS59V/4GfzJiCqxNYgJg64IHZ826rvqF9UM8Il5J1WsuM +mJOpkFYhvOgiB77EVa4txRl7oLBiDn9KZSR7V3Qyw== X-Received: by 2002:a1c:1452:: with SMTP id 79-v6mr13341058wmu.31.1539621093761; Mon, 15 Oct 2018 09:31:33 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a1c:b485:0:0:0:0:0 with HTTP; Mon, 15 Oct 2018 09:31:32 -0700 (PDT) In-Reply-To: References: <1539214413-26173-1-git-send-email-john.stultz@linaro.org> <7534ca1d-f874-7809-6125-d9fc72f70e39@redhat.com> From: John Stultz Date: Mon, 15 Oct 2018 09:31:32 -0700 Message-ID: Subject: Re: [PATCH] staging: ion: Rework ion_map_dma_buf() to minimize re-mapping To: Liam Mark Cc: Laura Abbott , lkml , Beata Michalska , Matt Szczesiak , Anders Pedersen , John Reitan , Sumit Semwal , Greg Kroah-Hartman , Todd Kjos , Martijn Coenen , dri-devel 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 Sat, Oct 13, 2018 at 11:01 PM, Liam Mark wrote: > On Fri, 12 Oct 2018, Laura Abbott wrote: >> I thought there might have been some Qualcomm >> stuff that did that (Liam? Todd?) > > Yes we have a form of "lazy mapping", which clients can opt into using, > which results in iommu page table mapping not being unmaped on dma-unamp. > Instead they are unmapped when the buffer is destroyed. > > It is important to note that in our "lazy mapping" implementation cache > maintenance is still applied on dma-map and dma-unmap. > If you need a full description of this feature I can provide it. > >> >> I suspect most of the cost of the dma_map/dma_unmap is from the >> cache flushing and not the actual mapping operations. If this >> is the case, another option might be to figure out how to >> incorporate dma_attrs so drivers can use DMA_ATTR_SKIP_CPU_SYNC >> to decide when they actually want to sync. > > We have support for this locally on our 4.14 branch. > > We have added a dma_map_attrs field to the dma_buf_attachment struct, > clients can then specify dma-attributes here such as > DMA_ATTR_SKIP_CPU_SYNC before dma-mapping the buffer, then we ensure that > these dma attributes are passed to dma_map_sg_attrs when ion_map_dma_buf > is called (same for ion_unmap_dma_buf). Do you happen to have a pointer to the tree if its public? thanks -john