From: Nicholas Piggin <npiggin@gmail.com>
To: qemu-devel@nongnu.org
Cc: Nicholas Piggin <npiggin@gmail.com>, Peter Xu <peterx@redhat.com>,
Fabiano Rosas <farosas@suse.de>, Thomas Huth <thuth@redhat.com>,
Laurent Vivier <lvivier@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
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 [thread overview]
Message-ID: <20240530095408.31608-2-npiggin@gmail.com> (raw)
In-Reply-To: <20240530095408.31608-1-npiggin@gmail.com>
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 <npiggin@gmail.com>
---
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
--
2.43.0
next prev parent reply other threads:[~2024-05-30 9:55 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-30 9:54 [PATCH v2 0/4] tests/qtest/migration-test: Improve shared Nicholas Piggin
2024-05-30 9:54 ` Nicholas Piggin [this message]
2024-05-31 7:03 ` [PATCH v2 1/4] tests/qtest/migration-test: Use regular file file for shared-memory tests Prasad Pandit
2024-05-30 9:54 ` [PATCH v2 2/4] tests/qtest/migration-test: Enable test_mode_reboot Nicholas Piggin
2024-05-31 15:50 ` Fabiano Rosas
2024-05-30 9:54 ` [PATCH v2 3/4] tests/qtest/migration-test: Fix and enable test_ignore_shared Nicholas Piggin
2024-05-30 12:18 ` Dr. David Alan Gilbert
2024-12-09 17:22 ` Fabiano Rosas
2024-05-30 9:54 ` [PATCH v2 4/4] tests/qtest/migration-test: Add a postcopy memfile test Nicholas Piggin
2024-05-31 13:34 ` Peter Xu
2024-05-31 16:01 ` Fabiano Rosas
2024-06-03 6:02 ` Nicholas Piggin
2024-06-03 15:50 ` Peter Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240530095408.31608-2-npiggin@gmail.com \
--to=npiggin@gmail.com \
--cc=farosas@suse.de \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).