From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (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 ED3F12F0C6E for ; Tue, 6 Jan 2026 19:32:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767727960; cv=none; b=A590aNIshx/AMjfKTppYFQG2weaktB5cB/OgwxFjG+s8ffsL+JHCKCmrk1TbR4b41JjJoVUvBFjRahEweGe5/EdO46s/UFNI9ThHgf3d+84CJ7LYOOXl9Uu49JP3PnXB0iAedpjZKHqejHcU9rgBo2KZrfTktRQnpWm6Xf5VX/E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767727960; c=relaxed/simple; bh=eoBCBjo/KSoxejYCD1xX6+n5o2xGH1pTIUXqFKAPS2w=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=lftT4BJxxAHzdE5/18HA3QXr5PRZ+6dhuPWfTiFvIoYrCgQXPa977v3kYW9fgEsH1Yq77PK1aVYQlYxG3ReSOPjcfGatBzdB8EMOd+Qt6EKPm4YPnFQOHWcLiVQBzJZoRIxdUECVBSH/vHHZaoWhUSkUsHSeFHtMZpSMg9/FAac= 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=nZdw9btf; arc=none smtp.client-ip=209.85.221.48 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="nZdw9btf" Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-431048c4068so83480f8f.1 for ; Tue, 06 Jan 2026 11:32:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767727956; x=1768332756; 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=A5ExmjzRt11H31bMlKYOhViS+00PGFmBw8wszOB9k6Y=; b=nZdw9btfuv3XQUvIVfi/FzVIQK3dk7N+yTg60Els58NGPsP5awU6F3ho+N1Br7RfmQ fZOKw//NcKiVWtIxRGlh59PWq3z+67uid4TzjBchTVHhfWFMhQHyyCIem6hqp55W+PT1 azX8P2mQELdF3C3g8UXxpQ15KKO5hzOvGpfA+AHTbjTJW9YOgqaMqO5fB252HDy79cKc dJzB38kohFI3dlIU79m2LkEKWYRtLfVdJcL5EeexmEy7wWUsf/+qOvMEWjTdI32MP5QB 8ZJ75PG0RCyRljpP0PlnvpgDsblrOLHvpLxey4PgrAPmvc/yVW++uXaR8Bg2zLSDxCjo JgyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767727956; x=1768332756; 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=A5ExmjzRt11H31bMlKYOhViS+00PGFmBw8wszOB9k6Y=; b=OeryMW2cwVpWthXt5iTYi5oHmuPY4zlanFEGbLq+VotPYRpmlOoFYBM+Pb+0h6NI9H uQ2TO+B+P1GoOAB1IUh+spCovVpPglLr7QOKTdVeYXvYKBTi3c0gouWKaSpVuLFFfjjg hW2/tEjsupuDMquUXZPGHeOaQxYRCqeHA0LirlZluNrT6qk2CwI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hMmmdpg== X-Received: by 2002:a05:6000:3104:b0:431:cf0:2e8b with SMTP id ffacd0b85a97d-432c3778e47mr273696f8f.29.1767727956009; Tue, 06 Jan 2026 11:32:36 -0800 (PST) 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 ffacd0b85a97d-432bd0e6784sm5933503f8f.19.2026.01.06.11.32.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 06 Jan 2026 11:32:35 -0800 (PST) Message-ID: <275fdece-d056-4960-a068-870237949774@gmail.com> Date: Tue, 6 Jan 2026 19:32:32 +0000 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: [RFC v2 10/11] io_uring/rsrc: add dmabuf-backed buffer registeration To: Ming Lei Cc: linux-block@vger.kernel.org, io-uring@vger.kernel.org, Vishal Verma , tushar.gohad@intel.com, Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Alexander Viro , Christian Brauner , Andrew Morton , Sumit Semwal , =?UTF-8?Q?Christian_K=C3=B6nig?= , linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, David Wei References: Content-Language: en-US From: Pavel Begunkov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 1/4/26 01:46, Ming Lei wrote: > On Sun, Nov 23, 2025 at 10:51:30PM +0000, Pavel Begunkov wrote: >> Add an ability to register a dmabuf backed io_uring buffer. It also >> needs know which device to use for attachment, for that it takes >> target_fd and extracts the device through the new file op. Unlike normal >> buffers, it also retains the target file so that any imports from >> ineligible requests can be rejected in next patches. >> >> Suggested-by: Vishal Verma >> Suggested-by: David Wei >> Signed-off-by: Pavel Begunkov >> --- ... >> + dmabuf = dma_buf_get(rb->dmabuf_fd); >> + if (IS_ERR(dmabuf)) { >> + ret = PTR_ERR(dmabuf); >> + dmabuf = NULL; >> + goto err; >> + } >> + >> + params.dmabuf = dmabuf; >> + params.dir = DMA_BIDIRECTIONAL; >> + token = dma_token_create(target_file, ¶ms); >> + if (IS_ERR(token)) { >> + ret = PTR_ERR(token); >> + goto err; >> + } >> + > > This way looks less flexible, for example, the same dma-buf may be used > on IOs to multiple disks, then it needs to be registered for each target > file. It can probably be done without associating with a specific subsystem / file on registration, but that has a runtime tracking cost; and I don't think it's better. There is also a question of sharing b/w files when it can be shared, e.g. files of the same filesystem, but I'm leaving it for follow up work, it's not needed for nvme, and using one of the files for registration should be reasonable. -- Pavel Begunkov