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 77824342524 for ; Fri, 20 Feb 2026 12:05:31 +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=1771589132; cv=none; b=ReAMZLse22w/dDf7W7iU50c9vfPSQ6z+Lo0uT53JxqNsvhjISMvNSIuijCuhXiScrykMz1+H91KQUurUFBOS5H3aGjfuuDTqPo20fiDNhmWohSp+mLL93peXun3hIclW7I5PtjqiIs8tch5GhbWa45UrLvclNOuUxQwiS1EZVDw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771589132; c=relaxed/simple; bh=XUIg0x0Aco9uHDcFzyFW8FSWb5Sq/nfe/Ano0HHCgvA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gESGx9hul4TlMj3HKHnHVzU2ktrFD6/L04h0jMNUWN0/YA7+UIS4Mti0HKcT5cN46JU4nVPWV7lFoz8+U4zEGff25Yk4yos0uQtoERJ7CVQy9qZzmltGNgAuurrcEBFBNmNB4uaBMr2jzmdnH6+jW+Xc2p6yZnf/lMnzixSDTEw= 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=jyk81q3t; 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="jyk81q3t" 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=6pNeLx5HhLq6xH0Wx+FaUtnRKa1JRfMupp+G+NY9Mp4=; b=jyk81q3tWfKuepjrAAzGTZUJ/s tZAytyICeieWyj6Xn2z1n+OQeFQCkr4dJ/cs8nDy07ThHeMrP2VrX8AZvAlyBCANu8+6ft/bUn6Yx Y9jMoeASWEipciRr0G4VmTXHhPiQ7gUx4qIG3+bmrIgEjHYCCEGqbJQC/6QkPKzerKFw3bW4BXlqY rdMt4Af4X5EtmzM+0Caly7Q7eXgX4mdjJRC2h3OK9kTXz5ibzyZVzQ+GyvUwkQw4uaxXJhuQKtVHk NQZCD7LZV5YDKP4NcFJyQ9sRGBHbGpVyqwSHN7ahCsOVvnzXlxMi+Mys0cTOt/CcfDAMzw3xG/NG0 PtZ9l9Nw==; 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 1vtPGD-002uyl-Fs; Fri, 20 Feb 2026 13:05:29 +0100 From: Tvrtko Ursulin To: criu@lists.linux.dev Cc: David Francis , Tvrtko Ursulin Subject: [RFC 06/26] plugins/amdgpu: Propagate failure to save buffer object content Date: Fri, 20 Feb 2026 12:04:54 +0000 Message-ID: <20260220120514.4540-7-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 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 --- 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 4970fa0d5afd..b13ec66e3336 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 1ec133de262d..34014783c2d4 100644 --- a/plugins/amdgpu/amdgpu_plugin_drm.c +++ b/plugins/amdgpu/amdgpu_plugin_drm.c @@ -385,6 +385,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; if (dmabuf_fd != KFD_INVALID_FD) close(dmabuf_fd); -- 2.52.0