Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp243103pxj; Thu, 17 Jun 2021 01:31:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwNLJ727vRlVpePEotE4GNxbTMHh3WbLT2k7H7t3R0EkRgP/ICKxXm8+taNwZd/v6FYLuyG X-Received: by 2002:a50:934d:: with SMTP id n13mr4983660eda.17.1623918708218; Thu, 17 Jun 2021 01:31:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623918708; cv=none; d=google.com; s=arc-20160816; b=WmH/ip7BOSba+hTAv4oJC6GX2tAEmQTzmFU7/v3LiKV2dA3GAZ0yBXtfZ8BVy/ETFG FiD0z4ecyyX/bMvfR4OY+/CV2Dm8G1tK0bthq0WCGOobT8bCkXchs0ZfVOoXcQBzWM4U IIG0oX1KN5bOphwkmcod4cZrB82gSIHwPmYlYd1NTBMBc4KS0scVm3YQvkEFjeuN1xGt 6MF/PU4uHEAcNdU21C3r50ABJF9T5lAR9MlymU7un2aGZ6QvARikxh6EfJVYepy2Ny4j hqOrnqjogaoWuBo3qKD7oryFkEI1WE/mIx6IOD2BTQY/t3vLIahTwGgMgvUigUYSYfCd jZVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=aCrVXPjPleKRWCwRkIC1bYwcah/f3G21T+lRBwgsVZA=; b=HGZQlFEu/T2WCkP129EanLTVgpiYrvOSkdnaxEwrPYGZWdgfJo5DLwTyKom2b0/Vub VGhmn1KVVkDfWqfGAD6qyeHejjebUCUJAXjl6fhynzvigl11WjEJltHv83W+/9RX5GVT KUL+GZtEe+3BjXLvtaIQ7MUeXLsHLZBqfLB/5i9pCqE7en9ZHuNzGBFApSB5JxYp5Ppp I0jIzPc3YWcw4LPGvYNP8hj7CUadqlqRJ/6M4HAfeOjRUbmtXOZ+axnjEkbq9nqo/YOI NZ8bL0ZgshjRzHgL6xM94J0nkrHUtE0KjZbbSow7NOtq3fJeDopsckiZDBDWSsiHHgLi c2bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="Pq/9zMv+"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id a1si4994846eje.497.2021.06.17.01.31.24; Thu, 17 Jun 2021 01:31:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="Pq/9zMv+"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S229931AbhFQIch (ORCPT + 99 others); Thu, 17 Jun 2021 04:32:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230494AbhFQIcd (ORCPT ); Thu, 17 Jun 2021 04:32:33 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 188F8C06175F for ; Thu, 17 Jun 2021 01:30:26 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id gt18so8389561ejc.11 for ; Thu, 17 Jun 2021 01:30:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=aCrVXPjPleKRWCwRkIC1bYwcah/f3G21T+lRBwgsVZA=; b=Pq/9zMv+/ARBkhNnWG4THdQB8bofy/At19gV8bdA1AYnGgM1Y+ZCqupZ59ExgV0TsW jo/1MnZ5o7eW/siImByLzN0YUEjf6ZmYzdLHjI5qnJB8NW8Q6ltuE/Om5r0dolVo0KSi 8g+dpvas04ZWyRtIYuwghQACK06a9/bSZKCiY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=aCrVXPjPleKRWCwRkIC1bYwcah/f3G21T+lRBwgsVZA=; b=h9KXbYtCaBogM2uHUg+NMCO39MGZtilnG8G54rJK4/xZs7d3zhDDpUxsITiqaLAOm+ 8g/Jd/zibpSs/Nrm/rNjwd0aRurxJyKldbJYUUKI/VUD9feXNV5UmEdWFGQoHk7yn1gM 3FypmGi8qQLipoXcVOVNan6cI9joLbD04WiYjOh/R36gdvLgoQJdYMJ7Qbm04JS0qbAQ 15/gT1k77SIbc7OvJYiZzM0HbZ0jZ13IBwHfRG18Gv6d7P7ER7coPW4fZq+bt3t/tLYK +qIhvvcJviZtSN0QluDClaQP3l+7SqNss1a8RW/ULqxzbzaDfaq6/1mOxdz0xnMc+TDJ diKQ== X-Gm-Message-State: AOAM533U8STEXZ81GMGwWXgIUBEulu0VuUKVRiFx31Ws9KHtuTHMzCUL j9+YILKgNcBVHI1ahu18HU+rDUL3Hoa7pg== X-Received: by 2002:a17:906:3845:: with SMTP id w5mr4121927ejc.518.1623918624125; Thu, 17 Jun 2021 01:30:24 -0700 (PDT) Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com. [209.85.221.50]) by smtp.gmail.com with ESMTPSA id k21sm3681564edo.41.2021.06.17.01.30.23 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Jun 2021 01:30:23 -0700 (PDT) Received: by mail-wr1-f50.google.com with SMTP id i94so5729878wri.4 for ; Thu, 17 Jun 2021 01:30:23 -0700 (PDT) X-Received: by 2002:a05:6000:551:: with SMTP id b17mr4171056wrf.32.1623918622627; Thu, 17 Jun 2021 01:30:22 -0700 (PDT) MIME-Version: 1.0 References: <20210427131344.139443-1-senozhatsky@chromium.org> <20210427131344.139443-9-senozhatsky@chromium.org> <10a0903a-e295-5cba-683a-1eb89a0804ed@xs4all.nl> <20210617080107.GA1422@lst.de> In-Reply-To: <20210617080107.GA1422@lst.de> From: Tomasz Figa Date: Thu, 17 Jun 2021 17:30:11 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCHv2 8/8] videobuf2: handle non-contiguous DMA allocations To: Christoph Hellwig Cc: Sergey Senozhatsky , Hans Verkuil , Ricardo Ribalda , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 17, 2021 at 5:01 PM Christoph Hellwig wrote: > > 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. We still have use cases for dma_alloc_coherent() and DMA_ATTR_NO_KERNEL_MAPPING. Perhaps the way to handle this would be to make the dma_alloc_coherent() behave the same way as dma_alloc_noncontiguous(), where it just allocates the memory without handling the kernel mapping? Best regards, Tomasz