From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=178.33.109.247 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794919842; b=S3mZhNfqx9fFkoXSR+SVmZaDT1MAuciXmNGLwtoNmkpvGo4aKBBDcJMp86XpLHNS7XFZ kPWpikJe1YNOxiSOZiZC74BnIINSOFlWwPmp82AVvZacUXJqIcEZWXJQUB3PzcnOTRefp zSgfZLpnhAqVqt1O5W1xOHT/2yUnOxXnT0bXJAVwJ/qF+Af17K0GflVbHIKZzDh0C+CzQ KtJw8DpgJnxJziV4lX9lJ5Qn1Z72TIIyd7I0zMn8jdx/Mwah3UqU0Uoe3G6TfN9mzac14 6eHTT9r1s5wrof2QFHwb8L8hxD/AW5LM3XwmMrGHTJf8or9Ek4x3nL74L4AHhABTHXg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794919842; h=DMARC-Filter:Received:Received:Received:Received:X-OVh-ClientIp:From: Subject:Date:Message-Id:MIME-Version:Content-Type: Content-Transfer-Encoding:X-B4-Tracking:X-Change-ID:To:Cc:X-Mailer: x-ovh-tracer-id:X-VR-SPAMSTATE:X-VR-SPAMSCORE:X-VR-SPAMCAUSE: DKIM-Signature; bh=T1fo11ryOcvRUuQCrIAoWwsH3IF4QmN8ZLQhyisTeEU=; b=IogczopijueNx8dPKLoQ8KF84jAj788tYXfDxwNXM/4ZuVV1RXtshenT87Z7ngbmwK21 XkAeHWYcvh3qmhZ1qmkk2XIXbggnYHJm6WUBKXqcFz40Kb3H8BdZOWf7aNs5hNElrB1QQ nvDh/DtTf7MgfmrGLeynK7WxP73DrWRrCyitCyt7zuWS7jfyq2idaeknYYs4YQhLvizz4 4VRbaxWjou3YCUYeWdslYpjbM0FsTkESq09DqxQNrz2pRaoDpwBIitj2AGCXyov2+fsVu yt1YBnAkUgVpkECWpES+ohUdkTG/Shx6iAgYVNXkZ3DnKdDIDjQJnYoEb+t081/yGug== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=pixelcluster.dev; spf=pass smtp.mailfrom=pixelcluster.dev; dkim=pass header.d=pixelcluster.dev header.i=@pixelcluster.dev header.a=rsa-sha256 header.s=ovhmo-selector-1 header.b=IQwBHvJ+; arc=none smtp.remote-ip=178.33.109.247 Received: from 5.mo528.mail-out.ovh.net (5.mo528.mail-out.ovh.net [178.33.109.247]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4F2D5606A323 for ; Tue, 17 Nov 2026 12:50:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4F2D5606A323 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pixelcluster.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pixelcluster.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=pixelcluster.dev header.i=@pixelcluster.dev header.a=rsa-sha256 header.s=ovhmo-selector-1 header.b=IQwBHvJ+ Received: from director3.derp.mail-out.ovh.net (director3.derp.mail-out.ovh.net [79.137.60.223]) by mo528.mail-out.ovh.net (Postfix) with ESMTPS id 4jTPj36sYjz67FT; Tue, 17 Nov 2026 12:50:31 +0000 (UTC) Received: from director3.derp.mail-out.ovh.net (director3.derp.mail-out.ovh.net. [127.0.0.1]) by director3.derp.mail-out.ovh.net (inspect_sender_mail_agent) with SMTP for ; Tue, 17 Nov 2026 12:50:31 +0000 (UTC) Received: from mta6.priv.ovhmail-u1.ea.mail.ovh.net (unknown [10.110.188.184]) by director3.derp.mail-out.ovh.net (Postfix) with ESMTPS id 4jTPj33vhCz1xqd; Tue, 17 Nov 2026 12:50:31 +0000 (UTC) Received: from pixelcluster.dev (unknown [10.1.6.7]) (Authenticated sender: nat@pixelcluster.dev) by mta6.priv.ovhmail-u1.ea.mail.ovh.net (Postfix) with ESMTPSA id AD7368E2103; Tue, 17 Nov 2026 12:50:29 +0000 (UTC) Authentication-Results:garm.ovh; auth=pass (GARM-98R00261387e59-c792-4975-b455-eba492b4718e, 00F4D7524EDFA56606BD67631AE7EA1B984E627F) smtp.auth=nat@pixelcluster.dev X-OVh-ClientIp:141.95.41.139 From: Natalie Vock Subject: [PATCH v2 00/10] drm/amdgpu: Rework VM update ops for batching and explicit sync Date: Tue, 17 Nov 2026 13:50:06 +0100 Message-Id: <20261117-prt-explicit-sync-v2-0-bb3851cb6a0c@pixelcluster.dev> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAAAAAAAC/32NQQ6CMBBFr0Jm7ZhSAVNX3sOwgOkAYxSathII4 e4C7l2+5P33FwjshQPckgU8jxJk6DfQpwSoq/qWUezGoJUuVK4NOh+RJ/cSkohh7gkv9prVxtp MK4Jt5zw3Mh3NR/nj8KmfTHEP7UYnIQ5+Pk7HdPf+9ccUFZompUKZPKeqvrfv6WwZynVdv7CNT MvBAAAA X-Change-ID: 20260529-prt-explicit-sync-3d74b9dd420c To: Felix Kuehling , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , David Airlie , Simona Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , =?utf-8?q?Timur_Krist=C3=B3f?= Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Natalie Vock X-Mailer: b4 0.15.2 x-ovh-tracer-id: 5590937466612572476 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: dmFkZTE9CL42WbiiNjq62Y3E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Zl3783ll3BPXLobRzP60A +HVwNT9DT3vuqT1H417w6QF+7HJwBSHP+Kd5IScfnNeXQ== Hi, this is v2 of my attempt at improving sparse binding perf. The motivator is that many games have come to heavily use sparse bindings, and they often rely on being able to overlap frame work on gfx/compute queues with sparse binding work on sdma. If PRT mappings are synced to every other submissions like they are right now, heavy sparse binding load can stall the gfx/compute submissions for quite a long while, leading to very noticeable stutters and hitches. Another problem is that each sparse binding update requires a separate ioctl, so the CPU will also spend significant time constantly switching between user and kernel mode to execute the binding changes one at a time. To remedy this, this patchset introduces a "VM update context" structure. This context encapsulates some state that is carried around different VM update functions, in patch 1 this is the mappings that were freed along the way. amdgpu_vm_clear_freed then only clears the mappings that were actually freed in the update operation, which is a requirement for being able to explicitly sync that unmap. In later patches, the update context is expanded to hold a set of pending mapping changes, so that a future ioctl that changes many mappings at a time has a place to keep pending changes while every change is validated, before applying everything atomically if things look okay. Best, Natalie Signed-off-by: Natalie Vock --- Changes in v2: - Added pending change structures to update context in order to batch changes - Link to v1: https://patch.msgid.link/20260529-prt-explicit-sync-v1-0-9f1c60955cab@gmx.de --- Natalie Vock (10): drm/amdgpu: Remove unused parameter from amdgpu_vm_pte_fragment drm/amdgpu: Add and use vm_update_ctx struct drm/amdgpu: Make VM maps pending per update context drm/amdgpu: Make removed/cleared mappings pending per update context drm/amdgpu: Track dirty bo_va structures in update ctx drm/amdgpu: Add function to roll back a VM update ctx drm/amdgpu: Move some VA op validation to a helper drm/amdgpu: Only reject conflicting mappings if they are not cleared drm/amdgpu: Add new AMDGPU_GEM_VA2 ioctl drm/amdgpu: Bump minor version drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 33 +- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 31 +- drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c | 21 +- drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 6 +- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 477 ++++++++++++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.h | 2 + drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 3 + drivers/gpu/drm/amd/amdgpu/amdgpu_seq64.c | 9 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 10 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 660 +++++++++++++++-------- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 100 +++- drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c | 8 +- include/uapi/drm/amdgpu_drm.h | 46 ++ 15 files changed, 1099 insertions(+), 311 deletions(-) --- base-commit: 65b7b0d2cf8c3cba99d599493ac96f3ab32c0a06 change-id: 20260529-prt-explicit-sync-3d74b9dd420c Best regards, -- Natalie Vock