Article View: linux.kernel.netdev
Article #3314Re: [PATCH net-next v2] net: devmem: allow peer-to-peer dma-buf attach for bindings
From: Stanislav Fomichev
Date: Wed, 14 Oct 2026 18:19
Date: Wed, 14 Oct 2026 18:19
40 lines
9794 bytes
9794 bytes
On 10/13, Erfan Sharafzadeh wrote: > net_devmem_bind_dmabuf() uses dma_buf_attach(), a static attachment > with peer2peer false. Exporters must then keep the buffer reachable > without P2P; amdgpu does so by placing it in GTT (system memory), so a > device memory binding silently ends up in host memory. > > Use dma_buf_dynamic_attach() with allow_peer2peer set, so an exporter > that can do P2P to the device keeps the buffer in device memory. > Dynamic attachments are not pinned on map, and devmem cannot handle the > buffer moving, so: > > - pin it with dma_buf_pin() before mapping, which keeps it in place for > the lifetime of the binding, as before; > - wait for the exporter's kernel fences after mapping, interruptibly, > as the core does for static attachments. > > This follows the pinned RDMA umem path, including its limits: the > binding cannot be revoked by the exporter, and once a P2P binding has > pinned a buffer in device memory, a later attachment to the same buffer > that cannot do P2P may fail to pin it. Exporters that cannot do P2P to > the device place the buffer as before. RX and TX bindings both go > through this function. > > Signed-off-by: Erfan Sharafzadeh <erfansh@meta.com> > --- > v2: > - Target net-next and drop the Fixes: tag. This adds P2P placement > rather than fixing incorrect behaviour, and it relies on recent > dma-buf core changes, so it should not go to stable. > - Wait for the exporter's fences interruptibly, as the core does. > - Describe the revocation and mixed-attachment limits in the commit > message. > > v1: https://lore.kernel.org/netdev/20261012170754.669462-1-erfansh@meta.com/ Acked-by: Stanislav Fomichev <sdf@fomichev.me> We never with proper in-tree exporters (rather than "mock" udmabuf) so here we are :-(
Technical Details
Message-ID:
<as_HT7Dfp8MIkTfa@devvm7509.cco0.facebook.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-346387-linux-kernel-netdev=dewy.ruReferences:
<20261013210954.2170175-1-erfansh@meta.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-346387-linux-kernel-netdev=dewy.ru
From: sdf.kernel@gmail.com (Stanislav Fomichev)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v2] net: devmem: allow peer-to-peer dma-buf
attach for bindings
Date: Wed, 14 Oct 2026 11:19:14 -0700
Organization: Usenet Network
Message-ID: <as_HT7Dfp8MIkTfa@devvm7509.cco0.facebook.com>
References: <20261013210954.2170175-1-erfansh@meta.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Injection-Info: usenet.network;
logging-data="2358112"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:AYL6HW4TYo8wqV40RksKU2jyjHI= sha256:9naMs/d76Sw3OlT+AZv6avKP8yHGvp7WmWszQuMgAJY=
sha1:BPxvi9yQ6BE6NUXsfHUOgMCF/3k= sha256:7fsMqgpGylDb3PY645aVb+jC/Xs2KAhGvHe6C0fKlvI=
Content-Disposition: inline
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id 9688B110194; Wed, 14 Oct 2026 21:19:47 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -0.748
X-Spam-Status: No, score=-0.748 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
MAILING_LIST_MULTI=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id LQmxhVXV1Lll;
Wed, 14 Oct 2026 21:19:42 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-346387-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
by mail.dewy.ru (Postfix) with ESMTPS id 85FD5110190; Wed, 14 Oct 2026 21:19:32 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
by sin.lore.kernel.org (Postfix) with ESMTP id C3645283C5; Wed, 14 Oct 2026 18:19:27 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 3B80335F180;
Wed, 14 Oct 2026 18:19:26 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NhpmkG++"
X-Received: from mail-pj2-f2.google.com (mail-pj2-f2.google.com [74.125.227.130])
(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 0E2D729B216
for <netdev@vger.kernel.org>; Wed, 14 Oct 2026 18:19:24 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.227.130
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1792001966; cv=none; b=YiVdOKgs+Q+1Fq7Br7Iy4S7UsRYBJR+JTk6CRUpA+stMi4fLmGU9ms8hWM+PZRn/ew1yZ0mH+B6i3MTe6igOboXZE30wZp9Zw/xncjP8IdkDkSOu6ifmiCQmhu5zDcRRZynzuPZYGtZNvaqw9DJQ2aVj5JJYClPYO+dtdzh4iaY=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1792001966; c=relaxed/simple;
bh=ns6TSLqqG4MTOMfmi5q4AEKowCQ3XE4tUlVyn7TDXTE=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=FbWtURHZ1d+RsvSJ+mZFGWA2FKGQRhGSlyIDYRSdSzBaVJmc1uOGZu6/xU5D/PmfAxo/kzWaRzuQt3IlO49a8LVmymPLDL7otlbLQh2NBo0mQQ/vneVB3aIOyI93X1WjF8IQZCR49t6YSk6D4uH46hyDCG2THK6NBK0Ukh7zK0A=
X-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=NhpmkG++; arc=none smtp.client-ip=74.125.227.130
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-pj2-f2.google.com with SMTP id d9443c01a7336-2e60e97f158so25963515ad.1
for <netdev@vger.kernel.org>; Wed, 14 Oct 2026 11:19:24 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20251104; t=1792001964; x=1792606764; darn=vger.kernel.org;
h=in-reply-to:content-disposition:content-type:mime-version
:references:message-id:subject:cc:to:from:date:from:to:cc:subject
:date:message-id:reply-to:content-type;
bh=J+nXTg+yHO+HzCVCOfYL3HGecRLoANolWSsL+AcPHcg=;
b=NhpmkG++AUZjpTpJcz6F0akp8q7eVDxKm6KUCXT6uUZDfqFtm6OB0qDw0JU9QyhYhJ
e4pMAqLCQwaYl1RwUIsN6qgtAcuQYoMY7tAiLEmvf9pAGs4yZrN/cGnks6OomyLARrMl
BOHiNY8bdlFwfzt0qgNkzh0MzIutjp1F2p42Dwv2+FkDo0lUnSV9xjk3Zwe6j3lrlCKl
21fvHIfd97IfgScYtYcH82sgh+lL4gclBPZSgVg7py1rwCCPam7iKaU4y4K+PBkfqa9l
a7PifLjZ8tYu3uw2xSY6pSUoTQ5H4NBhNSMno9rqj40OSwTb9a76JDKJ0rvngDB8XHDZ
kLeQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1792001964; x=1792606764;
h=in-reply-to:content-disposition:content-type:mime-version
:references:message-id:subject:cc:to:from:date:x-gm-gg
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
:content-type;
bh=J+nXTg+yHO+HzCVCOfYL3HGecRLoANolWSsL+AcPHcg=;
b=rkO2rizJJQodDJ6JOD08u4DhJceOOMPf5xTxrhp2kjQ+CkhwZ1WsQMSVX3dqpQRqhy
pqW3L3VJov2tdzWqQDz/+WpHQT5kyt4W1YO5xcj0ZIKWrQvw3hk2RVBHsbXtxdpbv8vl
ARmZu9MJv4KTGom1s5UwXic3a4GTe11KcEtW6LUigPBpz3kKg91RD8vQUka5g7XkgaZt
6Moh2g+owKwMdWQzKi4P+GTOoTeV7ionDyu4IIrcKZ+A+YyVYTZxfbdYH7rWfsfEsaPc
1bNA7naeqRn96a6dsPQ3oJRWybYeUKGHm6M75IcY6a1s6nwQflUVAjQNb15jP3G/lVTU
Uy/A==
X-Gm-Message-State: AFq9FYIfIynfkmqMBUrlGLf0nKqT2qM0yeqcU/pzq8zWuQYUjx/7RFVR
G7WifA7Y9WAjZ82RdPg6CRTTjq8UJvl/nCOkzuwrLw9rm5YiO3Kiyvd0
X-Gm-Gg: AYBFou0YpsPPs6PMejrWEtCQtbjlr7aEgdfhogofDdsWKZCGfoVtXsaVZnavhBMTXkc
6FFPdUb3UwYJEbsZRrS7oOPWSpj91wLWLilta+5sOeNUVDFrQ7DAZGnQES5umQyrJSxS2KHKWws
o5+jot7dXiN8qWx5mM6lAK7mz7O2tKshb1UPYHj2Zd1kt/uvpZFkCmp2ph3u5gHWay6LA/Tgqjh
ICZ5WGGsWZovjtSkmjEBcwkHaFDXurWr3jiVXGGmZABmwNmfawooEMJNHYSrYcZgBAcKsL+W4Xx
xeJOZCGliO6HT5ZZrM2fxHAjvFQIq5RhboVqM9KoqcpHZoWOCrYXRX6ooQqWLMxL6mnu8Z3e8Ap
7V0Mpbk3QU+V2eRGKiupi7IRhrQhKdZdd4ZtghXCWJiTqifEL7qjcASrAd9TD78oP2L15Vcj81p
mZl5CRPefn00arapa3eq2hnCIV7T9j6qpEQsDCpxNNjdA2kHdIgD0kg2TdSFZimtd17WY79EFd
X-Received: by 2002:a17:903:1a6f:b0:2e9:4b9f:b81f with SMTP id d9443c01a7336-2e94b9fb975mr15782815ad.31.1792001964091;
Wed, 14 Oct 2026 11:19:24 -0700 (PDT)
X-Received: from localhost ([2a03:2880:2ff::])
by smtp.gmail.com with ESMTPSA id d9443c01a7336-2e84219e525sm74136655ad.16.2026.10.14.11.19.23
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Wed, 14 Oct 2026 11:19:23 -0700 (PDT)
X-Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@kernel.org,
kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, almasrymina@google.com,
kaiyuanz@google.com, willemb@google.com, asml.silence@gmail.com, sdf@fomichev.me,
bobbyeshleman@meta.com
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-In-Reply-To: <20261013210954.2170175-1-erfansh@meta.com>