Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp2105777lqe; Tue, 9 Apr 2024 09:37:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU/kWUU+A8/zf+2hoEOqfkONdkdefwrx+VwQbuAT7kGeRAmvyjUczPCVNDifWll3wAjnhr/nDmtRqFo+2SjisjZr2OMjHEFg70+05m06w== X-Google-Smtp-Source: AGHT+IHFPZDVVqcR+3BfQe43+yrHM+56sBeiB/fFQyDBIdMJUJ5MhrFm4J/ppugFFKLzuIpfRhWd X-Received: by 2002:a05:6218:2816:b0:183:8bc6:82b with SMTP id vv22-20020a056218281600b001838bc6082bmr418741rwc.28.1712680652752; Tue, 09 Apr 2024 09:37:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712680652; cv=pass; d=google.com; s=arc-20160816; b=M+A0pVdxWqiovIrfWNz77kTNpAY0VHzAz2mATQpkowHBWO7TmWE1Q9ZzDWin4/5WSj QM9MG/iKSA3u8RyIEw/IQAZ3KlNeSeLHJhONNZ6FcDIwiJA5/0WwX96SK0iNTpOQEAAU qbT5VPrv8BRLow6PDMfJzO4RVoMOFIv4BojZ5NS/k3j0j0CRPtyCLVMVUxAjlebm2VwW SZqt+cNBmQWlJ3LJZRda60UOO3G/jmCjnlfb+Gn9g7yrPoXiJ42QNRy5C1T2AwMyoR0f ImrpH2D4eqe0NlpKGxhHI2gyhM2C+GrxRFZ/eK84Egk9UcCVJfzqmU1zIN3PBsoBwbKb bLSw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=VWrgc6fSc3w4dKU6IsZCUM+SMdZmjryY3zaMUJ1lg5M=; fh=0ZFthaNA0Bxg7DiuvoLDjJp84YAyaleFddr7U7DulaY=; b=tSRs+TQnSa276+IZICa7oOe01Bm5/rxG8S4RCP/iqt3ZUNpVDJP4aHZB0VCMiMdNxl lgFB3OiOTFB2JwmS3gpIIppvqP+wC+GF834q317nzl5e7EnITfsnZOei4lYzVkIXjqka CZ9c5JQOzROzAnePEAz61p4Iu8w/sP9YpEpGAn9U4hD/3gBrq9FgxOiI6bRwt0DwxxZh yiADAomZ68DsLLtv9NjUKDD6focMIhIJmKRMdblEySHm8w4cnxtFbYgLfNJUf11SKnRj 1ZTLHLA11jsPwioHdcAU4rBWzSS7tOR37uzpsDcmzhMasy8UMV7FWr2fayNL1E0iKBkD DxZQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=uGGXWA65; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-137333-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137333-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 130-20020a630188000000b005e27218564asi8543032pgb.157.2024.04.09.09.37.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 09:37:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-137333-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=uGGXWA65; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-137333-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137333-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 63A142839E0 for ; Tue, 9 Apr 2024 16:37:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C403C15358F; Tue, 9 Apr 2024 16:37:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="uGGXWA65" Received: from mail-yb1-f171.google.com (mail-yb1-f171.google.com [209.85.219.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6FFBB153574 for ; Tue, 9 Apr 2024 16:37:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712680641; cv=none; b=Z0/nYvW3RpBlIvyXI3UwIKvAJeVR2mX1uWNN4s+oZZfpv0nVn4avJWF5hFCbrdXD/ulGpzbYTNed0g8Jc1MJQSEquj2Qrml73Y/FzpBLxdTbM4e6WxVAj8nfSEeF6axoCV9Pk2fBhXzY2Q2Kvdcw+sMyMIFmGw4zNvpZS1lvrUI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712680641; c=relaxed/simple; bh=HdCPsHozXYwytuqNw0ZGiEDF8p+ZYozg6NI6BJrhggw=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=rbMmlaT54AdnvCaFHwUJf/cqp+XyVsS1Tij7TONUeyINETkK/t4neGxdlH640feBwsOZCQkLY7qNYH3hi4ZdFYyYciAurmGfHzXUalkwt/y0aO6AFBpOodQSCxP3jjRQUyZ96gVRnMbDHMyr+UQorRR4EjsI+TJtF7gx2mwLgho= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=uGGXWA65; arc=none smtp.client-ip=209.85.219.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-yb1-f171.google.com with SMTP id 3f1490d57ef6-dc742543119so5592291276.0 for ; Tue, 09 Apr 2024 09:37:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1712680639; x=1713285439; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=VWrgc6fSc3w4dKU6IsZCUM+SMdZmjryY3zaMUJ1lg5M=; b=uGGXWA65SXFIIj2rsXWkBxBOk3P8Bnitw0HHVrRv3Y1Pm8FMSQE6N9O2Ax54Bfjusr KPmgw/Bd57hKZkE40jDYgve8SIuxkKTbP6eEs6zTpAMwesNgNjKBpa6Okx5LS7X0y77g 3QdzW8HB95QZPmxtT7ot9q0IpM28mQetfoFb9gCZCfBN59nBzFdS2L0XA6B+zxjZAsEa D1hpi2n0MgB7+XCBajpI+c5LTe8j7KCd6iUpNkVeLTpAd6nM1GgtxI+kyG4Uu4314+mn pBDm710ePO9fJ42fOJyURyF2CKocu+y+U8LKpzP67GmyU3rpNcstS/sH8cLQzar3eC+O rLOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712680639; x=1713285439; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VWrgc6fSc3w4dKU6IsZCUM+SMdZmjryY3zaMUJ1lg5M=; b=Ca4DD4hErhqHQsblftLg9gkNwNM+9nUSwHvynw1c4+J1d54Iab8hkNyvnn1b+wNh5D Cy2eS8Iv2So4dpvwCKLCQsa9ffqci/Ayc3nAqelzGTXz71Y0NFzKj09nYsgmNAGdOg9P Zfm2tJjspHnGOXdAWbcTMjeSENek9MVg3bhC+MvlCnVjyJx7xCR7+eH84XddgO7Mgdpl 6GL5xREWsuUjdHPB05s41ckvxUzgEoVBO8/CdXON8wjAgdd5Xtv1BWtz375LiVlnaHDM mh5wfDOXet8XR9+n3bsZJTrCOhO1ex2d0ULvRtNfiP4Cr3wXwsqD30b4DbX6X31L3YSJ GgYA== X-Forwarded-Encrypted: i=1; AJvYcCWfnIYc460WHhpvdGc7jfTlj9YECO9oVVt53fS3AgwSroVi7jweTDKnKsDr7u7qwnWuYexMOkx+bW/r19mzKzbw9EP+1XLHoqh6eeI+ X-Gm-Message-State: AOJu0YzOLN01mQthIfDS8IMN5Ur5gxdhn8wV/40JBtTs3lDW9C7nw8n/ NGK/YbSLxPNY/Euxd6KmCwRjpcIx7SymEREXdc99od5EiezOsdf54To2Zf6Eq/K9LlxQujdGl1D oa2kZ4+mD1xC+b/XM+8nCgfCiuqWyMHb0/N05 X-Received: by 2002:a5b:cc8:0:b0:de0:de50:d6d4 with SMTP id e8-20020a5b0cc8000000b00de0de50d6d4mr296806ybr.8.1712680639127; Tue, 09 Apr 2024 09:37:19 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20211113062222.3743909-1-jay.xu@rock-chips.com> <1da5cdf0-ccb8-3740-cf96-794c4d5b2eb4@amd.com> <3175d41a-fc44-4741-91ac-005c8f21abb8@vivo.com> <9e6f1f52-db49-43bb-a0c2-b0ad12c28aa1@amd.com> <5c7ac24c-79fa-45fc-a4fd-5b8fc77a741b@vivo.com> In-Reply-To: <5c7ac24c-79fa-45fc-a4fd-5b8fc77a741b@vivo.com> From: "T.J. Mercier" Date: Tue, 9 Apr 2024 09:37:07 -0700 Message-ID: Subject: Re: [PATCH] dma-buf: add DMA_BUF_IOCTL_SYNC_PARTIAL support To: Rong Qianfeng <11065417@vivo.com> Cc: =?UTF-8?Q?Christian_K=C3=B6nig?= , Rong Qianfeng , Jianqun Xu , sumit.semwal@linaro.org, pekka.paalanen@collabora.com, daniel.vetter@ffwll.ch, jason@jlekstrand.net, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Apr 9, 2024 at 12:34=E2=80=AFAM Rong Qianfeng <11065417@vivo.com> w= rote: > > > =E5=9C=A8 2024/4/8 15:58, Christian K=C3=B6nig =E5=86=99=E9=81=93: > > Am 07.04.24 um 09:50 schrieb Rong Qianfeng: > >> [SNIP] > >>> Am 13.11.21 um 07:22 schrieb Jianqun Xu: > >>>> Add DMA_BUF_IOCTL_SYNC_PARTIAL support for user to sync dma-buf with > >>>> offset and len. > >>> > >>> You have not given an use case for this so it is a bit hard to > >>> review. And from the existing use cases I don't see why this should > >>> be necessary. > >>> > >>> Even worse from the existing backend implementation I don't even see > >>> how drivers should be able to fulfill this semantics. > >>> > >>> Please explain further, > >>> Christian. > >> Here is a practical case: > >> The user space can allocate a large chunk of dma-buf for > >> self-management, used as a shared memory pool. > >> Small dma-buf can be allocated from this shared memory pool and > >> released back to it after use, thus improving the speed of dma-buf > >> allocation and release. > >> Additionally, custom functionalities such as memory statistics and > >> boundary checking can be implemented in the user space. > >> Of course, the above-mentioned functionalities require the > >> implementation of a partial cache sync interface. > > > > Well that is obvious, but where is the code doing that? > > > > You can't send out code without an actual user of it. That will > > obviously be rejected. > > > > Regards, > > Christian. > > In fact, we have already used the user-level dma-buf memory pool in the > camera shooting scenario on the phone. > > From the test results, The execution time of the photo shooting > algorithm has been reduced from 3.8s to 3s. > For phones, the (out of tree) Android version of the system heap has a page pool connected to a shrinker. That allows you to skip page allocation without fully pinning the memory like you get when allocating a dma-buf that's way larger than necessary. If it's for a camera maybe you need physically contiguous memory, but it's also possible to set that up. https://android.googlesource.com/kernel/common/+/refs/heads/android14-6.1/d= rivers/dma-buf/heaps/system_heap.c#377 > To be honest, I didn't understand your concern "...how drivers should be > able to fulfill this semantics." Can you please help explain it in more > detail? > > Thanks, > > Rong Qianfeng. > > > > >> > >> Thanks > >> Rong Qianfeng. > > >