Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3360412ybv; Mon, 24 Feb 2020 23:46:50 -0800 (PST) X-Google-Smtp-Source: APXvYqwg7wX5HNg6blhDC7oWcGR5/H+nna2KdluusgcU8eVDCEMydjktVtges0cN6HsZPiHWINt2 X-Received: by 2002:a05:6808:6cd:: with SMTP id m13mr1460243oih.53.1582616810251; Mon, 24 Feb 2020 23:46:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582616810; cv=none; d=google.com; s=arc-20160816; b=Qe0o2kfIT5N+hP7wqSCqk4RJsOAIk0ZqUuElfOqkvTGJzAPcXB/ODub8xnqecZrBRX 7ki3jwasOLR3lpoKm7tQPjtTqmHHeWb1Ph75sDShv61Ht1TnYEotYeACPEuJwee0mKKq GAwzY3vo49kL+pRYqg2hoN3dU4c6WxBbUV4jduBzqZyxOFmUBPmnHuaTFAmmtia5VkSJ pfYX9Cu2aW+U0SlrnET5WUhDGvyeQKR2u12fEwq5+X1g4L2u4g2duszdgdrzEGJuJNCe w9r6U27bNmFlR5McsFLbZS87f4bdO4SBdz9m1UD0po71JZvIRc3WhEWTUa53rCJmgSSk lSzg== 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=Y3Ufh0kd/NDODhpeTidFsO93dE8ZQpNceOjFTvbhgb0=; b=gdx0f3h+5hdAWIAmDCojFVmR8C0Nh7xbTDzrIspPpmYr5zBBAXeEtaWwGjVawjJvIw 6lF/AI505ur43aWR+KLtSOmfBL3LFGoX7ghoJmhVpWZ+kGdcjt96JiJuLaKpfIqCAi30 mrSgHDJqjlP1QfsN58z+K0IDOR6pXu+DDFgQR/o5ciY5I6FHgtKp2jJUAetHVXocFykT hrkVGBIs/4Dv04HLdWIi4qXBODB3x7mkXl2uSNcQUj+JzkTMgKCZO2QBFB96RbXW6nGF evaOTLMOXN0EqV7FnRUpfk5Nsobv8gyQ9wcW7GPjNzsbNRnAPZneQqejexmRVjWlGZDS ffuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="nOYYA/Ac"; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i6si8548533otj.24.2020.02.24.23.46.38; Mon, 24 Feb 2020 23:46:50 -0800 (PST) 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=@chromium.org header.s=google header.b="nOYYA/Ac"; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729580AbgBYHpQ (ORCPT + 99 others); Tue, 25 Feb 2020 02:45:16 -0500 Received: from mail-pj1-f66.google.com ([209.85.216.66]:32787 "EHLO mail-pj1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725837AbgBYHpQ (ORCPT ); Tue, 25 Feb 2020 02:45:16 -0500 Received: by mail-pj1-f66.google.com with SMTP id m7so783087pjs.0 for ; Mon, 24 Feb 2020 23:45:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Y3Ufh0kd/NDODhpeTidFsO93dE8ZQpNceOjFTvbhgb0=; b=nOYYA/Ac6VFG5NfRwmfAEJ4IfTRDbeldgM5X2zcA5j8Z7IlkgVRdAzrr9kqhw+RXl9 PZ39EN+SDpiIdCNOXZvzsevW2JA/Feb/cDugzP93qv5XtrRr4gbks1lXmyHSo2urpH4x OuzrRkfTrfKDKf27hmfoyzc8mTl5Bw1EANs1s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Y3Ufh0kd/NDODhpeTidFsO93dE8ZQpNceOjFTvbhgb0=; b=DJCJypcnJYiHprrInRhQckm/UeOXWC2hdk41gp56DbBfDe3Zi5qvOjE9aTtCn5cdj9 +8dtAkuO7f8fvyxPfu/GXPNY9kZqIfEzDe/5CpWGBdXof9JYUHinMLVb5VrhGd4dolTd YfxK4DKyeA+neKw4LWjbkoXk1RwJZG3HX1Nvz96ZYrQwHn1X9ibeddtS9gzW1XDQVKgK SO1UeiR/0J6ZPAWSnBS0HvJ1kYsGvWs4WVmkpRXJDWhN5mgEAZ77PPf4vgwcldBwf3Jg BZzjFzcieVF04siTvG06582nnwq1LRvFKSDZk3F3FJvgl3Hc/U4jwd0SuzZ0KXGAfmWU eWrA== X-Gm-Message-State: APjAAAVEIXFIujthjstUJiVrhbC0+IhsGu9JYlxVuAU2E9ytTrCVLgSK C/+kZVFYgSyRZq2Zk29DKvuAu/MHT7M= X-Received: by 2002:a17:90b:f06:: with SMTP id br6mr3598849pjb.125.1582616715978; Mon, 24 Feb 2020 23:45:15 -0800 (PST) Received: from localhost ([2401:fa00:8f:203:5bbb:c872:f2b1:f53b]) by smtp.gmail.com with ESMTPSA id 3sm1952581pjg.27.2020.02.24.23.45.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Feb 2020 23:45:15 -0800 (PST) Date: Tue, 25 Feb 2020 16:45:12 +0900 From: Sergey Senozhatsky To: Hans Verkuil Cc: Sergey Senozhatsky , Hans Verkuil , Tomasz Figa , Mauro Carvalho Chehab , Kyungmin Park , Marek Szyprowski , Sakari Ailus , Laurent Pinchart , Pawel Osciak , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC][PATCHv2 03/12] videobuf2: add V4L2_FLAG_MEMORY_NON_CONSISTENT flag Message-ID: <20200225074512.GG122464@google.com> References: <20200204025641.218376-1-senozhatsky@chromium.org> <20200204025641.218376-4-senozhatsky@chromium.org> <17e99adc-d86d-ebd3-ab52-d6c8e3ac14f3@xs4all.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <17e99adc-d86d-ebd3-ab52-d6c8e3ac14f3@xs4all.nl> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (20/02/19 09:56), Hans Verkuil wrote: > > +Memory Consistency Flags > > +======================== > > + > > +.. tabularcolumns:: |p{7.0cm}|p{2.2cm}|p{8.3cm}| > > + > > +.. cssclass:: longtable > > + > > +.. flat-table:: > > + :header-rows: 0 > > + :stub-columns: 0 > > + :widths: 3 1 4 > > + > > + * .. _`V4L2_FLAG_MEMORY_NON_CONSISTENT`: > > + > > + - ``V4L2_FLAG_MEMORY_NON_CONSISTENT`` > > + - 0x00000001 > > + - vb2 buffer is allocated either in consistent (it will be automatically > > + coherent between CPU and bus) or non-consistent memory. The latter > > + can provide performance gains, for instance CPU cache sync/flush > > + operations can be avoided if the buffer is accesed by the corresponding > > + device only and CPU does not read/write to/from that buffer. However, > > + this requires extra care from the driver -- it must guarantee memory > > + consistency by issuing cache flush/sync when consistency is needed. > > + If this flag is set V4L2 will attempt to allocate vb2 buffer in > > + non-consistent memory. This flag is ignored if queue does not report > > + :ret:`V4L2_BUF_CAP_SUPPORTS_CACHE_HINTS` capability. > > This flag only makes sense for the MMAP memory model, right? That should be > documented and checked in the code. Not all buffer allocators respect DMA attrs (V4L2_FLAG_MEMORY_NON_CONSISTENT is a DMA attribute) even if we use MMAP memory model. Right? E.g. dma-cont does, dma-sg - does not. So the list is: a) buffer allocated for MMAP I/O b) buffer allocator which does not allocate pages from kernel page allocator c) queue that supports user space cache hints If the driver does not set vb2_dma_contig_memops as q->mem_ops then that queue should not have ->allow_cache_hints set. But even if it does, the flag is ignored by the allocator. So maybe the text can be: + ................... The flag takes effect only if the buffer is + used for :ref:`memory mapping ` I/O and the queue reports + :ref:`V4L2_BUF_CAP_SUPPORTS_CACHE_HINTS` capability. -ss