From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.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 01F252F12BA for ; Tue, 6 Jan 2026 19:32:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767727960; cv=none; b=U5PLBboaS2PyFhdKrq56KGaC+93n7g/PTofsGeomo2DpylOYdd2ufttHF4/PuplJ8Uxm0ImNFH6PZLKfI89VvpdnG2CAD+2FgZGid2SG7NCHKa557jHliGi53YUH6QhVKe83AdX0KDdDN/3J+mFd5SY/SBIVZ2YeTLxRQtzsuj0= 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.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="nZdw9btf" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-431048c4068so83483f8f.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=de9jOBl/1/RwGhrDvfp9Q9d9rgA/lUlnyqKMdcZQEr3/v+TpvjfIN2Ma5w1Jwf+5Ic 0NV70BjiDYRcU+VRGAvvWm1qL1oQfoIaZ1OMWTG1+C2uDJK36F4P5mo7po896k3TSJt5 LJw1FN99+njqEqDmS2UcK/kHxgK6hgywHCkpYYLwSynJuH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Va9q2qDIVhMmmdpg== 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: io-uring@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