From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (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 53B7B3DDDA8 for ; Tue, 19 May 2026 07:55:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779177339; cv=none; b=PnExyT4tor1wt89BwLthC9pdj/WfW222GyWv31XuUVzLNUMbVfjckyo4oEAz5kLiZYElX1X48PDqnzDMyzwyP2iQzLtT+ZbeJ+h9s6zw+GfQNi7/HM7EFPJsz4jEmxIaS/yON1ePTRVVT4sBFDyB58jzhdsz4lrF9nmaK5ERRr0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779177339; c=relaxed/simple; bh=MXBiZ/wthBntpSi+XVh/5KZUGWD1ymfLzKpiLi2B+50=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ZxbntN9+1RtDHaLbmZKC568C91nFoTh3cjtpsxZsHfuqp776HEFwm7dKVR/w7gy8vrZVfdlDUyW6DuQIbRc8KuQjvU7F9rofQkq6dYW+PFl958dmXtHJwx1VPbjYBlJR7Dx7K5Sk3t6n2dCIwEL5kDo3czUEvZ0zjl+5+g/3SjQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ks1aaa+s; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ks1aaa+s" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-48e82c23840so24892345e9.3 for ; Tue, 19 May 2026 00:55:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779177335; x=1779782135; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=a/lqih5w8kOsHKdyaSXO9SGORGhwE1abTlQDwvsKNOc=; b=ks1aaa+sOp1IU4Gt4nMoXDYLCXD3Mx+MGbDkxgF8grRjAcwSob1Qq/k4toYk6mwLeV qoEL9iT9F7oFpcFmcO+ka12sKKyWyymSGfBm47llOR7KuUZ4EyRJBO0cGW9IQunqoYtw D2U5DyBoASaN5/xXTiSQMwJjMBgh+drWKglYcIJ7eHQ0mBqVANk+svcqRzgmxR87zZs+ VgzkEyi7wlvf+Pe7YnQnM6SMSw6nPlH6O1esy7/oTVXftAKeiccmv49bvoyPTYfW8u89 c6rT6f2ScKw48a6OOo73lL9scxd4NYF8QO8lTGKzXhKvvHF1KGy1qtd8ESF65fOoDbuI KGqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779177335; x=1779782135; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=a/lqih5w8kOsHKdyaSXO9SGORGhwE1abTlQDwvsKNOc=; b=QbFQfvZaGArXYHrWn+uSp00WycVDXy/CDGvhFgBBVh9OAM7pEkxSPHRwCYG5t1eEFF vSI3K8BjcBnwFrMra2DYqnZm+kkqu8Wkj2HlloP78iITWaj6wQ20jASXZGiPr0YguywS L7vB0ySH3C9sSm8BdMtNT2VH6NQU4yo/36VvTt4S77dERHpcWDBDNjFmPwXKzTvivr00 DWfUOpAhu1/k7UfK3gF8wlnWa7Hwo7babCVoyhDmRsS5K6gITnHEM8zU2hikqthN3JqX H8Fnq+ugH4xQp+2oR3JigJPdtTCq65epTvch9lDyYlKkjal4IAiF31bEcAkYVGZ6wZbb I+vg== X-Forwarded-Encrypted: i=1; AFNElJ+vlRwPlspsPy7SvztXk56vYs3hO54D3IwK/PlSTlLba0+f9jnwHix5HSiK6EdLbu9EFY3d+k/yTRSB5vU=@vger.kernel.org X-Gm-Message-State: AOJu0YxVEHoDRnqZ8eByJglnAQMASr+sidM0vauX12H5rouL1ukp+P69 fU32bX+yMJK2Rqx+kAQpuBylUkCeojAYHGycO2yPpOGkwoUmSBJaqf4K X-Gm-Gg: Acq92OGTVbZsJLUKws9f81AZJNdiiCh0x45kTuX+QdWG9pESzS88ahu9u4qJh11OZXk yr/QkY+M5Jf8dSinRE4mT37FFEZn7zOoFv4K1sHVnZ28oQP9iNayT3SdNh8l+hs+RQIoIlwjQoV 8Ym99IHs78MC5r82tk/FvV4dU4YAlM6xvxMWECLLjuPFbeMpGt78PeRR6k+bDMJFjKzi7xJZFsF unPe+pfUwOqbH6UMYHYUQplnhemx5fMugbHG4liSCWIh00MjtmA75vbnV2Kw8gCvzRNGa5W2Jct iM9zOsxYEZWvgKfufulOcVFtX1/jOV/7zTP1YHbfGMmdSq/Bpy4Yex8kBGWcpNluKmBykVk8lOe eWHtYi68XtgsBGdfBXUJl1R1eKAg0nPun3IrU2EgbGC66oJ6fi0uMeDJuppbAO2P3ItMucvcnMc pjH3QMBKBKkbOsmejIyN7pWxgyE7qaHXRqZh3aph97EVG7xTW3M/XLriaiSwzakUFSVILdl9WD0 WN3wkbZMwu8l0t5jZXvYWrKK4uUBrL3RoqhmhO8JbRO3kzvybh1NPwfolGIdyjnzJ0YWP5O37En 5g== X-Received: by 2002:a05:600c:470e:b0:489:201c:dc46 with SMTP id 5b1f17b1804b1-48fe60ea590mr265981195e9.12.1779177335066; Tue, 19 May 2026 00:55:35 -0700 (PDT) Received: from ?IPV6:2a01:4b00:bd21:4f00:7cc6:d3ca:494:116c? ([2a01:4b00:bd21:4f00:7cc6:d3ca:494:116c]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48fe4c88e5asm329088665e9.6.2026.05.19.00.55.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 May 2026 00:55:34 -0700 (PDT) Message-ID: <9933142a-4ce2-4219-9574-73da30edd74e@gmail.com> Date: Tue, 19 May 2026 08:55:32 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 05/10] lib: add dmabuf token infrastructure To: Christoph Hellwig Cc: Jens Axboe , Keith Busch , Sagi Grimberg , Alexander Viro , Christian Brauner , Andrew Morton , Sumit Semwal , =?UTF-8?Q?Christian_K=C3=B6nig?= , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, Nitesh Shetty , Kanchan Joshi , Anuj Gupta , Tushar Gohad , William Power , Phil Cayton , Jason Gunthorpe References: <20260513082431.GA6461@lst.de> <20260518125326.GA5754@lst.de> <20260519065653.GB8173@lst.de> Content-Language: en-US From: Pavel Begunkov In-Reply-To: <20260519065653.GB8173@lst.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 5/19/26 07:56, Christoph Hellwig wrote: > On Mon, May 18, 2026 at 03:23:53PM +0100, Pavel Begunkov wrote: >> To be fair, it's not that dma-buf specific. This lib/ code only >> does some resv locking, fence waiting and queuing fences, > > But all the dma resv/fence stuff is pretty tied into the dma-buf > ecosystem. I don't think it would really apply to something not > doing DMA at all. The point is that those can be separated to reuse the rest. >> otherwise >> all the attaching is done by the driver behind callbacks. Switching >> it to some memfd could be pretty simple. But The main thing it'd >> need to share is iterator handling like forwarding in the block >> layer, and it should be fine as it's already passed as a completely >> opaque object with no knowledge about pages / dma / etc. for the >> middle layers. > > But none of that really sits in the current lib/ code anyway? It's about naming. E.g. passing a DMABUF_ITER that doesn't have a dma-buf would be confusing, and then it'll need renaming at all layers to support the use case. >>> lib/ is most certainly the wrong place for something that absolutely >>> is not library functionality but directly interacts with a few >>> subsystems. >> >> It only interacts with dma-buf, and even for dma-buf attachments >> are created by the driver. Block, nvme, io_uring are users, either >> using the helpers or implementing callbacks. >> >> Ok. Let's assume for the argument's sake it's not dma-buf >> specific, if not lib/, where would you put it? I was also >> assuming that dma-buf being under drivers/ is rather a relic >> of the past rather than the desired location, hmm? > > drivers/dma-buf is a pretty natural place for it, I could not thing _If_ there is no dma mappings, drivers/dma-buf would definitely be an awkward spot. Just trying to understand your criteria for placement, let's say of a generic buffer registration code assuming there is no dma-buf involved at all. Again, just a hypothetical. > where else you'd place dma-buffers. I'm not sure how hmm has anything > to do with it. Looks there is some confusion. It's was meant as an interjection with an open question, I didn't mention the HMM subsystem. -- Pavel Begunkov