From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (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 20DA9324705 for ; Mon, 18 May 2026 10:14:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779099255; cv=none; b=GxgSGRnTTF39F4XHdptdLIWkzfNVhE3W65NSxLC6uhr9hTpFFO8gqV7AgNfjmou5EIxb+v9EcLojpS9fDB80vGtlwUVYyTUzrLadWkWqr9Fat4x5BeEKoMRN5L/XJqbHYkHth57ZzccbpT+X+aKvZoU50bXjvgirElYhO5wBB7U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779099255; c=relaxed/simple; bh=3CuHTJb7a1uf/Vt2GUcQwRyWkRY1v//75zEJ72jrsaY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=jAE9mAR8qBQxekIwoyy0Em4H6pQWMTwQdU6IVkRTU1oJVwX9Hq+XUHllPCvDkLpM0ZGJi67Hy+tdzWR5s7YRvPrVsXgSv0lIBUZM3xNTP+iXm2Lfl0UnnnQPH7YqV7En/GXGgvg7PzfAg+P1/cI2HxZT7tmB37UHcJa5fwyAPUk= 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=R1ZDf3kA; arc=none smtp.client-ip=209.85.128.51 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="R1ZDf3kA" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-4891b0786beso14790005e9.1 for ; Mon, 18 May 2026 03:14:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779099252; x=1779704052; 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=HqBDj90Kc3B5RL3RITDRmt05U20tIBaa43CY99Xd9RQ=; b=R1ZDf3kABY32pxy0h+kPbdKnYZrzH+iwDxvK0ocrMzmv6o/u7R6jnvJNBjuqGhkdpP iB1W2mKv4uHNINJ4/JHtzaDwU9PoOKCte0Dt79zh0ecxFFMPRqapHpVfQA+keKfmXxIS 8DayMB3M23H8ChWcpQzKj5cxBTOrA7GD1qECTci1sCGjehOqYyruEyGzahz/9HNyMIAI dRpw5nxgLiUc9hrvd/73CZz3dusoKm1en3BGRDHuSHotzc8LXPnDIGRjijVTeFqz9yi6 qssw9j+pbQAZjKy7HRStnmeQzG53nx0zF/WhTSRPfs+mJDUbdUBlAoLY7uWrqoLow0SF p8UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779099252; x=1779704052; 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=HqBDj90Kc3B5RL3RITDRmt05U20tIBaa43CY99Xd9RQ=; b=M0YPgWOZSnAuEh5aphEhEaBhy0ylquI6k+bUzm6UpqkDSticqUhfkBPdZYKckycyjn I3dWZ2rc4mfgyWgpMGi0NGwK0sMJXGCJDOONLbYYmKitOfJ9MR0UytO+Q2mMmheLF/wB /fSCTnmzdLwcrv4sSWnG8prH1bUsySkyI5jsVfMfX67tasKSIrwb0zW70ineCRn8kG0M uc6gAd0unDRFtH3BN7J09vR+kKo5jTIYyotG7umDCYDJ6JrAikx3Fc+VBuRAbtSlOGOc Vsvs/BHL/8RsOqUMNlBwwDbgy5QEzUITiZcmRGKACFYFOHINQ33voye9ptF1Cl9tywNe 5xEA== X-Forwarded-Encrypted: i=1; AFNElJ+osZdUBU4P2ozHNpI3XAS9RLsI//9NDXyUs61ApviNh0XNgB54+iwT8YnAcohZz0rbXhv9SV9ugaNOmPI=@vger.kernel.org X-Gm-Message-State: AOJu0Yyk5RZxFsNQz1lO9AXtZzSKi3Fbx99BgJKw7fSh6bRPMk5A2XC9 fWuVmE1dgyw6CX2/jI+aHDFDJhEy05seg6Xlx80nv4+VvXljCvzUJrZ+ X-Gm-Gg: Acq92OHWyZM3ybYAlvVlX4KqWZc4JZ9YPqY9BJQWfvWniKiaxB5oTXhz1xd6Q6HKPoK xEj+08tbiR5TwbZp3drcZvRhtAUyhLqGEA+qPJrbLacMThZTxpCsiqSqWlvEo5GeWVs6P7G3eoz Re7wgpotsJ2NBxWqMQ++TFBXOhXHVnuiHORcirJ4ZwM/gj9QUL5tb8s8Teks1TO/I7c4ITIAtkU tWsFJqT1euSXuUUSxuqaUPWPGUPKk2OSCla3buqEBWPiIutmzT0JRTLD7qtjk36FyY6kPe8focv 2+QUAIDw7C7zQ0b1CggJXig0/T6hWKVU+KeivTXMbrCBcM6FVNKFMIjeIOMr36HCz4Jr6GtGj+Z 4ycZ2Tq8ut0W9C1iSzySA0BhNCejD4lHNLKIrNfbAJokoTKoV1K68FQXqFk3w2wYOss7QwzFcc9 zCkWdEKtySP/WgEDL9SolpEJTHJN8S00CGARXg7h8kLbq5osune+0y95quMiaBrrRMjU+ja6hMK Ta45qjMqSYyOANnGKR5SafSet2loHo6pMxleoCo3I+sW+JWDSNVty4YEsU= X-Received: by 2002:a05:600c:3b12:b0:488:b14f:b8ed with SMTP id 5b1f17b1804b1-48fe59ab80emr218398395e9.0.1779099252361; Mon, 18 May 2026 03:14:12 -0700 (PDT) Received: from ?IPV6:2620:10d:c096:325:77fd:1068:74c8:af87? ([2620:10d:c092:600::1:6e9b]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-45da0fe0f72sm38877974f8f.25.2026.05.18.03.14.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 18 May 2026 03:14:11 -0700 (PDT) Message-ID: Date: Mon, 18 May 2026 11:14:09 +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> Content-Language: en-US From: Pavel Begunkov In-Reply-To: <20260513082431.GA6461@lst.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 5/13/26 09:24, Christoph Hellwig wrote: > Naming and placement: > > This is about dma-buf based I/O. So I'd expect it to be named dma-buf-io > and no io-dmabuf, and live in drivers/dma-buf and not the unrelated lib/. > But I'd like to hear from the dma-buf maintainers about that. Looking at what Ming is saying, it'd make more sense to keep some of the parts like iterator and the file op more flexible and not automatically imply dma-buf even if it's the main and for now the only medium. I.e. ublk/fuse can use a similar interface for mapping buffers to the server even without dma mappings. I don't know how the API should look like, maybe passing memfd, and dma-buf supports mmap, but I think it's better to call the op something like "register_buffer" instead and keep all it in lib/ for the same reasons. > Config option: as this unconditionally when DMA_SHARED_BUFFER is enabled, > why does it need a separate config option? More clearly marking relevant code, easier to make optional if needed, and gives some introspection via /proc/config. > Interface: io_dmabuf_token_create / ->create_dmabuf_token filling > in a structure allocated by the caller feels odd. It's minimising pointer chasing. "token" is mainly used by io_uring in the hot path, and io_uring just keeps it as a part of a larger struct. For the same reasons "map" is allocated by the driver. I can add an extra parameter to io_dmabuf_token_create() for how many extra bytes to allocate for the caller's use, if that makes things any better for you, but it was easier to just pass an already allocated struct. My gut feeling > would be to move most of io_dmabuf_token_create into a helper called > by ->create_dmabuf_token so that the token is allocated in the > driver data structure and returned from create_dmabuf_token. -- Pavel Begunkov