Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CE89532860B for ; Fri, 20 Feb 2026 12:05:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.97.179.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771589144; cv=none; b=Rp20q1q9GMz6tUTfPtsT12JMRW2kulicvJKq5ZEhzbmY5fayUgeIkW2xkMDJ1FN4J87dN02ls14CmvM4fFvlaku0NNnNvm/0tA1AEFW0lJF6UtOdp7KIyuGFhhjlUuDCl0Ys5ZL1mADwWxsvNV5eqemRIx/Idldk9q95LvtkWiY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771589144; c=relaxed/simple; bh=0RZUx9azpbwxrxF3DxQVTvqy6CPglaDvRRQCZZ+dbEw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IahAZBHzhaMmDN+M6st69Yu5wLm/i+XCC7NAaYiSqU8MTEtUvygj4CpNDo2OLn7QBTDkqScud4BjTD+yh3Fpo7VqOCO3V8rrK23fvCwHYJdvH5sI1lF3CmmEiyNYP66mJdEG1Hf9l2s6albxOCiBp4UTjN9s9MeykvSd3Q7PNsM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=IrD3Or+L; arc=none smtp.client-ip=213.97.179.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="IrD3Or+L" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=0OW3p47mx7paE0pvut6pIah2CWZ1p6u1RC62maVzuMU=; b=IrD3Or+L7gkj4EBUZSdhfTKT8Q ETVD+UyGQRlEMd1MozdPdKZfkei1t9Y+JVd1cpIfvSy3G4NQyMx+Nph8/gBXHF2z9GXTVXpU75Fbf 5hnFkWPBm3UXqlmpPVzUjdTt0VSF2/RYr8Xe9LOirA6Frh58joVTH7n0LjnRc8t0B95dfUdShNnO7 ItYN/Y8ADWcLu3oEXM0NpUsilrobug7DV6nyF/Ud9C26As9lqhDNDsyqLkLXmVHxM3aIv4x1fRO8p pZFgf5+5+fciDOQxVIAYMbFC7whSf8G/yvzAVYSz6XUPoWR2HuPbRoDTpky9BYJrxIar+iJBW7wH7 CedLUq7Q==; Received: from [90.240.106.137] (helo=localhost) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1vtPGO-002v1N-St; Fri, 20 Feb 2026 13:05:40 +0100 From: Tvrtko Ursulin To: criu@lists.linux.dev Cc: David Francis , Tvrtko Ursulin Subject: [RFC 22/26] plugins/amdgpu: Handle DRM render node mmaps Date: Fri, 20 Feb 2026 12:05:10 +0000 Message-ID: <20260220120514.4540-23-tvrtko.ursulin@igalia.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260220120514.4540-1-tvrtko.ursulin@igalia.com> References: <20260220120514.4540-1-tvrtko.ursulin@igalia.com> Precedence: bulk X-Mailing-List: criu@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Outside the KFD world the CPU virtual memory address of a mmapp-ed buffer object is not guaranteed to be same as the GPU virtual address. Therefore the address check in VMA restore will prevent any restore of a render node process. For now we relax the criteria in case of render node to match only on the offset. In the future this will need to be made more robust so strange partial mmaps can be handled as well. Signed-off-by: Tvrtko Ursulin --- plugins/amdgpu/amdgpu_plugin.c | 35 ++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/plugins/amdgpu/amdgpu_plugin.c b/plugins/amdgpu/amdgpu_plugin.c index 693df0ea7e39..664536850c42 100644 --- a/plugins/amdgpu/amdgpu_plugin.c +++ b/plugins/amdgpu/amdgpu_plugin.c @@ -2170,25 +2170,28 @@ int amdgpu_plugin_update_vmamap(const char *in_path, const uint64_t addr, const } list_for_each_entry(vma_md, &update_vma_info_list, list) { - if (addr == vma_md->vma_entry && old_offset == vma_md->old_pgoff) { - *new_offset = vma_md->new_pgoff; + if (old_offset != vma_md->old_pgoff) + continue; + if (is_kfd && addr != vma_md->vma_entry) + continue; + *new_offset = vma_md->new_pgoff; + if (is_renderD) { + int fd = dup(vma_md->fd); + + if (fd == -1) { + pr_perror("unable to duplicate the render fd"); + return -1; + } + *updated_fd = fd; + } else { *updated_fd = -1; - if (is_renderD) { - int fd = dup(vma_md->fd); - if (fd == -1) { - pr_perror("unable to duplicate the render fd"); - return -1; - } - *updated_fd = fd; - } - - pr_debug("old_pgoff=0x%lx new_pgoff=0x%lx fd=%d\n", - vma_md->old_pgoff, vma_md->new_pgoff, - *updated_fd); - - return 1; } + + pr_debug("old_pgoff=0x%lx new_pgoff=0x%lx fd=%d\n", + vma_md->old_pgoff, vma_md->new_pgoff, *updated_fd); + + return 1; } pr_info("No match for addr:0x%lx offset:%lx\n", addr, old_offset); return 0; -- 2.52.0