Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 731EB606A322 for ; Fri, 4 Dec 2026 09:40:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.a=rsa-sha256 header.s=20170329 header.b=JGc10pMO Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2828F112E59; Fri, 4 Dec 2026 09:40:10 +0000 (UTC) Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 50EC5112E60 for ; Fri, 4 Dec 2026 09:39:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:From:To:Subject: MIME-Version:Date:Message-ID:From:Reply-To; bh=XdAdi44Enyez09Z+65n4Xu7qMGLbQs/GNTWhCkrW+Qc=; t=1796377142; x=2111737142; b=JGc10pMOBdrYZv2+eDMFX0WYSdm5etG6NO3kPVj23JVdizdwu89frHW8zREbrVDraMxt2enAT/l Swu5Xjni143cHGOmxaLrtWyPIzi0TMi21/va/TJhjPWrBopRfpN3Oj31ke8TPpg/v9ib1bFXpI6Uf iVQn4hsBW+UokJTQiAsqpEnBwOtJFfjP2w/gj+Y+20Qw3fQ49Vb1rYWvJjGbyQdPkFMjvaYK0WVsv K5siDx24/VWHQL6Kilnd/hqszCrUwiV9R3yoCEs9TBZdALbhddzUWNGzJ0oOb5YfJLeARQWBbiQ49 J45N4GlbEVSaMqtSR7YOLfu+jWCI7vYEpivw==; Received: from [81.79.79.1] (helo=[192.168.0.116]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_128_GCM:128) (Exim) (envelope-from ) id 1xZPkq-0000000200j-2kwa; Fri, 04 Dec 2026 10:39:00 +0100 Message-ID: <6049e88a-7051-47ad-91a1-232db42f74c8@igalia.com> Date: Fri, 4 Dec 2026 09:39:00 +0000 X-Archived-By: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH i-g-t 05/10] tests/amd/criu: Add some basic test cases To: "Francis, David" , "igt-dev@lists.freedesktop.org" References: <20261023145032.22650-1-tvrtko.ursulin@igalia.com> <20261023145032.22650-6-tvrtko.ursulin@igalia.com> Content-Language: en-GB From: Tvrtko Ursulin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: igt-dev@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development mailing list for IGT GPU Tools List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "igt-dev" X-Spam-Status: No, score=-16.5 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On 03/12/2026 19:57, Francis, David wrote: > Looking over these tests, I'm not sure this is a sensible way > of organizing the test suite. Because amd-side CRIU > mostly just uses the existing create-foo interfaces, this is a lot > of creating things and then confirming that they're created. > > Might be better organized by component so all these create, > change, list, and free interfaces can be tested individually against > each other and for all their corner cases. You mean patches 5-10 in this series are questionable for you? And by component you mean like patches 1-4? If so then yes, we can discuss patches 5-10 as they are the manual tests. But also if we don't have them what is the way to ensure no regressions in the whole checkpoint and restore flow? Punting the problem to some other test suite? IMO it is super required to have something like this somewhere. They are laid out in the series of increasing complexity and my kernel series cover letter has a description on how I use them. For example the most complex scenario (last patch), which uses all the new UAPI: Terminal 1: $ sudo ~/build-holo/tests/amdgpu/amd_criu --r busy-client-content IGT-Version: 2.3-ge37a85b91 (x86_64) (Linux: 7.1.0-rc2-cfs x86_64) Using IGT_SRANDOM=1779805687 for randomisation Opened device: /dev/dri/renderD128 Starting subtest: busy-client-content Start checkpointing within 10 seconds... Now switch to terminal 2: $ sudo /usr/local/sbin/criu dump -t `pgrep amd_criu | head -1` \ -L /usr/local/lib/criu/ -vvv -o criu.log -j --link-remap --tcp-established \ --file-locks --ext-unix-sk Back to terminal 1: ... Killed # This is normal - CRIU dump has saved and terminated the process Back to terminal 2, lets restore it: $ sudo /usr/local/sbin/criu restore -L /usr/local/lib/criu/ -vvv \ -o restore.log --shell-job --link-remap --tcp-established --file-locks --ext-unix-sk Subtest busy-client-content: SUCCESS (10.739s) And that is it. Client which was busy looping submitting a SDMA_NOP IB was successfuly checkpointed and restored to completion. It both ran for the remainder of the indented duration and we checked buffer content was as expected at the end. Regards, Tvrtko > ________________________________________ > From: Tvrtko Ursulin > Sent: Friday, October 23, 2026 10:50 AM > To: igt-dev@lists.freedesktop.org > Cc: Francis, David; Tvrtko Ursulin > Subject: [PATCH i-g-t 05/10] tests/amd/criu: Add some basic test cases > > Add a new test with some basic test cases to aid and verifiy the > development of amdgpu CRIU plugin and respecitve kernel interfaces. > > Subtests are laid out in the increasing order of complexity. > > Signed-off-by: Tvrtko Ursulin > --- > tests/amdgpu/amd_criu.c | 123 +++++++++++++++++++++++++++++++++++++++ > tests/amdgpu/meson.build | 1 + > 2 files changed, 124 insertions(+) > create mode 100644 tests/amdgpu/amd_criu.c > > diff --git a/tests/amdgpu/amd_criu.c b/tests/amdgpu/amd_criu.c > new file mode 100644 > index 000000000000..453c53d9a7df > --- /dev/null > +++ b/tests/amdgpu/amd_criu.c > @@ -0,0 +1,123 @@ > +// SPDX-License-Identifier: MIT > +/* > + * Copyright (c) 2026 Valve Corporation > + */ > + > +#include "igt.h" > +#include "drmtest.h" > + > +#include > +#include > + > +static void wait_checkpoint(void) > +{ > + igt_info("Waiting for checkpoint or key...\n"); > + getchar(); > +} > + > +#define BUFFER_SIZE 4096 > + > +#define CREATE_BO (1 << 0) > +#define MAP_BO (1 << 1) > +#define MMAP_BO (1 << 2) > +#define DO_FORK (1 << 3) > + > +static void basic(amdgpu_device_handle dev, unsigned int flags) > +{ > + amdgpu_bo_handle bo; > + amdgpu_va_handle va; > + uint64_t gva; > + void *addr; > + int ret; > + > + if (flags & CREATE_BO) { > + struct amdgpu_bo_alloc_request alloc = { > + .alloc_size = BUFFER_SIZE, > + .preferred_heap = AMDGPU_GEM_DOMAIN_GTT, > + }; > + ret = amdgpu_bo_alloc(dev, &alloc, &bo); > + igt_assert_eq(ret, 0); > + } > + > + if (flags & MAP_BO) { > + ret = amdgpu_va_range_alloc(dev, amdgpu_gpu_va_range_general, > + BUFFER_SIZE, 0, 0, &gva, &va, 0); > + igt_assert_eq(ret, 0); > + > + ret = amdgpu_bo_va_op(bo, 0, BUFFER_SIZE, gva, 0, > + AMDGPU_VA_OP_MAP); > + igt_assert_eq(ret, 0); > + } > + > + if (flags & MMAP_BO) { > + ret = amdgpu_bo_cpu_map(bo, &addr); > + igt_assert_eq(ret, 0); > + } > + > + if (flags & DO_FORK) { > + struct igt_helper_process child = {}; > + > + igt_fork_helper(&child) > + wait_checkpoint(); > + > + igt_wait_helper(&child); > + } else { > + wait_checkpoint(); > + } > + > + if (flags & MMAP_BO) > + amdgpu_bo_cpu_unmap(bo); > + > + if (flags & MAP_BO) { > + amdgpu_bo_va_op(bo, 0, BUFFER_SIZE, gva, 0, AMDGPU_VA_OP_UNMAP); > + amdgpu_va_range_free(va); > + } > + > + if (flags & CREATE_BO) > + amdgpu_bo_free(bo); > +} > + > +int igt_main() > +{ > + amdgpu_device_handle dev; > + int fd = -1; > + > + igt_fixture() { > + uint32_t major, minor; > + int err; > + > + fd = drm_open_driver_render(DRIVER_AMDGPU); > + > + err = amdgpu_device_initialize(fd, &major, &minor, &dev); > + igt_require(err == 0); > + } > + > + igt_describe("Open render node and initialize libdrm only"); > + igt_subtest("open") > + basic(dev, 0); > + > + igt_describe("Create one buffer object"); > + igt_subtest("one-bo") > + basic(dev, CREATE_BO); > + > + igt_describe("Map one buffer object"); > + igt_subtest("map-one") > + basic(dev, CREATE_BO | MAP_BO); > + > + igt_describe("Mmap one buffer object"); > + igt_subtest("mmap-one") > + basic(dev, CREATE_BO | MMAP_BO); > + > + igt_describe("Map and mmap one buffer object"); > + igt_subtest("map-and-mmap-one") > + basic(dev, CREATE_BO | MAP_BO | MMAP_BO); > + > + igt_describe("Map and mmap one buffer object, then fork"); > + igt_subtest("map-mmap-fork") > + basic(dev, CREATE_BO | MAP_BO | MMAP_BO | DO_FORK); > + > + igt_fixture() { > + amdgpu_device_deinitialize(dev); > + drm_close_driver(fd); > + } > +} > diff --git a/tests/amdgpu/meson.build b/tests/amdgpu/meson.build > index a915cf66a268..aa8a80354898 100644 > --- a/tests/amdgpu/meson.build > +++ b/tests/amdgpu/meson.build > @@ -12,6 +12,7 @@ if libdrm_amdgpu.found() > 'amd_color', > 'amd_cross_gpu_sync', > 'amd_cp_dma_misc', > + 'amd_criu', > 'amd_cs_nop', > 'amd_cursor_overlay', > 'amd_deadlock', > -- > 2.56.0 >