Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp6537581rwi; Mon, 24 Oct 2022 02:48:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7r5gErfmUZEa1/vNwXQiTVbr4IpwKm6baO5fEa89wUXSGH2oN26uWlDywJFIMpBx0BTY8a X-Received: by 2002:a17:90b:4b42:b0:20d:954e:28d with SMTP id mi2-20020a17090b4b4200b0020d954e028dmr71031265pjb.93.1666604881466; Mon, 24 Oct 2022 02:48:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666604881; cv=none; d=google.com; s=arc-20160816; b=yAiKohCquPmhSmba0VYZu/JOEnR2jAk002VtWjaOZ1z4cT4LdabWUcrgRql3A/pZ/a uUWaf1LjDIBgCqtlo+eRuOVaX4kasW/pN8/9Ez0VLlSsJJkn9/XB8ePObQ/8Xx3DCpdg 4/nWMr66ppcxF4XXNORvq9bQapQzwVuloSUrQT4GasfbYZDl0uH7aCYAhz37vMcNJra2 8plv3uxGVmj/V8zESmYYCIRRlNcOrd7UL5rN1wLTDLWh3uR12q/NDQu7hwCbBqmDyFMQ elQk/EhN5bL3tSuh6emH7k4X0f4uAs6uDTVq2GFbFZrLCS8OszPEUNP7HJ/GecIV13/X iReA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=Uzjd6J9y5OUAKYa8hd/MLuAKT4EXh+yaKGInY+oPewU=; b=i53BGzsmq0n/7p6esB8KEKxGr0XLf3iZWgOYe9xp+y8ulxA1VF6BmqsUEYFPq8XBtu 28n0hlicujBQOQPswcbiFXDvrPnJCzH/0NuLqiorHmpIvmz/6mRZeX3Cbu1beOZ1/Ixs 4etJiGVDSTQtFLUUPuHXQ7kthVOZlgIrjxGyOTJLnWd+M/pVF88eUHDeXBt6WC4lAqNw 2fiOTyW7yAp95E+OokEac87TM2GADrWkUXK/1A1gjyEMs+CDxHO1UJR/YRbMtKsmvWI3 tszvdtigVeNegAKjFTKn1RjpfNxKgKBwkDDVMgewmQ6v4MGnmGtE0aC4M2QiWKl++HsL gCLQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q1-20020a056a00150100b005631ca6aad7si2274442pfu.258.2022.10.24.02.47.50; Mon, 24 Oct 2022 02:48:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229841AbiJXJT5 (ORCPT + 99 others); Mon, 24 Oct 2022 05:19:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229983AbiJXJTs (ORCPT ); Mon, 24 Oct 2022 05:19:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59B1310FDC; Mon, 24 Oct 2022 02:19:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 119F76112D; Mon, 24 Oct 2022 09:19:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8BE8C433C1; Mon, 24 Oct 2022 09:19:26 +0000 (UTC) Message-ID: <76dc6599-3b24-918c-ba08-77c3192c5c04@xs4all.nl> Date: Mon, 24 Oct 2022 11:19:25 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.2 Subject: Re: [PATCH v7 13/21] media: videobuf2: Prepare to dynamic dma-buf locking specification Content-Language: en-US To: Dmitry Osipenko , David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Daniel Vetter , Daniel Almeida , Gert Wollny , Gustavo Padovan , Daniel Stone , Tomeu Vizoso , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Clark , Sumit Semwal , =?UTF-8?Q?Christian_K=c3=b6nig?= , "Pan, Xinhui" , Thierry Reding , Tomasz Figa , Marek Szyprowski , Mauro Carvalho Chehab , Alex Deucher , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , =?UTF-8?Q?Thomas_Hellstr=c3=b6m?= , Qiang Yu , Srinivas Kandagatla , Amol Maheshwari , Jason Gunthorpe , Leon Romanovsky , Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko , Tomi Valkeinen , Russell King , Lucas Stach , Christian Gmeiner , Ruhl Michael J Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Dmitry Osipenko , linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org, amd-gfx@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, kernel@collabora.com, virtualization@lists.linux-foundation.org, linux-rdma@vger.kernel.org, linux-arm-msm@vger.kernel.org References: <20221017172229.42269-1-dmitry.osipenko@collabora.com> <20221017172229.42269-14-dmitry.osipenko@collabora.com> From: Hans Verkuil In-Reply-To: <20221017172229.42269-14-dmitry.osipenko@collabora.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,NICE_REPLY_A,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/17/22 19:22, Dmitry Osipenko wrote: > Prepare V4L2 memory allocators to the common dynamic dma-buf locking > convention by starting to use the unlocked versions of dma-buf API > functions. > > Acked-by: Tomasz Figa Acked-by: Hans Verkuil Thanks! Hans > Acked-by: Christian König > Signed-off-by: Dmitry Osipenko > --- > drivers/media/common/videobuf2/videobuf2-dma-contig.c | 11 ++++++----- > drivers/media/common/videobuf2/videobuf2-dma-sg.c | 8 ++++---- > drivers/media/common/videobuf2/videobuf2-vmalloc.c | 6 +++--- > 3 files changed, 13 insertions(+), 12 deletions(-) > > diff --git a/drivers/media/common/videobuf2/videobuf2-dma-contig.c b/drivers/media/common/videobuf2/videobuf2-dma-contig.c > index 678b359717c4..79f4d8301fbb 100644 > --- a/drivers/media/common/videobuf2/videobuf2-dma-contig.c > +++ b/drivers/media/common/videobuf2/videobuf2-dma-contig.c > @@ -101,7 +101,7 @@ static void *vb2_dc_vaddr(struct vb2_buffer *vb, void *buf_priv) > if (buf->db_attach) { > struct iosys_map map; > > - if (!dma_buf_vmap(buf->db_attach->dmabuf, &map)) > + if (!dma_buf_vmap_unlocked(buf->db_attach->dmabuf, &map)) > buf->vaddr = map.vaddr; > > return buf->vaddr; > @@ -711,7 +711,7 @@ static int vb2_dc_map_dmabuf(void *mem_priv) > } > > /* get the associated scatterlist for this buffer */ > - sgt = dma_buf_map_attachment(buf->db_attach, buf->dma_dir); > + sgt = dma_buf_map_attachment_unlocked(buf->db_attach, buf->dma_dir); > if (IS_ERR(sgt)) { > pr_err("Error getting dmabuf scatterlist\n"); > return -EINVAL; > @@ -722,7 +722,8 @@ static int vb2_dc_map_dmabuf(void *mem_priv) > if (contig_size < buf->size) { > pr_err("contiguous chunk is too small %lu/%lu\n", > contig_size, buf->size); > - dma_buf_unmap_attachment(buf->db_attach, sgt, buf->dma_dir); > + dma_buf_unmap_attachment_unlocked(buf->db_attach, sgt, > + buf->dma_dir); > return -EFAULT; > } > > @@ -750,10 +751,10 @@ static void vb2_dc_unmap_dmabuf(void *mem_priv) > } > > if (buf->vaddr) { > - dma_buf_vunmap(buf->db_attach->dmabuf, &map); > + dma_buf_vunmap_unlocked(buf->db_attach->dmabuf, &map); > buf->vaddr = NULL; > } > - dma_buf_unmap_attachment(buf->db_attach, sgt, buf->dma_dir); > + dma_buf_unmap_attachment_unlocked(buf->db_attach, sgt, buf->dma_dir); > > buf->dma_addr = 0; > buf->dma_sgt = NULL; > diff --git a/drivers/media/common/videobuf2/videobuf2-dma-sg.c b/drivers/media/common/videobuf2/videobuf2-dma-sg.c > index fa69158a65b1..36ecdea8d707 100644 > --- a/drivers/media/common/videobuf2/videobuf2-dma-sg.c > +++ b/drivers/media/common/videobuf2/videobuf2-dma-sg.c > @@ -309,7 +309,7 @@ static void *vb2_dma_sg_vaddr(struct vb2_buffer *vb, void *buf_priv) > > if (!buf->vaddr) { > if (buf->db_attach) { > - ret = dma_buf_vmap(buf->db_attach->dmabuf, &map); > + ret = dma_buf_vmap_unlocked(buf->db_attach->dmabuf, &map); > buf->vaddr = ret ? NULL : map.vaddr; > } else { > buf->vaddr = vm_map_ram(buf->pages, buf->num_pages, -1); > @@ -565,7 +565,7 @@ static int vb2_dma_sg_map_dmabuf(void *mem_priv) > } > > /* get the associated scatterlist for this buffer */ > - sgt = dma_buf_map_attachment(buf->db_attach, buf->dma_dir); > + sgt = dma_buf_map_attachment_unlocked(buf->db_attach, buf->dma_dir); > if (IS_ERR(sgt)) { > pr_err("Error getting dmabuf scatterlist\n"); > return -EINVAL; > @@ -594,10 +594,10 @@ static void vb2_dma_sg_unmap_dmabuf(void *mem_priv) > } > > if (buf->vaddr) { > - dma_buf_vunmap(buf->db_attach->dmabuf, &map); > + dma_buf_vunmap_unlocked(buf->db_attach->dmabuf, &map); > buf->vaddr = NULL; > } > - dma_buf_unmap_attachment(buf->db_attach, sgt, buf->dma_dir); > + dma_buf_unmap_attachment_unlocked(buf->db_attach, sgt, buf->dma_dir); > > buf->dma_sgt = NULL; > } > diff --git a/drivers/media/common/videobuf2/videobuf2-vmalloc.c b/drivers/media/common/videobuf2/videobuf2-vmalloc.c > index 948152f1596b..7831bf545874 100644 > --- a/drivers/media/common/videobuf2/videobuf2-vmalloc.c > +++ b/drivers/media/common/videobuf2/videobuf2-vmalloc.c > @@ -376,7 +376,7 @@ static int vb2_vmalloc_map_dmabuf(void *mem_priv) > struct iosys_map map; > int ret; > > - ret = dma_buf_vmap(buf->dbuf, &map); > + ret = dma_buf_vmap_unlocked(buf->dbuf, &map); > if (ret) > return -EFAULT; > buf->vaddr = map.vaddr; > @@ -389,7 +389,7 @@ static void vb2_vmalloc_unmap_dmabuf(void *mem_priv) > struct vb2_vmalloc_buf *buf = mem_priv; > struct iosys_map map = IOSYS_MAP_INIT_VADDR(buf->vaddr); > > - dma_buf_vunmap(buf->dbuf, &map); > + dma_buf_vunmap_unlocked(buf->dbuf, &map); > buf->vaddr = NULL; > } > > @@ -399,7 +399,7 @@ static void vb2_vmalloc_detach_dmabuf(void *mem_priv) > struct iosys_map map = IOSYS_MAP_INIT_VADDR(buf->vaddr); > > if (buf->vaddr) > - dma_buf_vunmap(buf->dbuf, &map); > + dma_buf_vunmap_unlocked(buf->dbuf, &map); > > kfree(buf); > }