From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 912D1C49EA2 for ; Thu, 17 Jun 2021 08:01:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7DBD96101A for ; Thu, 17 Jun 2021 08:01:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230082AbhFQIDb (ORCPT ); Thu, 17 Jun 2021 04:03:31 -0400 Received: from verein.lst.de ([213.95.11.211]:57681 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230055AbhFQIDR (ORCPT ); Thu, 17 Jun 2021 04:03:17 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 0355768C4E; Thu, 17 Jun 2021 10:01:08 +0200 (CEST) Date: Thu, 17 Jun 2021 10:01:07 +0200 From: Christoph Hellwig To: Sergey Senozhatsky Cc: Hans Verkuil , Tomasz Figa , Ricardo Ribalda , Christoph Hellwig , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCHv2 8/8] videobuf2: handle non-contiguous DMA allocations Message-ID: <20210617080107.GA1422@lst.de> References: <20210427131344.139443-1-senozhatsky@chromium.org> <20210427131344.139443-9-senozhatsky@chromium.org> <10a0903a-e295-5cba-683a-1eb89a0804ed@xs4all.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 17, 2021 at 04:56:17PM +0900, Sergey Senozhatsky wrote: > > This function can use some comments. What is happening AFAICS is that > > buf->vaddr is either set in vb2_dc_alloc_coherent (unless > > DMA_ATTR_NO_KERNEL_MAPPING was set), it is obtained through dma_buf_vmap() > > if the buffer was attached to a dma_buf, or it is allocated via > > dma_vmap_noncontiguous() for non-coherent memory. > > Yeah, it's complicated. Maybe we can make things more symmetrical. > > > But this leaves coherent memory with DMA_ATTR_NO_KERNEL_MAPPING set, what > > is vaddr in that case? I think it will call dma_vmap_noncontiguous() > > incorrectly in that case, shouldn't there be a check for !buf->coherent_mem > > before the call to dma_vmap_noncontiguous()? > > Thanks a lot for looking into it. Can we just kill off DMA_ATTR_NO_KERNEL_MAPPING in v4l now? There really is no good reason to use that with dma_alloc_noncoherent/noncontiguous available, and I plan to eventually remove that interface entirely.