From mboxrd@z Thu Jan 1 00:00:00 1970 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 C7C9E26A1C4 for ; Fri, 10 Apr 2026 18:55:37 +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=1775847339; cv=none; b=aaePK6i+uZEbODGIwwwnYE+qirCuFIiMxQGMoJ6ntVbi9mty01gzFL2ZH8ZUcknAr2/r/jjn1nV4c0jZ2EWJm24CB4yQAlBRt3KsbkO/4mIGIbmXdAeBssejALk5iXkkMiNCtug4ky9x3YqOhQdv2ApRPhClyBgJukIjDUEkHz0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775847339; c=relaxed/simple; bh=OgstM3uiScTpV50do5rpavlVA/9CFaSp9Pg3my7YkgQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Y60B084HFDoVXgpzc+IHIH3fHO75dJO2C9a5iGLZ+5rh82eSZW6C27sZaxA8qrbO+dGHLn97nlAPtXIsGCtk3Cb5E/tt49C82+Em4TBrBAOf6UPKQgYn4Wfcyh9Jporxsl1Q92kEOLBqnXIfJaFVsWuLC6SuUmt/jenFz4dmnAI= 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=AZD2uAQU; 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="AZD2uAQU" 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=rkGfBNWFi8W6q4V+r0fCbjppsBxGZ/eKfPrj5f7kTEg=; b=AZD2uAQUOtxWZ9/JlJmjRE62nc g0dHQnIVT2yy2a76sFZ7Ka6x/7x0UOrSj1n7FzdhJkP/a/cbi0RX0eEyr9c9uhakBXXPldBNJ6KJh 69nQRZ6VhGvkbmKp83bEnOATgSlSo+Lvums2Bw4qrWeO7qtraN6pEVHoxuRv7EHcGzLI+aPStbugM IBPWuKsB6fUQtipHLQA+M/aZevDNa6nBAvrjn6PpopU+rvtiVZPpsM5rEWWF38sW8m7Z+McEvzf13 U88zJiKVghQnmh2zIBsJ3vWZJoxTJJHVjykfHoU4m72V/mKcFTc2MlaUcMIFysvikJg14zFtB4LOz 7eidsp+g==; 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 1wBH0x-00EWTo-QI; Fri, 10 Apr 2026 20:55:35 +0200 From: Tvrtko Ursulin To: criu@lists.linux.dev Cc: Tvrtko Ursulin , David Francis Subject: [PATCH v2 06/23] plugins/amdgpu: Propagate failure to save buffer object content Date: Fri, 10 Apr 2026 19:54:57 +0100 Message-ID: <20260410185514.51153-7-tvrtko.ursulin@igalia.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260410185514.51153-1-tvrtko.ursulin@igalia.com> References: <20260410185514.51153-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 Currently the failure to save content of a buffer object is only logged, while the checkpointing will continue unaware due the error code being "eaten" inside sdma_copy_bo() cleanup path, together with the caller not checking the return value to begin with. Fix it by preserving and returning the original error code inside sdma_copy_bo(), and abort the checkpointing process in case of a failure. Signed-off-by: Tvrtko Ursulin Reviewed-By: David Francis --- plugins/amdgpu/amdgpu_plugin.c | 31 +++++++++++++++--------------- plugins/amdgpu/amdgpu_plugin_drm.c | 2 ++ 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/plugins/amdgpu/amdgpu_plugin.c b/plugins/amdgpu/amdgpu_plugin.c index a55e6cef96c4..c875df060eed 100644 --- a/plugins/amdgpu/amdgpu_plugin.c +++ b/plugins/amdgpu/amdgpu_plugin.c @@ -563,7 +563,7 @@ int sdma_copy_bo(int shared_fd, uint64_t size, FILE *storage_fp, uint32_t expired; amdgpu_context_handle h_ctx; uint32_t *ib = NULL; - int j, err, packets_per_buffer; + int j, err, err2, packets_per_buffer; buffer_bo_size = min(size, buffer_size); packets_per_buffer = ((buffer_bo_size - 1) / max_copy_size) + 1; @@ -767,29 +767,30 @@ err_ctx: err_bo_list: free_and_unmap(packets_per_buffer * 28, h_bo_ib, h_va_ib, gpu_addr_ib, ib); err_ib_gpu_alloc: - err = amdgpu_bo_va_op(h_bo_dst, 0, size, gpu_addr_dst, 0, AMDGPU_VA_OP_UNMAP); - if (err) + err2 = amdgpu_bo_va_op(h_bo_dst, 0, size, gpu_addr_dst, 0, AMDGPU_VA_OP_UNMAP); + if (err2) pr_perror("failed to GPU unmap the dest BO %lx, size = %lx", gpu_addr_dst, size); err_dst_bo_map: - err = amdgpu_va_range_free(h_va_dst); - if (err) + err2 = amdgpu_va_range_free(h_va_dst); + if (err2) pr_perror("dest range free failed"); err_dst_va: - if (!do_not_free) - err = amdgpu_bo_free(h_bo_dst); - if (err) - pr_perror("dest bo free failed"); + if (!do_not_free) { + err2 = amdgpu_bo_free(h_bo_dst); + if (err2) + pr_perror("dest bo free failed"); + } err_dst_bo_prep: - err = amdgpu_bo_va_op(h_bo_src, 0, size, gpu_addr_src, 0, AMDGPU_VA_OP_UNMAP); - if (err) + err2 = amdgpu_bo_va_op(h_bo_src, 0, size, gpu_addr_src, 0, AMDGPU_VA_OP_UNMAP); + if (err2) pr_perror("failed to GPU unmap the src BO %lx, size = %lx", gpu_addr_src, size); err_src_bo_map: - err = amdgpu_va_range_free(h_va_src); - if (err) + err2 = amdgpu_va_range_free(h_va_src); + if (err2) pr_perror("src range free failed"); err_src_va: - err = amdgpu_bo_free(h_bo_src); - if (err) + err2 = amdgpu_bo_free(h_bo_src); + if (err2) pr_perror("src bo free failed"); plugin_log_msg("Leaving sdma_copy_bo, err = %d\n", err); return err; diff --git a/plugins/amdgpu/amdgpu_plugin_drm.c b/plugins/amdgpu/amdgpu_plugin_drm.c index 487c2a1e2a6d..a5ab3adffa6c 100644 --- a/plugins/amdgpu/amdgpu_plugin_drm.c +++ b/plugins/amdgpu/amdgpu_plugin_drm.c @@ -438,6 +438,8 @@ int amdgpu_plugin_drm_dump_file(int fd, int id, struct stat *drm) ret = sdma_copy_bo(dmabuf_fd, handle_entry.size, bo_contents_fp, buffer, handle_entry.size, h_dev, 0x1000, SDMA_OP_VRAM_READ, false); + if (ret) + goto exit; xfree(buffer); -- 2.52.0