From patchwork Thu May 30 09:54:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1941610 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=TuIgLXAg; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VqhTM19Cbz20Pc for ; Thu, 30 May 2024 19:55:51 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sCcUN-00070l-Tn; Thu, 30 May 2024 05:54:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sCcUL-000704-Rl for qemu-devel@nongnu.org; Thu, 30 May 2024 05:54:25 -0400 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sCcUJ-00026Q-IV for qemu-devel@nongnu.org; Thu, 30 May 2024 05:54:25 -0400 Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-6c104f64ff6so218161a12.1 for ; Thu, 30 May 2024 02:54:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717062862; x=1717667662; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7OY+Yb66xH2ve4EOh/kSWfFWLssdw6ThCr38/yoK6pI=; b=TuIgLXAg2iAcwZrMI/B7S0WRFDOwAyghYDMyJd0dlzkF8l8RtM+C752X4Aw3J8So5y SCf0vJtLqFb9DFWvdInWnH0+D/eqaB6abKTU/AluqSTuljF2xEwO4jKOf4i4UfIVUtt+ AIvh4Tv9lsKsV4fJk5PTpVmbt0T47IYjKzg/KPTRD4J3xd1iW4Ap+lcn0mRp+RyZj+tn s0ba6ZZjVV4QHCuDL1Ur2uV5zuLyUZho0F3ZgUruEobDQ/l4At+7RE040xxci95k9xYn M+9N8jtXmQFaUJQ828drRlT3LGOtPLQxhS4ZSFkKJ/4bzBruRXF9Z//SGqZI61Gvu3PD Pqbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717062862; x=1717667662; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7OY+Yb66xH2ve4EOh/kSWfFWLssdw6ThCr38/yoK6pI=; b=wlA2n3b9zGdYCuHjdC7K14n4WfSfDXf0a+2A8zAE5fJlmNY2gAetY6w5+ZUX8eNC5v HxsRrSbHsGnt3WpXWNva6rZ/6dwtiIwcS1uGsHX99bLjD113UBXz+1lCprhm8HPYbV4+ T7/+haOYd+f/EeHu1uXzrZdIKa8LbzUhPdZWVHKWRtZ3RxfbmoU6fh2OX/U3lsJf2II3 cBtqb706jm1enmtUD0q8kHqb5JMxLTNXQQEtng317/Dep12tpRXtiUZ0UVwkVFMyDXS3 dK0Loq/9tWcSEfdXjHzIXVdaClxTyNmN736T05j6p5Bp2td5Xk+/jhXlIPhjyi0ts/sR 2fDQ== X-Gm-Message-State: AOJu0Yyv6pLZj3KEbPI/VgXcTjyOuhJP9YMoJMdXI8REXezVY1r6Ku+J JlxmfOTdtWhBHS8AB6kEkMuizacrFBXZHdLWpbX/WwivFtmsK7mHzekcN9Uu X-Google-Smtp-Source: AGHT+IFb8Oi6i9H0gmUifZb4BGlKK57TqfSUWvOHImiNUBpsrMEcHrrNoGVfA2rMPwUztr8Z9rNzoA== X-Received: by 2002:a17:90b:60e:b0:2bd:dce4:8f90 with SMTP id 98e67ed59e1d1-2c1abc064f1mr1627738a91.6.1717062861513; Thu, 30 May 2024 02:54:21 -0700 (PDT) Received: from wheely.local0.net ([1.146.0.82]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2c1a775d28asm1183626a91.8.2024.05.30.02.54.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 02:54:21 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , Peter Xu , Fabiano Rosas , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PATCH v2 1/4] tests/qtest/migration-test: Use regular file file for shared-memory tests Date: Thu, 30 May 2024 19:54:04 +1000 Message-ID: <20240530095408.31608-2-npiggin@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240530095408.31608-1-npiggin@gmail.com> References: <20240530095408.31608-1-npiggin@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52c; envelope-from=npiggin@gmail.com; helo=mail-pg1-x52c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org There is no need to use /dev/shm for file-backed memory devices, and on Gitlab CI the tmpfs mount is too small to be usable for migration tests. Switch to using a regular file in /tmp/ which will usually have more space available. Signed-off-by: Nicholas Piggin Reviewed-by: Prasad Pandit --- tests/qtest/migration-test.c | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index d6f5ceed80..8bbf45313d 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -552,7 +552,7 @@ typedef struct { * unconditionally, because it means the user would like to be verbose. */ bool hide_stderr; - bool use_shmem; + bool use_memfile; /* only launch the target process */ bool only_target; /* Use dirty ring if true; dirty logging otherwise */ @@ -672,21 +672,14 @@ static int test_migrate_start(QTestState **from, QTestState **to, g_autofree gchar *cmd_source = NULL; g_autofree gchar *cmd_target = NULL; const gchar *ignore_stderr; - g_autofree char *shmem_opts = NULL; - g_autofree char *shmem_path = NULL; + g_autofree char *memfile_opts = NULL; + g_autofree char *memfile_path = NULL; const char *kvm_opts = NULL; const char *arch = qtest_get_arch(); const char *memory_size; const char *machine_alias, *machine_opts = ""; g_autofree char *machine = NULL; - if (args->use_shmem) { - if (!g_file_test("/dev/shm", G_FILE_TEST_IS_DIR)) { - g_test_skip("/dev/shm is not supported"); - return -1; - } - } - dst_state = (QTestMigrationState) { }; src_state = (QTestMigrationState) { }; bootfile_create(tmpfs, args->suspend_me); @@ -746,12 +739,12 @@ static int test_migrate_start(QTestState **from, QTestState **to, ignore_stderr = ""; } - if (args->use_shmem) { - shmem_path = g_strdup_printf("/dev/shm/qemu-%d", getpid()); - shmem_opts = g_strdup_printf( + if (args->use_memfile) { + memfile_path = g_strdup_printf("/%s/qemu-%d", tmpfs, getpid()); + memfile_opts = g_strdup_printf( "-object memory-backend-file,id=mem0,size=%s" ",mem-path=%s,share=on -numa node,memdev=mem0", - memory_size, shmem_path); + memory_size, memfile_path); } if (args->use_dirty_ring) { @@ -780,7 +773,7 @@ static int test_migrate_start(QTestState **from, QTestState **to, memory_size, tmpfs, arch_opts ? arch_opts : "", arch_source ? arch_source : "", - shmem_opts ? shmem_opts : "", + memfile_opts ? memfile_opts : "", args->opts_source ? args->opts_source : "", ignore_stderr); if (!args->only_target) { @@ -802,7 +795,7 @@ static int test_migrate_start(QTestState **from, QTestState **to, memory_size, tmpfs, uri, arch_opts ? arch_opts : "", arch_target ? arch_target : "", - shmem_opts ? shmem_opts : "", + memfile_opts ? memfile_opts : "", args->opts_target ? args->opts_target : "", ignore_stderr); *to = qtest_init_with_env(QEMU_ENV_DST, cmd_target); @@ -814,8 +807,8 @@ static int test_migrate_start(QTestState **from, QTestState **to, * Remove shmem file immediately to avoid memory leak in test failed case. * It's valid because QEMU has already opened this file */ - if (args->use_shmem) { - unlink(shmem_path); + if (args->use_memfile) { + unlink(memfile_path); } return 0; @@ -1868,6 +1861,9 @@ static void test_ignore_shared(void) { g_autofree char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs); QTestState *from, *to; + MigrateStart args = { + .use_memfile = true, + }; if (test_migrate_start(&from, &to, uri, false, true, NULL, NULL)) { return; @@ -2024,7 +2020,7 @@ static void test_mode_reboot(void) g_autofree char *uri = g_strdup_printf("file:%s/%s", tmpfs, FILE_TEST_FILENAME); MigrateCommon args = { - .start.use_shmem = true, + .start.use_memfile = true, .connect_uri = uri, .listen_uri = "defer", .start_hook = test_mode_reboot_start From patchwork Thu May 30 09:54:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1941606 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=SpFDr0Fd; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VqhT10ldPz20Pc for ; Thu, 30 May 2024 19:55:31 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sCcUQ-00071P-8l; Thu, 30 May 2024 05:54:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sCcUP-00071H-8C for qemu-devel@nongnu.org; Thu, 30 May 2024 05:54:29 -0400 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sCcUN-00026k-Nl for qemu-devel@nongnu.org; Thu, 30 May 2024 05:54:28 -0400 Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-6c104f64ff6so218198a12.1 for ; Thu, 30 May 2024 02:54:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717062865; x=1717667665; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4pFJzHDtmft5g8RBuvLaR9yxIK0lDH4VCI5JZiV1edk=; b=SpFDr0Fdtnl932T7FjegWXs+Pql8yGD3rpZ+yJaBODTF530NdlHuk5z7gMJM7A+3m3 k9fF7+aCsVyZVdHNKrnuY56tShLpa7h3ZDxNYpkJd7X3LaxVMaR2oDLWn+vAgpRR3qsi mGiQ3+EtuFdVD83U6gWqaCxR5hIuwGN0sDXel1O2ZxJtDUx2oVBpIaXhguyD+34Ayy0M 6mcxPKLOplTwd1onaYmjK4zC/ZL3zMKq3RyFUhWnO2PhOo9ZoboqlGn0fEYxe3V/kJjc siJ4fY3eJpYqYNYow1uec3jlzP880+4hgk7KUSWamsTS53fE4eL84oOLolyKVTY4dyGO SmYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717062865; x=1717667665; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4pFJzHDtmft5g8RBuvLaR9yxIK0lDH4VCI5JZiV1edk=; b=gzzL1jCrIcdHFVBQzicA+zJG9YjCYkdrzPzmAz9gQ6tv4lCwqJRYi9iY+hwt1d4WN9 C/EgVeKmHsEe+oeDRGWoua++S7WZe2EsyWCWYZlDI+wHAFvGhY+eG5kbDF+LI5aVovh6 kSPcQyaty+XTyndXYWLB/vTDlYDJLBg85wJYin/6MY6v8/NH8Bc51K4XoOp1hRa7nVC0 JPLgFEcrB6ZnOBVFDpBfPFWS4F8I4U6eZSu//RYpYqrFg5WCJLXNeYhPHTNNd8fWCkyu GfLZ4WBAQqyux/bop9+mvjqYDmVh7QC2MVq1vIsqlsuaQAKvjo1P9BrpX7o0zK2AqIZ0 Koow== X-Gm-Message-State: AOJu0YwLyZOik04czI1IVA8tlE0KfC0k0jpxqNNHzAtE+5b9rgKdvPIF 7OG0nASihlJQ/tfGuH5+eJWcGiTp6DsAK21aPKJr4HKNZHL3UfZaTVojOQfE X-Google-Smtp-Source: AGHT+IHkxr9RTTmBrPUBp1kRKkAPwkMA2RDNlgQ8Hl5lYwZkSHRcylHxqCfxeg+tx4sGMziZEYO7tA== X-Received: by 2002:a17:90a:f195:b0:2bd:d42a:f84e with SMTP id 98e67ed59e1d1-2c1abc06547mr1573898a91.7.1717062865492; Thu, 30 May 2024 02:54:25 -0700 (PDT) Received: from wheely.local0.net ([1.146.0.82]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2c1a775d28asm1183626a91.8.2024.05.30.02.54.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 02:54:25 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , Peter Xu , Fabiano Rosas , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PATCH v2 2/4] tests/qtest/migration-test: Enable test_mode_reboot Date: Thu, 30 May 2024 19:54:05 +1000 Message-ID: <20240530095408.31608-3-npiggin@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240530095408.31608-1-npiggin@gmail.com> References: <20240530095408.31608-1-npiggin@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=npiggin@gmail.com; helo=mail-pg1-x530.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Fabiano pointed out this test probably is not flaky, just that it could not run under Gitlab CI due to very small shm filesystem size in that environment. Now that it has moved to use /tmp instead of /dev/shm files, enable it. Signed-off-by: Nicholas Piggin Reviewed-by: Fabiano Rosas --- tests/qtest/migration-test.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 8bbf45313d..de380757be 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -3469,15 +3469,7 @@ int main(int argc, char **argv) test_precopy_file_offset); migration_test_add("/migration/precopy/file/offset/bad", test_precopy_file_offset_bad); - - /* - * Our CI system has problems with shared memory. - * Don't run this test until we find a workaround. - */ - if (getenv("QEMU_TEST_FLAKY_TESTS")) { - migration_test_add("/migration/mode/reboot", test_mode_reboot); - } - + migration_test_add("/migration/mode/reboot", test_mode_reboot); migration_test_add("/migration/precopy/file/mapped-ram", test_precopy_file_mapped_ram); migration_test_add("/migration/precopy/file/mapped-ram/live", From patchwork Thu May 30 09:54:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1941609 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=mInto20s; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VqhT70RYLz20fB for ; Thu, 30 May 2024 19:55:38 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sCcUV-00072m-KY; Thu, 30 May 2024 05:54:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sCcUU-00072H-5J for qemu-devel@nongnu.org; Thu, 30 May 2024 05:54:34 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sCcUS-000276-I1 for qemu-devel@nongnu.org; Thu, 30 May 2024 05:54:33 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-70109d34a16so612174b3a.2 for ; Thu, 30 May 2024 02:54:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717062871; x=1717667671; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TK1ni0WgaIAGvB3Nq6LtzZBMjfwj1klth7CAx1fgods=; b=mInto20shjHDIpwG7z72lltSXa7pOXGVZIikZWw/Bi2rlBU4mU/hLXIRnQgrNCj5qj GpGNeGNgJMCs8E/w/trsTJk1HWZXpY+ckab98+Ms46iucDh7E1Qm6dIbX5QSwYqIiWsa 8sdFB1FKfnoEVs5JA23eIQ+RmKgarsGtf8pfMpFi2tEOdd8jfTiFh7AYWhDJGonKFldW C8GL5nesiBLE9z3W1TlHwl3vSeBNKbdLD0ik86N7b6fJRGlAGsVHqLBxFUlf1mvGEAUk eNRUSK1IDDfUdGknRG4ssIpOdwIHq80Kgi7TceM8bpL1JktedwnjRL/xePoYHL5eDYQb FuQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717062871; x=1717667671; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TK1ni0WgaIAGvB3Nq6LtzZBMjfwj1klth7CAx1fgods=; b=iaFEJCZ5O/9RPa4OfNDEE+V12T86kvuNnSx4vSJ3ZxBZOi2kn1gqnXKKB+g7c7C4XT hB//Sbkj5yy/mJgfVZpoOGCuYPo6tGDcxL5s84vgXSipjUwSS1KImsX1qEkd/RPNcfcD v50f34IyS/qt4MaSpiG/GjfDaj822l8xV5kai0ex1SakpodQkRCrEcL439DN/Fs0MS7J 102OhDQzAtIT8OgWAPq+z45u9/oF2aLxHHaMANBrNIb1Mtvd0SfXAnub8F6VmYt/7eHe cTcrFDqsRZcVxjjKz28BbQ6WMSg1U4tniOkJWvJKXsZDzV31tO8WA1oc11rr26U0QWwj tDAA== X-Gm-Message-State: AOJu0YyDHzMSXTT5Vz9jy2+Kt7RSOqFrJYhTT28EOvKqz7TvAwfxEtY+ UIuN4bJXfE+AlWVKHOPbjo6tmhOIU6/yltijsKp3VEpA/+XmFw4hnst1QaUc X-Google-Smtp-Source: AGHT+IHoJe6tacDUNBRIkkTeRjLeh1PkK1t9VXQmu8+akCLLS36F7490acIpv5ITjs41XxCRNd9Jog== X-Received: by 2002:a05:6a20:9747:b0:1b2:2ed2:b80a with SMTP id adf61e73a8af0-1b2646905c1mr1367658637.61.1717062870748; Thu, 30 May 2024 02:54:30 -0700 (PDT) Received: from wheely.local0.net ([1.146.0.82]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2c1a775d28asm1183626a91.8.2024.05.30.02.54.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 02:54:30 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , Peter Xu , Fabiano Rosas , Thomas Huth , Laurent Vivier , Paolo Bonzini , Yury Kotov , "Dr . David Alan Gilbert" Subject: [PATCH v2 3/4] tests/qtest/migration-test: Fix and enable test_ignore_shared Date: Thu, 30 May 2024 19:54:06 +1000 Message-ID: <20240530095408.31608-4-npiggin@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240530095408.31608-1-npiggin@gmail.com> References: <20240530095408.31608-1-npiggin@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=npiggin@gmail.com; helo=mail-pf1-x431.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This test is already starting to bitrot, so first remove it from ifdef and fix compile issues. ppc64 transfers about 2MB, so bump the size threshold too. It was said to be broken on aarch64 but it may have been due to the limited shm size under Gitlab CI. Now that it uses /tmp, enable it. Cc: Yury Kotov Cc: Dr. David Alan Gilbert Signed-off-by: Nicholas Piggin Reviewed-by: Dr. David Alan Gilbert --- tests/qtest/migration-test.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index de380757be..86eace354e 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -1855,8 +1855,6 @@ static void test_precopy_unix_tls_x509_override_host(void) #endif /* CONFIG_TASN1 */ #endif /* CONFIG_GNUTLS */ -#if 0 -/* Currently upset on aarch64 TCG */ static void test_ignore_shared(void) { g_autofree char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs); @@ -1865,7 +1863,7 @@ static void test_ignore_shared(void) .use_memfile = true, }; - if (test_migrate_start(&from, &to, uri, false, true, NULL, NULL)) { + if (test_migrate_start(&from, &to, uri, &args)) { return; } @@ -1890,11 +1888,11 @@ static void test_ignore_shared(void) wait_for_migration_complete(from); /* Check whether shared RAM has been really skipped */ - g_assert_cmpint(read_ram_property_int(from, "transferred"), <, 1024 * 1024); + g_assert_cmpint(read_ram_property_int(from, "transferred"), <, + 4 * 1024 * 1024); test_migrate_end(from, to, true); } -#endif static void * test_migrate_xbzrle_start(QTestState *from, @@ -3535,7 +3533,8 @@ int main(int argc, char **argv) #endif /* CONFIG_TASN1 */ #endif /* CONFIG_GNUTLS */ - /* migration_test_add("/migration/ignore_shared", test_ignore_shared); */ + migration_test_add("/migration/ignore_shared", test_ignore_shared); + #ifndef _WIN32 migration_test_add("/migration/precopy/fd/tcp", test_migrate_precopy_fd_socket); From patchwork Thu May 30 09:54:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1941608 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=CGj0rUAW; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VqhT666tMz20WX for ; Thu, 30 May 2024 19:55:38 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sCcUa-00075Q-M3; Thu, 30 May 2024 05:54:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sCcUY-00074W-NV for qemu-devel@nongnu.org; Thu, 30 May 2024 05:54:38 -0400 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sCcUW-00027V-Ly for qemu-devel@nongnu.org; Thu, 30 May 2024 05:54:38 -0400 Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-6bce380eb96so485470a12.0 for ; Thu, 30 May 2024 02:54:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717062875; x=1717667675; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tnIeYsOj4b7IsclyGOZghZMKCz5C3A6o8pslemkUzRU=; b=CGj0rUAWxxHjhVNwE/BSNm3WTyW9G2EDl9Uq297z1nhXeHpIDhJ/OazKJXAuemuKqO ib1NxwLyWFtkNeBXHdhuOQhFV6C6JHItteNHyVsnm5/OKBaAeiDnmqg+j/U4IBtXN31/ CVx4GngKfHgvOTjkDOeJECYGKfUR3ifWYMMPIGcR5liWddak202tmpcubND1pyed2zTn YGg9I+4iVVehAIvq/M6mmbjl9Ligp5hlBKK/7pTkuHUW0qRVB6oeB5XONGMUeON7TyRr mlRnlNEMYyUZNfql3FIaTBLrd4xZA4HVReB7mKdHEcU87l+/gVPKiGLyLV78xeNsLU9u NSIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717062875; x=1717667675; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tnIeYsOj4b7IsclyGOZghZMKCz5C3A6o8pslemkUzRU=; b=JE8Ysu/rfuNZJkaaPFmhccM2NdarFS4mKeeQwoOpX6Mr5qMHjbCY7cTuN52Tq78dzB eA4+QxvC1EnApqODVavyw3RMzTdPdgNVQoAI/PmZ068hKkfGygBYzEzpUTftF8kSuwZl ZMBu5EYn4CwRCTyzCUp5E1qpDgH1MQAoVS/mWWGJRUVygOl7Go6iehLnnTNOfvSgr9j+ pS5jQqa4/vk8/9LLZZb0F5DWIEvQtT8fK+i9FpbQD9r2Z8u1DLGUns6jPkiJezdmJwDj IugAni0U3OKUGqp6KkK1H/wobcjL/RhENV5q6tkx09gUCl+yNeoTGdAUOwgJodoYy3tJ NS+w== X-Gm-Message-State: AOJu0YwXy+ptRAHm1U3VxutAsWL1jp8icvlKDznK81i9E6/L/y3wtdf7 YGrtcx0wAdGN/NoCkhoL7jJoS0UCYinJVx3yqSVxSuEfhQ3kXTR8E6ksJZMa X-Google-Smtp-Source: AGHT+IEyzVIeXlIpDHfsSpzH3gt+zx9FIqWtWgdLPpQeAL7EcufB9lX0C0UXEDAyV1vlZqjrKeIFoA== X-Received: by 2002:a17:90a:d155:b0:2bf:cf50:593e with SMTP id 98e67ed59e1d1-2c1ab9f6c7cmr1627549a91.11.1717062874986; Thu, 30 May 2024 02:54:34 -0700 (PDT) Received: from wheely.local0.net ([1.146.0.82]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2c1a775d28asm1183626a91.8.2024.05.30.02.54.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 02:54:34 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , Peter Xu , Fabiano Rosas , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PATCH v2 4/4] tests/qtest/migration-test: Add a postcopy memfile test Date: Thu, 30 May 2024 19:54:07 +1000 Message-ID: <20240530095408.31608-5-npiggin@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240530095408.31608-1-npiggin@gmail.com> References: <20240530095408.31608-1-npiggin@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=npiggin@gmail.com; helo=mail-pg1-x530.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Postcopy requires userfaultfd support, which requires tmpfs if a memory file is used. This adds back support for /dev/shm memory files, but adds preallocation to skip environments where that mount is limited in size. Signed-off-by: Nicholas Piggin --- tests/qtest/migration-test.c | 77 ++++++++++++++++++++++++++++++++---- 1 file changed, 69 insertions(+), 8 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 86eace354e..5078033ded 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -11,6 +11,7 @@ */ #include "qemu/osdep.h" +#include "qemu/cutils.h" #include "libqtest.h" #include "qapi/qmp/qdict.h" @@ -553,6 +554,7 @@ typedef struct { */ bool hide_stderr; bool use_memfile; + bool use_shm_memfile; /* only launch the target process */ bool only_target; /* Use dirty ring if true; dirty logging otherwise */ @@ -739,7 +741,62 @@ static int test_migrate_start(QTestState **from, QTestState **to, ignore_stderr = ""; } - if (args->use_memfile) { + if (!qtest_has_machine(machine_alias)) { + g_autofree char *msg = g_strdup_printf("machine %s not supported", + machine_alias); + g_test_skip(msg); + return -1; + } + + if (args->use_shm_memfile) { +#if defined(__NR_userfaultfd) && defined(__linux__) + int fd; + uint64_t size; + + if (getenv("GITLAB_CI")) { + /* + * Gitlab runners are limited to 64MB shm size and despite + * pre-allocation there is concern that concurrent tests + * could result in nondeterministic failures. Until all shm + * usage in all CI tests is found to fail gracefully on + * ENOSPC, it is safer to avoid large allocations for now. + * + * https://lore.kernel.org/qemu-devel/875xuwg4mx.fsf@suse.de/ + */ + g_test_skip("shm tests are not supported in Gitlab CI environment"); + return -1; + } + + if (!g_file_test("/dev/shm", G_FILE_TEST_IS_DIR)) { + g_test_skip("/dev/shm does not exist or is not a directory"); + return -1; + } + + /* + * Pre-create and allocate the file here, because /dev/shm/ + * is known to be limited in size in some places (e.g., Gitlab CI). + */ + memfile_path = g_strdup_printf("/dev/shm/qemu-%d", getpid()); + fd = open(memfile_path, O_WRONLY | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); + if (fd == -1) { + g_test_skip("/dev/shm file could not be created"); + return -1; + } + + g_assert(qemu_strtosz(memory_size, NULL, &size) == 0); + size += 64*1024; /* QEMU may map a bit more memory for a guard page */ + + if (fallocate(fd, 0, 0, size) == -1) { + unlink(memfile_path); + perror("could not alloc"); exit(1); + g_test_skip("Could not allocate machine memory in /dev/shm"); + return -1; + } + close(fd); +#else + g_test_skip("userfaultfd is not supported"); +#endif + } else if (args->use_memfile) { memfile_path = g_strdup_printf("/%s/qemu-%d", tmpfs, getpid()); memfile_opts = g_strdup_printf( "-object memory-backend-file,id=mem0,size=%s" @@ -751,12 +808,6 @@ static int test_migrate_start(QTestState **from, QTestState **to, kvm_opts = ",dirty-ring-size=4096"; } - if (!qtest_has_machine(machine_alias)) { - g_autofree char *msg = g_strdup_printf("machine %s not supported", machine_alias); - g_test_skip(msg); - return -1; - } - machine = resolve_machine_version(machine_alias, QEMU_ENV_SRC, QEMU_ENV_DST); @@ -807,7 +858,7 @@ static int test_migrate_start(QTestState **from, QTestState **to, * Remove shmem file immediately to avoid memory leak in test failed case. * It's valid because QEMU has already opened this file */ - if (args->use_memfile) { + if (args->use_memfile || args->use_shm_memfile) { unlink(memfile_path); } @@ -1275,6 +1326,15 @@ static void test_postcopy(void) test_postcopy_common(&args); } +static void test_postcopy_memfile(void) +{ + MigrateCommon args = { + .start.use_shm_memfile = true, + }; + + test_postcopy_common(&args); +} + static void test_postcopy_suspend(void) { MigrateCommon args = { @@ -3441,6 +3501,7 @@ int main(int argc, char **argv) if (has_uffd) { migration_test_add("/migration/postcopy/plain", test_postcopy); + migration_test_add("/migration/postcopy/memfile", test_postcopy_memfile); migration_test_add("/migration/postcopy/recovery/plain", test_postcopy_recovery); migration_test_add("/migration/postcopy/preempt/plain",