Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp412456rdb; Mon, 29 Jan 2024 06:15:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IESE7Cxfz2XSkn4xRZmcaMs6Z9f7qr5bZ7qevrKd+rBoy0f5ceGi/hcLD2eg854wQWGTh5g X-Received: by 2002:ae9:e917:0:b0:783:9953:a143 with SMTP id x23-20020ae9e917000000b007839953a143mr4604352qkf.85.1706537729678; Mon, 29 Jan 2024 06:15:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706537729; cv=pass; d=google.com; s=arc-20160816; b=BdlRmJTiNQo428FMs3/WP+eUjQkHoIMX6fykBleK5I8vO2CeyF+VuOJaHt3d/tG6i2 AThGPKFdoE1OySUZzdHgCy/FhaOlUHncsPLnHlbiw/QlMkacEz0SV/ujmgX5aKKOQ3Uu Ggr3XPyP48fVXGoFW8GAMlF6G0uo2koOboo7nrehm8z8DOXQQsdIDNpzl9p9FATmHfjW 3657szw1L0/CNTeXYOmdVKailSBqNs0WmMymhBthtZDwFAk3FNTlcDYkzzIgKnTS28xm 3Dn7IyMSd6dDnEoJJW2KjWQjU5tPw7FPdHEcbtVV9WLMXAcTv6VDQ7GvFUFj8qLVRe5J CpXw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :content-transfer-encoding:autocrypt:references:in-reply-to:date:cc :to:from:subject:message-id:dkim-signature; bh=pgidmgFeP0tk17gjD21+VDw69unAjkitiIzLDu66t2o=; fh=Lowkqf73XtqspxEdqESAl8sX05532FxjQgwf1GwA2+A=; b=C3fqNOxLkPVngkxd57VmTbpzJxiRDsPsT5DYXwU4yeMIhci+1Nl1Ge1Qc+Xc+J0pbv tGjN2LxxzQWc87sR9VwC/e+aeVQwnqKHEH+7pUJ3BTOa74Gc7PCvedkTjCuVJkw/iK84 uUq6S79nQysf59rO1L6PYDRh80fm7U9epEDfLCHML/zpCCnBXMus+2JkAHOJeiwLq+k+ CR+H1CubimZMmSo8gU2jd37CC+fl72foUsqa4/+IKAhwR3pcFmhyiuJi+uDMH4+XJvga fNB9MMSf3ZzFmqF+1zwC8GfD1xG/s0nwT0UgovBVANQEPtE3H2fcsJSGZj+gpQZSA9Ng cJ0g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=d1tm4uHv; arc=pass (i=1 spf=pass spfdomain=crapouillou.net dkim=pass dkdomain=crapouillou.net dmarc=pass fromdomain=crapouillou.net); spf=pass (google.com: domain of linux-kernel+bounces-42865-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42865-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id j9-20020a05620a146900b00783dc3ba48esi6736130qkl.716.2024.01.29.06.15.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 06:15:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-42865-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=d1tm4uHv; arc=pass (i=1 spf=pass spfdomain=crapouillou.net dkim=pass dkdomain=crapouillou.net dmarc=pass fromdomain=crapouillou.net); spf=pass (google.com: domain of linux-kernel+bounces-42865-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42865-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 85EB71C213F0 for ; Mon, 29 Jan 2024 14:15:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3786F65BC9; Mon, 29 Jan 2024 14:15:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=crapouillou.net header.i=@crapouillou.net header.b="d1tm4uHv" Received: from aposti.net (aposti.net [89.234.176.197]) (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 AB7146311F; Mon, 29 Jan 2024 14:15:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=89.234.176.197 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706537715; cv=none; b=ofMexdIUqJEOB4Z1UivvQ+0TfeBduGUJl6YB+PeSLZ18E36z1IXGLEpzBraSi7Al5TxdpKj9sbypUdSCHqS5hrok/i9FM7FZ4BvMoVoG82idtQ843qlNQpVbDCbfN/s0UT4DaFfY8PbWvAJWpx4976NDszHGvHwF6A6KhA2B0eU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706537715; c=relaxed/simple; bh=joKOcQVzaGp+Eqm7uU448Qn7y9ce+cvNOf58xf3Uhm0=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=k2St8h65daslB803RKO/ayq9KTslJORirwNofk/OngkeasLdFZvHQZyTOopL6CDKHaM0DqDsqwL+n4Fo1FNSR656Lh6hopFtcKpCF2SDB2h6Um4XdTaBUgxQD+96PuixFXSt/aqaNXz6oe9q+XSUzPPWTAQ2eZwvhz5Y7O9BMuk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=crapouillou.net; spf=pass smtp.mailfrom=crapouillou.net; dkim=pass (1024-bit key) header.d=crapouillou.net header.i=@crapouillou.net header.b=d1tm4uHv; arc=none smtp.client-ip=89.234.176.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=crapouillou.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=crapouillou.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1706537710; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=pgidmgFeP0tk17gjD21+VDw69unAjkitiIzLDu66t2o=; b=d1tm4uHvLjI5geAdOzhvTRgdZIr1L3eaCvN8jfDMVBENQ99GYSV5EcCEqcQrqH6LHIAL++ nfkRyyMWSUxnJPc+ogGTV6ArelezJ5g0QkZNbSG65vKXOClj6W+zGQdglXaZKVovqwiA1A GslGn9EBvHWlk2dR9BvhuZ0iweu8854= Message-ID: Subject: Re: [PATCH v5 5/8] iio: core: Add new DMABUF interface infrastructure From: Paul Cercueil To: Christian =?ISO-8859-1?Q?K=F6nig?= , Jonathan Cameron Cc: Lars-Peter Clausen , Sumit Semwal , Vinod Koul , Jonathan Corbet , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, linux-iio@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, Nuno =?ISO-8859-1?Q?S=E1?= , Michael Hennerich Date: Mon, 29 Jan 2024 15:15:08 +0100 In-Reply-To: References: <20231219175009.65482-1-paul@crapouillou.net> <20231219175009.65482-6-paul@crapouillou.net> <20231221120624.7bcdc302@jic23-huawei> <20240127165044.22f1b329@jic23-huawei> <8fc55451-dfd7-4d09-8051-8b39048f85e2@amd.com> Autocrypt: addr=paul@crapouillou.net; prefer-encrypt=mutual; keydata=mQENBF0KhcEBCADkfmrzdTOp/gFOMQX0QwKE2WgeCJiHPWkpEuPH81/HB2dpjPZNW03ZMLQfECbbaEkdbN4YnPfXgcc1uBe5mwOAPV1MBlaZcEt4M67iYQwSNrP7maPS3IaQJ18ES8JJ5Uf5UzFZaUawgH+oipYGW+v31cX6L3k+dGsPRM0Pyo0sQt52fsopNPZ9iag0iY7dGNuKenaEqkYNjwEgTtNz8dt6s3hMpHIKZFL3OhAGi88wF/21isv0zkF4J0wlf9gYUTEEY3Eulx80PTVqGIcHZzfavlWIdzhe+rxHTDGVwseR2Y1WjgFGQ2F+vXetAB8NEeygXee+i9nY5qt9c07m8mzjABEBAAG0JFBhdWwgQ2VyY3VlaWwgPHBhdWxAY3JhcG91aWxsb3UubmV0PokBTgQTAQoAOBYhBNdHYd8OeCBwpMuVxnPua9InSr1BBQJdCoXBAhsDBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheAAAoJEHPua9InSr1BgvIH/0kLyrI3V0f33a6D3BJwc1grbygPVYGuC5l5eMnAI+rDmLR19E2yvibRpgUc87NmPEQPpbbtAZt8On/2WZoE5OIPdlId/AHNpdgAtGXo0ZX4LGeVPjxjdkbrKVHxbcdcnY+zzaFglpbVSvp76pxqgVg8PgxkAAeeJV+ET4t0823Gz2HzCL/6JZhvKAEtHVulOWoBh368SYdolp1TSfORWmHzvQiCCCA+j0cMkYVGzIQzEQhX7Urf9N/nhU5/SGLFEi9DcBfXoGzhyQyLXflhJtKm3XGB1K/pPulbKaPcKAl6rIDWPuFpHkSbmZ9r4KFlBwgAhlGy6nqP7O3u7q23hRW5AQ0EXQqFwQEIAMo+MgvYHsyjX3Ja4Oolg1Txzm8woj30ch2nACFCqaO0R/1kLj2VVeLrDyQUOlXx9PD6IQI4M8wy8m0sR4wV2p/g/paw7k65cjzYYLh+FdLNyO7IW YXndJO+wDPi3aK/YKUYepqlP+QsmaHNYNdXEQDRKqNfJg8t0f5rfzp9ryxd1tCnbV+tG8VHQWiZXNqN7062DygSNXFUfQ0vZ3J2D4oAcIAEXTymRQ2+hr3Hf7I61KMHWeSkCvCG2decTYsHlw5Erix/jYWqVOtX0roOOLqWkqpQQJWtU+biWrAksmFmCp5fXIg1Nlg39v21xCXBGxJkxyTYuhdWyu1yDQ+LSIUAEQEAAYkBNgQYAQoAIBYhBNdHYd8OeCBwpMuVxnPua9InSr1BBQJdCoXBAhsMAAoJEHPua9InSr1B4wsH/Az767YCT0FSsMNt1jkkdLCBi7nY0GTW+PLP1a4zvVqFMo/vD6uz1ZflVTUAEvcTi3VHYZrlgjcxmcGu239oruqUS8Qy/xgZBp9KF0NTWQSl1iBfVbIU5VV1vHS6r77W5x0qXgfvAUWOH4gmN3MnF01SH2zMcLiaUGF+mcwl15rHbjnT3Nu2399aSE6cep86igfCAyFUOXjYEGlJy+c6UyT+DUylpjQg0nl8MlZ/7Whg2fAU9+FALIbQYQzGlT4c71SibR9T741jnegHhlmV4WXXUD6roFt54t0MSAFSVxzG8mLcSjR2cLUJ3NIPXixYUSEn3tQhfZj07xIIjWxAYZo= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Le lundi 29 janvier 2024 =C3=A0 14:32 +0100, Paul Cercueil a =C3=A9crit=C2= =A0: > Le lundi 29 janvier 2024 =C3=A0 14:17 +0100, Christian K=C3=B6nig a =C3= =A9crit=C2=A0: > > Am 29.01.24 um 14:06 schrieb Paul Cercueil: > > > Hi Christian, > > >=20 > > > Le lundi 29 janvier 2024 =C3=A0 13:52 +0100, Christian K=C3=B6nig a = =C3=A9crit=C2=A0: > > > > Am 27.01.24 um 17:50 schrieb Jonathan Cameron: > > > > > > > > + iio_buffer_dmabuf_put(attach); > > > > > > > > + > > > > > > > > +out_dmabuf_put: > > > > > > > > + dma_buf_put(dmabuf); > > > > > > > As below. Feels like a __free(dma_buf_put) bit of magic > > > > > > > would > > > > > > > be a > > > > > > > nice to have. > > > > > > I'm working on the patches right now, just one quick > > > > > > question. > > > > > >=20 > > > > > > Having a __free(dma_buf_put) requires that dma_buf_put is > > > > > > first > > > > > > "registered" as a freeing function using DEFINE_FREE() in > > > > > > > > > > > buf.h>, which has not been done yet. > > > > > >=20 > > > > > > That would mean carrying a dma-buf specific patch in your > > > > > > tree, > > > > > > are you > > > > > > OK with that? > > > > > Needs an ACK from appropriate maintainer, but otherwise I'm > > > > > fine > > > > > doing > > > > > so.=C2=A0 Alternative is to circle back to this later after this > > > > > code is > > > > > upstream. > > > > Separate patches for that please, the autocleanup feature is so > > > > new > > > > that > > > > I'm not 100% convinced that everything works out smoothly from > > > > the > > > > start. > > > Separate patches is a given, did you mean outside this patchset? > > > Because I can send a separate patchset that introduces scope- > > > based > > > management for dma_fence and dma_buf, but then it won't have > > > users. > >=20 > > Outside of the patchset, this is essentially brand new stuff. > >=20 > > IIRC we have quite a number of dma_fence selftests and sw_sync > > which > > is=20 > > basically code inside the drivers/dma-buf directory only there for=20 > > testing DMA-buf functionality. > >=20 > > Convert those over as well and I'm more than happy to upstream this > > change. >=20 > Well there is very little to convert there; you can use scope-based > management when the unref is done in all exit points of the > functional > block, and the only place I could find that does that in drivers/dma- > buf/ was in dma_fence_chain_enable_signaling() in dma-fence-chain.c. Actually - not even that, since it doesn't call dma_fence_get() and dma_fence_put() on the same fence. So I cannot use it anywhere in drivers/dma-buf/. -Paul