From patchwork Mon Feb 26 09:38:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1904218 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=mkZOUH7i; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=patchwork.ozlabs.org) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TjwZJ58Tsz23qD for ; Mon, 26 Feb 2024 20:39:52 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=mkZOUH7i; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4TjwZJ4K30z3cCK for ; Mon, 26 Feb 2024 20:39:52 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.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=mkZOUH7i; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::52f; helo=mail-pg1-x52f.google.com; envelope-from=npiggin@gmail.com; receiver=lists.ozlabs.org) Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4TjwYD1x79z2xPd for ; Mon, 26 Feb 2024 20:38:56 +1100 (AEDT) Received: by mail-pg1-x52f.google.com with SMTP id 41be03b00d2f7-5dc949f998fso1889231a12.3 for ; Mon, 26 Feb 2024 01:38:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708940333; x=1709545133; darn=lists.ozlabs.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=6vnjHCFtfaL9mXwWGPHpDHfEXciN5WUW1+wFbKGrPaI=; b=mkZOUH7iht9PZy8P/meemUblPGXlZmnva8NsSR+3uBoAt0WF+YbfUD/UZL/QTF0vDa sE/Qz4/DUIwSkLIHEFxrIwQXy29RbVPgwjcrzKN7pb4fdj4ppEGTu49ThM92XFz87dva sBrgsKw2wmxGvWUUtvw+Rg5cqrfmr2D02DBYagm4k1hdSV8M4wvnEFOx78c/9S/xiaHN b2Rw76R+GpeWmgEL1+Jmwxeapxq+7SyLMpeBDYLbb8OwqPBwmmK90WPJvc/l+50KEA7T VT85BUKPpBeeF6K7g5aI+u/161MHBRY2NDtlCn0IA6JXeiAqZABF+DoQBolDN3gmpgdL N+kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708940333; x=1709545133; 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=6vnjHCFtfaL9mXwWGPHpDHfEXciN5WUW1+wFbKGrPaI=; b=gZJOccQvt5/YrGifZ01PEYa6dIAofB+9PW7sm44RNTxUCQj1k98GmZ3u32ulKBaMGP OrLJPlcybngWvqW648C1J01gbNCP/dM6O0qw+5VFv8Pd3jTejGQzdaceuzoeFyavebjl jtHsnY/upB3l9fV2ES7C11wJM1iWOPNJtevgCkI2XpSFIE288hOY5Eyp44cIcpW2uh9N OqjhzMdH0x3zHPhfnmW/IjusMdBj+QtM2y1qDdTm4EV0Q7hF4F6NPWpEvDn1x+gJPF0g pKuPrcVnxOBmE35tBAjTM077F/sghR1W1Gv8QVaX+Jmt6z/YL3tT/zQajAa8eU/DL9qi HRQA== X-Forwarded-Encrypted: i=1; AJvYcCULW1Q2O243CBebEwbmehTj5dfkNmUvzfeYST0ZxjSbpm5rBqvZWWMwgm/kQh+fcbE7XgXlPguMpZZEuRFeyAvvWHhBzbAq6d46NLFdCA== X-Gm-Message-State: AOJu0YyNGJpEeXGygryqUURRc9gqZ8aKfBeUAMBcKVc8zw58EOc6oBKw 54YxNX+AYhxVmNkHPrd9DoDGaAZpXXTabF0YgQ4qphuVSImeFcV/ X-Google-Smtp-Source: AGHT+IG2EnUxjMz0a/WUt7Yj1hLPi5khQWrO2IMM+XfUlR+14mHZyrTHTnCdcYQxIaN+sjSzMymj9g== X-Received: by 2002:a17:90a:9913:b0:29a:11b6:a333 with SMTP id b19-20020a17090a991300b0029a11b6a333mr4192571pjp.15.1708940333437; Mon, 26 Feb 2024 01:38:53 -0800 (PST) Received: from wheely.local0.net (220-235-194-103.tpgi.com.au. [220.235.194.103]) by smtp.gmail.com with ESMTPSA id pa3-20020a17090b264300b0029929ec25fesm6036782pjb.27.2024.02.26.01.38.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 01:38:53 -0800 (PST) From: Nicholas Piggin To: Thomas Huth Subject: [kvm-unit-tests PATCH 1/7] arch-run: Keep infifo open Date: Mon, 26 Feb 2024 19:38:26 +1000 Message-ID: <20240226093832.1468383-2-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240226093832.1468383-1-npiggin@gmail.com> References: <20240226093832.1468383-1-npiggin@gmail.com> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , linux-s390@vger.kernel.org, Nico Boehr , Janosch Frank , kvm@vger.kernel.org, David Hildenbrand , linuxppc-dev@lists.ozlabs.org, Shaoqin Huang , Nicholas Piggin , Andrew Jones , Eric Auger , Marc Hartmayer , Paolo Bonzini , Claudio Imbrenda , Alexandru Elisei Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" The infifo fifo that is used to send characters to QEMU console is only able to receive one character before the cat process exits. Supporting interactions between test and harness involving multiple characters requires the fifo to remain open. This also allows us to let the cat out of the bag, simplifying the input pipeline. Signed-off-by: Nicholas Piggin Reviewed-by: Thomas Huth --- scripts/arch-run.bash | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash index 6daef3218..e5b36a07b 100644 --- a/scripts/arch-run.bash +++ b/scripts/arch-run.bash @@ -158,6 +158,11 @@ run_migration () mkfifo ${src_outfifo} mkfifo ${dst_outfifo} + # Holding both ends of the input fifo open prevents opens from + # blocking and readers getting EOF when a writer closes it. + mkfifo ${dst_infifo} + exec {dst_infifo_fd}<>${dst_infifo} + eval "$migcmdline" \ -chardev socket,id=mon,path=${src_qmp},server=on,wait=off \ -mon chardev=mon,mode=control > ${src_outfifo} & @@ -191,14 +196,10 @@ run_migration () do_migration () { - # We have to use cat to open the named FIFO, because named FIFO's, - # unlike pipes, will block on open() until the other end is also - # opened, and that totally breaks QEMU... - mkfifo ${dst_infifo} eval "$migcmdline" \ -chardev socket,id=mon,path=${dst_qmp},server=on,wait=off \ -mon chardev=mon,mode=control -incoming unix:${dst_incoming} \ - < <(cat ${dst_infifo}) > ${dst_outfifo} & + < ${dst_infifo} > ${dst_outfifo} & incoming_pid=$! cat ${dst_outfifo} | tee ${dst_out} | filter_quiet_msgs & @@ -245,7 +246,6 @@ do_migration () # keypress to dst so getchar completes and test continues echo > ${dst_infifo} - rm ${dst_infifo} # Ensure the incoming socket is removed, ready for next destination if [ -S ${dst_incoming} ] ; then From patchwork Mon Feb 26 09:38:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1904219 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=EmlEox+S; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=patchwork.ozlabs.org) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TjwbG1kxLz23cb for ; Mon, 26 Feb 2024 20:40:42 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=EmlEox+S; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4TjwbF61tqz3d2d for ; Mon, 26 Feb 2024 20:40:41 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.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=EmlEox+S; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::1031; helo=mail-pj1-x1031.google.com; envelope-from=npiggin@gmail.com; receiver=lists.ozlabs.org) Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4TjwYL70sjz3cRN for ; Mon, 26 Feb 2024 20:39:02 +1100 (AEDT) Received: by mail-pj1-x1031.google.com with SMTP id 98e67ed59e1d1-299354e5f01so1592954a91.1 for ; Mon, 26 Feb 2024 01:39:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708940340; x=1709545140; darn=lists.ozlabs.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=ONMw/aUYjeV89BATWOApXz401ptx8GI2JoexNBRfWig=; b=EmlEox+SGzml9fzEcV0m8y9LAlJDeS50Bd4z7YljaRGy+RbsfI+UtgSGcSxOnGTeNd C/BLrcOORBFVjHBgJTmgbRNij0mI7SoGDuqkrlaW6ruw0V3/kpzipnq7YR91zxBWO5nf vwZjZeHaMwBBw4WOTQ0k2HTEnZlvNCf9P9uJBGaB5Gu0aOhomDzeXIXrlseroueCCPn/ nVreb+Ceg2USXECgCFwj79/FKh/WvzvOjWfYMxaIvmQ2gSyGTcI7SnbDSroPEBTtfKQ9 qKWpRN3enHZnxo0ooyCVCaZzLnDrr2zW5nucPJuNCVak/GjUhG8e1MNgmbNkVsbh4KHx /ikg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708940340; x=1709545140; 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=ONMw/aUYjeV89BATWOApXz401ptx8GI2JoexNBRfWig=; b=Zj7Laum35o5uWGr5Z1FiqTeH8nNq2vOl8jqKp7UR9+wyUgb4NPQ0d89k9gL6XSe7iE FL9QzKS4SsTuVW22CkV3KZMOPpPJtsSA/o6eB9ov0IaHtf65YTToyqDXfhTkQeVPAoSk oZmk1lxMnw3DMqOFf0H4BVw2kQLJPU10/p0NCrPmR4zlkBHG25qZw03A3LNKkZB6Lh+X Awi1JLfnuITsVcHHKn4buXZzXD3e0uQyR7ub9ExrrFZ2YuTwdUNtJAjmIGSOqZHFq7m+ bTWj1RE7v3QHms46rRyUGYmKyXmFTpgKJBmcpmx7ClHEupy6F37kyShtaJSWKB0Ol+g3 HR3g== X-Forwarded-Encrypted: i=1; AJvYcCV8r3M7GcEUqOwk6q4D/3kdQk0nx7W6KJD29ioO1+LeF6Z1M64oBwnCQKi/szKINvs6L9exqEy02hQsENyyUt05nwosaZONttdJ66F4sQ== X-Gm-Message-State: AOJu0YziQnFJ/2vQ2JRKnBJrWj066VGbVj0wy/+XsU94OSWOzXFr6GHj StyEs9Wlwjyy0/5xFsPfWuIBCiPDi/CMEWn5sHWcV1B+gfaynM1y X-Google-Smtp-Source: AGHT+IG8Lyq/lSbfkngouOGrJUMUuWUk/DM4NGMBnzl8BD3XkX5WjjmPgixo8kXQDh0Qy0uQtYwdYg== X-Received: by 2002:a17:90b:f0a:b0:299:d975:89ea with SMTP id br10-20020a17090b0f0a00b00299d97589eamr8526892pjb.21.1708940339907; Mon, 26 Feb 2024 01:38:59 -0800 (PST) Received: from wheely.local0.net (220-235-194-103.tpgi.com.au. [220.235.194.103]) by smtp.gmail.com with ESMTPSA id pa3-20020a17090b264300b0029929ec25fesm6036782pjb.27.2024.02.26.01.38.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 01:38:59 -0800 (PST) From: Nicholas Piggin To: Thomas Huth Subject: [kvm-unit-tests PATCH 2/7] migration: Add a migrate_skip command Date: Mon, 26 Feb 2024 19:38:27 +1000 Message-ID: <20240226093832.1468383-3-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240226093832.1468383-1-npiggin@gmail.com> References: <20240226093832.1468383-1-npiggin@gmail.com> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , linux-s390@vger.kernel.org, Nico Boehr , Janosch Frank , kvm@vger.kernel.org, David Hildenbrand , linuxppc-dev@lists.ozlabs.org, Shaoqin Huang , Nicholas Piggin , Andrew Jones , Eric Auger , Marc Hartmayer , Paolo Bonzini , Claudio Imbrenda , Alexandru Elisei Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Tests that are run with MIGRATION=yes but skip due to some requirement not being met will show as a failure due to the harness requirement to see one successful migration. The workaround for this is to migrate in test's skip path. Add a new command that just tells the harness to not expect a migration. Signed-off-by: Nicholas Piggin Reviewed-by: Thomas Huth --- common/selftest-migration.c | 14 ++++++++----- lib/migrate.c | 19 ++++++++++++++++- lib/migrate.h | 2 ++ powerpc/unittests.cfg | 6 ++++++ s390x/unittests.cfg | 5 +++++ scripts/arch-run.bash | 41 +++++++++++++++++++++++++++++-------- 6 files changed, 73 insertions(+), 14 deletions(-) diff --git a/common/selftest-migration.c b/common/selftest-migration.c index 54b5d6b2d..0afd8581c 100644 --- a/common/selftest-migration.c +++ b/common/selftest-migration.c @@ -14,14 +14,18 @@ int main(int argc, char **argv) { - int i = 0; - report_prefix_push("migration"); - for (i = 0; i < NR_MIGRATIONS; i++) - migrate_quiet(); + if (argc > 1 && !strcmp(argv[1], "skip")) { + migrate_skip(); + report(true, "migration skipping"); + } else { + int i; - report(true, "simple harness stress test"); + for (i = 0; i < NR_MIGRATIONS; i++) + migrate_quiet(); + report(true, "simple harness stress"); + } report_prefix_pop(); diff --git a/lib/migrate.c b/lib/migrate.c index 92d1d957d..1d22196b7 100644 --- a/lib/migrate.c +++ b/lib/migrate.c @@ -39,7 +39,24 @@ void migrate_once(void) if (migrated) return; - migrated = true; + migrate(); } + +/* + * When the test has been started in migration mode, but the test case is + * skipped and no migration point is reached, this can be used to tell the + * harness not to mark it as a failure to migrate. + */ +void migrate_skip(void) +{ + static bool did_migrate_skip; + + if (did_migrate_skip) + return; + did_migrate_skip = true; + + puts("Skipped VM migration (quiet)\n"); + (void)getchar(); +} diff --git a/lib/migrate.h b/lib/migrate.h index 95b9102b0..db6e0c501 100644 --- a/lib/migrate.h +++ b/lib/migrate.h @@ -9,3 +9,5 @@ void migrate(void); void migrate_quiet(void); void migrate_once(void); + +void migrate_skip(void); diff --git a/powerpc/unittests.cfg b/powerpc/unittests.cfg index 7ce57de02..89abf2095 100644 --- a/powerpc/unittests.cfg +++ b/powerpc/unittests.cfg @@ -40,6 +40,12 @@ groups = selftest file = selftest-migration.elf groups = selftest migration +[selftest-migration-skip] +file = selftest-migration.elf +machine = pseries +groups = selftest migration +extra_params = -append "skip" + [spapr_hcall] file = spapr_hcall.elf diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg index a7ad522ca..f613602d3 100644 --- a/s390x/unittests.cfg +++ b/s390x/unittests.cfg @@ -28,6 +28,11 @@ extra_params = -append 'test 123' file = selftest-migration.elf groups = selftest migration +[selftest-migration-skip] +file = selftest-migration.elf +groups = selftest migration +extra_params = -append "skip" + [intercept] file = intercept.elf diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash index e5b36a07b..d0f6f098f 100644 --- a/scripts/arch-run.bash +++ b/scripts/arch-run.bash @@ -124,12 +124,17 @@ qmp_events () filter_quiet_msgs () { - grep -v "Now migrate the VM (quiet)" + grep -v "Now migrate the VM (quiet)" | + grep -v "Skipped VM migration (quiet)" } seen_migrate_msg () { - grep -q -e "Now migrate the VM" < $1 + if [ $skip_migration -eq 1 ]; then + grep -q -e "Now migrate the VM" < $1 + else + grep -q -e "Now migrate the VM" -e "Skipped VM migration" < $1 + fi } run_migration () @@ -142,7 +147,7 @@ run_migration () migcmdline=$@ trap 'trap - TERM ; kill 0 ; exit 2' INT TERM - trap 'rm -f ${src_out} ${dst_out} ${src_outfifo} ${dst_outfifo} ${dst_incoming} ${src_qmp} ${dst_qmp} ${dst_infifo}' RETURN EXIT + trap 'rm -f ${src_out} ${dst_out} ${src_outfifo} ${dst_outfifo} ${dst_incoming} ${src_qmp} ${dst_qmp} ${src_infifo} ${dst_infifo}' RETURN EXIT dst_incoming=$(mktemp -u -t mig-helper-socket-incoming.XXXXXXXXXX) src_out=$(mktemp -t mig-helper-stdout1.XXXXXXXXXX) @@ -151,21 +156,26 @@ run_migration () dst_outfifo=$(mktemp -u -t mig-helper-fifo-stdout2.XXXXXXXXXX) src_qmp=$(mktemp -u -t mig-helper-qmp1.XXXXXXXXXX) dst_qmp=$(mktemp -u -t mig-helper-qmp2.XXXXXXXXXX) - dst_infifo=$(mktemp -u -t mig-helper-fifo-stdin.XXXXXXXXXX) + src_infifo=$(mktemp -u -t mig-helper-fifo-stdin1.XXXXXXXXXX) + dst_infifo=$(mktemp -u -t mig-helper-fifo-stdin2.XXXXXXXXXX) src_qmpout=/dev/null dst_qmpout=/dev/null + skip_migration=0 mkfifo ${src_outfifo} mkfifo ${dst_outfifo} # Holding both ends of the input fifo open prevents opens from # blocking and readers getting EOF when a writer closes it. + mkfifo ${src_infifo} mkfifo ${dst_infifo} + exec {src_infifo_fd}<>${src_infifo} exec {dst_infifo_fd}<>${dst_infifo} eval "$migcmdline" \ -chardev socket,id=mon,path=${src_qmp},server=on,wait=off \ - -mon chardev=mon,mode=control > ${src_outfifo} & + -mon chardev=mon,mode=control \ + < ${src_infifo} > ${src_outfifo} & live_pid=$! cat ${src_outfifo} | tee ${src_out} | filter_quiet_msgs & @@ -179,8 +189,11 @@ run_migration () # Wait for test exit or further migration messages. if ! seen_migrate_msg ${src_out} ; then sleep 0.1 - else + elif grep -q "Now migrate the VM" < ${src_out} ; then do_migration || return $? + elif [ $skip_migration -eq 0 ] && grep -q "Skipped VM migration" < ${src_out} ; then + echo > ${src_infifo} # Resume src and carry on. + break; fi done @@ -207,10 +220,10 @@ do_migration () # "Now migrate VM" or similar console message. while ! seen_migrate_msg ${src_out} ; do if ! ps -p ${live_pid} > /dev/null ; then - echo "ERROR: Test exit before migration point." >&2 echo > ${dst_infifo} - qmp ${src_qmp} '"quit"'> ${src_qmpout} 2>/dev/null qmp ${dst_qmp} '"quit"'> ${dst_qmpout} 2>/dev/null + echo "ERROR: Test exit before migration point." >&2 + qmp ${src_qmp} '"quit"'> ${src_qmpout} 2>/dev/null return 3 fi sleep 0.1 @@ -220,6 +233,15 @@ do_migration () while ! [ -S ${dst_incoming} ] ; do sleep 0.1 ; done while ! [ -S ${dst_qmp} ] ; do sleep 0.1 ; done + if [ $skip_migration -eq 0 ] && grep -q "Skipped VM migration" < ${src_out} ; then + # May not get any migrations, exit to main loop for now... + echo > ${dst_infifo} + qmp ${dst_qmp} '"quit"'> ${dst_qmpout} 2>/dev/null + echo > ${src_infifo} # Resume src and carry on. + skip_migration=1 + return 0 + fi + qmp ${src_qmp} '"migrate", "arguments": { "uri": "unix:'${dst_incoming}'" }' > ${src_qmpout} # Wait for the migration to complete @@ -263,6 +285,9 @@ do_migration () tmp=${src_out} src_out=${dst_out} dst_out=${tmp} + tmp=${src_infifo} + src_infifo=${dst_infifo} + dst_infifo=${tmp} tmp=${src_outfifo} src_outfifo=${dst_outfifo} dst_outfifo=${tmp} From patchwork Mon Feb 26 09:38:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1904220 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=IhYy3JI/; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=patchwork.ozlabs.org) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Tjwc35rdLz23cb for ; Mon, 26 Feb 2024 20:41:23 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=IhYy3JI/; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Tjwc34nbHz3cNt for ; Mon, 26 Feb 2024 20:41:23 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.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=IhYy3JI/; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::1033; helo=mail-pj1-x1033.google.com; envelope-from=npiggin@gmail.com; receiver=lists.ozlabs.org) Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4TjwYT2FT8z3cS3 for ; Mon, 26 Feb 2024 20:39:09 +1100 (AEDT) Received: by mail-pj1-x1033.google.com with SMTP id 98e67ed59e1d1-299b55f2344so1856286a91.2 for ; Mon, 26 Feb 2024 01:39:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708940347; x=1709545147; darn=lists.ozlabs.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=uC/70SEJzTHOJH25vt3H9h8+D3sESjLNUn4k7CqK+9E=; b=IhYy3JI/QhJcq+aFlaPDy/jIRL1n73BrGzV83v1hBp7wytPBj6lCsb4c8sd8khyqff T25HT8fIilgpwSfQyIYRGGM77DHjPgPbc130jHC24/FkU2gMbbdWPfwWw7J3qWGZmWD4 FN6j4aM+I7FQWzyeYufgAGlIWNQpprKJZ3ZmHUkHu5P2IDUnDICUm+zOW9IX8NCqoZ+p bYP8fPVGfKBsO0ttGzo524ffCesqPcZhZFy5p2munbqK2H4FtdLTGw9dLiUggzna9gQf vi+pHmxPv2DG3FvSpjToe9GQV9GDG09aQ9djdzgBuC0B1vfCWK9mXpEk6JGZR8bi1yB8 x3kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708940347; x=1709545147; 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=uC/70SEJzTHOJH25vt3H9h8+D3sESjLNUn4k7CqK+9E=; b=BzyCDq8aQ+3CgWRRKQWAfxrf1f52In3mWKwf6sGC/ATnTB2MzvYhLdhsdKJg0ihVDD ysDKZRIn+vzWR1mmRSgLu1T0rIqm5xcPh0ZOrZuDWbFu0S59V0SEDEDryqx3krzuEUYb s7+C94t/O873GcdAHPQxgDzoyn/5MhGdnvUog3uGu8UkOE2OQhjLEDeh2/Op/uYD8j+I FRaoQWymXvMBDX4PAoBWlNShfSgJ+KHZS01hzC4RMJBuAG33YqOJ4DYihVmNDGvMknxz 6+Z4YVaCQkKuKcOaAc+wwQEKW2qjKr+JnZLmgSr/FW3RJZuw7nTe3LhpSvaRPAe/3eKb iv9g== X-Forwarded-Encrypted: i=1; AJvYcCWXUD5BcTNoUQ4UnMfQU81ioPvQazNE3OgBsD70hzKvK/9yrL+/xHV90SE7AuLes8fCdmSoOGYz5BfmFpbc0Qiky2Gg8oDz3/yK4BCTcw== X-Gm-Message-State: AOJu0Yy4ci0vA2iGf//a59qezgUSCoTBdYXGseX0GzCA23ofZ1QUKvJu ARf45B+Wxs5zRZvFdt8y7YSFT/bMTMaRV/KkWxCVgnwfkjTzFRRV X-Google-Smtp-Source: AGHT+IGVHjLqOx0JzfzvBlojtHENa9XElZf47hWf9jVMVAK+crqgExNKzAI0S0P3U/MhCCZoNTPxcg== X-Received: by 2002:a17:90a:9bc5:b0:29a:be1a:ea40 with SMTP id b5-20020a17090a9bc500b0029abe1aea40mr1608384pjw.9.1708940346798; Mon, 26 Feb 2024 01:39:06 -0800 (PST) Received: from wheely.local0.net (220-235-194-103.tpgi.com.au. [220.235.194.103]) by smtp.gmail.com with ESMTPSA id pa3-20020a17090b264300b0029929ec25fesm6036782pjb.27.2024.02.26.01.39.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 01:39:06 -0800 (PST) From: Nicholas Piggin To: Thomas Huth Subject: [kvm-unit-tests PATCH 3/7] (arm|s390): Use migrate_skip in test cases Date: Mon, 26 Feb 2024 19:38:28 +1000 Message-ID: <20240226093832.1468383-4-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240226093832.1468383-1-npiggin@gmail.com> References: <20240226093832.1468383-1-npiggin@gmail.com> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , linux-s390@vger.kernel.org, Nico Boehr , Janosch Frank , kvm@vger.kernel.org, David Hildenbrand , linuxppc-dev@lists.ozlabs.org, Shaoqin Huang , Nicholas Piggin , Andrew Jones , Eric Auger , Marc Hartmayer , Paolo Bonzini , Claudio Imbrenda , Alexandru Elisei Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Have tests use the new migrate_skip command in skip paths, rather than calling migrate_once to prevent harness reporting an error. s390x/migration.c adds a new command that looks like it was missing previously. Signed-off-by: Nicholas Piggin Reviewed-by: Thomas Huth --- arm/gic.c | 21 ++++++++++++--------- s390x/migration-cmm.c | 8 ++++---- s390x/migration-skey.c | 4 +++- s390x/migration.c | 1 + 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/arm/gic.c b/arm/gic.c index c950b0d15..bbf828f17 100644 --- a/arm/gic.c +++ b/arm/gic.c @@ -782,13 +782,15 @@ static void test_its_migration(void) struct its_device *dev2, *dev7; cpumask_t mask; - if (its_setup1()) + if (its_setup1()) { + migrate_skip(); return; + } dev2 = its_get_device(2); dev7 = its_get_device(7); - migrate_once(); + migrate(); stats_reset(); cpumask_clear(&mask); @@ -819,8 +821,10 @@ static void test_migrate_unmapped_collection(void) int pe0 = 0; u8 config; - if (its_setup1()) + if (its_setup1()) { + migrate_skip(); return; + } if (!errata(ERRATA_UNMAPPED_COLLECTIONS)) { report_skip("Skipping test, as this test hangs without the fix. " @@ -836,7 +840,7 @@ static void test_migrate_unmapped_collection(void) its_send_mapti(dev2, 8192, 0, col); gicv3_lpi_set_config(8192, LPI_PROP_DEFAULT); - migrate_once(); + migrate(); /* on the destination, map the collection */ its_send_mapc(col, true); @@ -875,8 +879,10 @@ static void test_its_pending_migration(void) void *ptr; int i; - if (its_prerequisites(4)) + if (its_prerequisites(4)) { + migrate_skip(); return; + } dev = its_create_device(2 /* dev id */, 8 /* nb_ites */); its_send_mapd(dev, true); @@ -923,7 +929,7 @@ static void test_its_pending_migration(void) gicv3_lpi_rdist_enable(pe0); gicv3_lpi_rdist_enable(pe1); - migrate_once(); + migrate(); /* let's wait for the 256 LPIs to be handled */ mdelay(1000); @@ -970,17 +976,14 @@ int main(int argc, char **argv) } else if (!strcmp(argv[1], "its-migration")) { report_prefix_push(argv[1]); test_its_migration(); - migrate_once(); report_prefix_pop(); } else if (!strcmp(argv[1], "its-pending-migration")) { report_prefix_push(argv[1]); test_its_pending_migration(); - migrate_once(); report_prefix_pop(); } else if (!strcmp(argv[1], "its-migrate-unmapped-collection")) { report_prefix_push(argv[1]); test_migrate_unmapped_collection(); - migrate_once(); report_prefix_pop(); } else if (strcmp(argv[1], "its-introspection") == 0) { report_prefix_push(argv[1]); diff --git a/s390x/migration-cmm.c b/s390x/migration-cmm.c index 43673f18e..b4043a80e 100644 --- a/s390x/migration-cmm.c +++ b/s390x/migration-cmm.c @@ -55,12 +55,12 @@ int main(void) { report_prefix_push("migration-cmm"); - if (!check_essa_available()) + if (!check_essa_available()) { report_skip("ESSA is not available"); - else + migrate_skip(); + } else { test_migration(); - - migrate_once(); + } report_prefix_pop(); return report_summary(); diff --git a/s390x/migration-skey.c b/s390x/migration-skey.c index 8d6d8ecfe..1a196ae1e 100644 --- a/s390x/migration-skey.c +++ b/s390x/migration-skey.c @@ -169,6 +169,7 @@ static void test_skey_migration_parallel(void) if (smp_query_num_cpus() == 1) { report_skip("need at least 2 cpus for this test"); + migrate_skip(); goto error; } @@ -233,6 +234,7 @@ int main(int argc, char **argv) if (test_facility(169)) { report_skip("storage key removal facility is active"); + migrate_skip(); goto error; } @@ -247,11 +249,11 @@ int main(int argc, char **argv) break; default: print_usage(); + migrate_skip(); break; } error: - migrate_once(); report_prefix_pop(); return report_summary(); } diff --git a/s390x/migration.c b/s390x/migration.c index 269e272de..115afb731 100644 --- a/s390x/migration.c +++ b/s390x/migration.c @@ -164,6 +164,7 @@ int main(void) if (smp_query_num_cpus() == 1) { report_skip("need at least 2 cpus for this test"); + migrate_skip(); goto done; } From patchwork Mon Feb 26 09:38:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1904222 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=hKHrkWd1; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=112.213.38.117; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=patchwork.ozlabs.org) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Tjwcs5Flyz23cb for ; Mon, 26 Feb 2024 20:42:05 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=hKHrkWd1; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Tjwcs2rCrz3vZV for ; Mon, 26 Feb 2024 20:42:05 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.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=hKHrkWd1; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::330; helo=mail-ot1-x330.google.com; envelope-from=npiggin@gmail.com; receiver=lists.ozlabs.org) Received: from mail-ot1-x330.google.com (mail-ot1-x330.google.com [IPv6:2607:f8b0:4864:20::330]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4TjwYc1nTzz3d4D for ; Mon, 26 Feb 2024 20:39:16 +1100 (AEDT) Received: by mail-ot1-x330.google.com with SMTP id 46e09a7af769-6e445b4f80bso1610600a34.0 for ; Mon, 26 Feb 2024 01:39:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708940353; x=1709545153; darn=lists.ozlabs.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=yFmFHP+QtAW/gWzWjKPE8XCHxHNjIB3oHgOxryrYW4g=; b=hKHrkWd1rkK6sWcqxaCMZu6Wj/iJHDWoBDvpND6eum75lkfiWcxT/xYB8y4EfQOmgh zW0y4VORk6T1gWIxdgeijIcWFu4VEayB2eek/vf2Rvn2oFqdEzK/3P+b83VKTC0qREVz aW3DP5HPaAiKprXkgWcYSR6tOMKY/RR9HwFlbHFITrdqE7WZ1x6whO5+36jqIFD49F6+ N/BiL9gL2OxJCGzZOVh2C0UBk2D4NaOWm44ylKdzxuqfi7CM9dlTV4sssZ85En9SIb1d TPv+7frhlKf6gubuiipdOaxKza7Yk1II8Hp+0Nn1dFCHFR7dZcwwbjDelMuvuoi1izp9 d7JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708940353; x=1709545153; 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=yFmFHP+QtAW/gWzWjKPE8XCHxHNjIB3oHgOxryrYW4g=; b=B1I5CqHMeTXiHboHS9S7ZdPmwfH/pa4uh2fLIhpB/5fOlw7lEwRIcxMbKeNwD7JWSX QJJDCYD8tRrWOweO2C1ecIIBaFAj+gus4OIwyPKr0sooYa65YEufHxiRhR0V4QAX1Sk5 On9IJZg5u6JMcVDUuUxlNY9phlTE85qw3yygvGo2UU9e26RYlZZ/NqSkKPuTKtyXCVJP zuLhB3Hck+BQaoQc4/Si2gCM5GDspGap30ngFPOigjX2RLpaSubEe8GGSKelwzFP4QVX XMA7Cy1usBTJytxx49UIdm+AxJ+GVU4Z+Mak6LyzBIjvPi+ACZyDqB+TCfoa+7OJQm74 0GvQ== X-Forwarded-Encrypted: i=1; AJvYcCWoOD+b6/XanoApYEAtyHFA4jHV6vwMwVLSPw0WdVaAbGoyck8jWo0WwPj0kJQ0uqNIk9LQOYN2adcg53v1xpomACDmnXcxN+sjSrbeiQ== X-Gm-Message-State: AOJu0Yw6npuvgQGFhoBeT9q56viPByKQSyHMJTiLORHtutdnApl2x2+5 Hq9py5Dp/9Pp7h61wsswscX4sVuUdA5c5KCdGbuBlAShR8h13gLs X-Google-Smtp-Source: AGHT+IEK7riyiXe4XBkSjXiTYaRk18fYrorXjR0yQSzy+Aw89puQe4obWJbTPsgNr5FUiDSgZ2fE9Q== X-Received: by 2002:a05:6358:3386:b0:17b:b573:a437 with SMTP id i6-20020a056358338600b0017bb573a437mr73248rwd.8.1708940353115; Mon, 26 Feb 2024 01:39:13 -0800 (PST) Received: from wheely.local0.net (220-235-194-103.tpgi.com.au. [220.235.194.103]) by smtp.gmail.com with ESMTPSA id pa3-20020a17090b264300b0029929ec25fesm6036782pjb.27.2024.02.26.01.39.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 01:39:12 -0800 (PST) From: Nicholas Piggin To: Thomas Huth Subject: [kvm-unit-tests PATCH 4/7] powerpc: add asm/time.h header with delay and get_clock_us/ms Date: Mon, 26 Feb 2024 19:38:29 +1000 Message-ID: <20240226093832.1468383-5-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240226093832.1468383-1-npiggin@gmail.com> References: <20240226093832.1468383-1-npiggin@gmail.com> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , linux-s390@vger.kernel.org, Nico Boehr , Janosch Frank , kvm@vger.kernel.org, David Hildenbrand , linuxppc-dev@lists.ozlabs.org, Shaoqin Huang , Nicholas Piggin , Andrew Jones , Eric Auger , Marc Hartmayer , Paolo Bonzini , Claudio Imbrenda , Alexandru Elisei Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" This matches s390x clock and delay APIs, so common test code can start using time facilities. Signed-off-by: Nicholas Piggin Reviewed-by: Thomas Huth --- lib/powerpc/asm/processor.h | 21 --------------------- lib/powerpc/asm/time.h | 30 ++++++++++++++++++++++++++++++ lib/powerpc/processor.c | 11 +++++++++++ lib/powerpc/smp.c | 1 + lib/ppc64/asm/time.h | 1 + powerpc/spapr_vpa.c | 1 + powerpc/sprs.c | 1 + powerpc/tm.c | 1 + 8 files changed, 46 insertions(+), 21 deletions(-) create mode 100644 lib/powerpc/asm/time.h create mode 100644 lib/ppc64/asm/time.h diff --git a/lib/powerpc/asm/processor.h b/lib/powerpc/asm/processor.h index 4ad6612b3..fe1052939 100644 --- a/lib/powerpc/asm/processor.h +++ b/lib/powerpc/asm/processor.h @@ -43,25 +43,4 @@ static inline void mtmsr(uint64_t msr) asm volatile ("mtmsrd %[msr]" :: [msr] "r" (msr) : "memory"); } -static inline uint64_t get_tb(void) -{ - return mfspr(SPR_TB); -} - -extern void delay(uint64_t cycles); -extern void udelay(uint64_t us); -extern void sleep_tb(uint64_t cycles); -extern void usleep(uint64_t us); - -static inline void mdelay(uint64_t ms) -{ - while (ms--) - udelay(1000); -} - -static inline void msleep(uint64_t ms) -{ - usleep(ms * 1000); -} - #endif /* _ASMPOWERPC_PROCESSOR_H_ */ diff --git a/lib/powerpc/asm/time.h b/lib/powerpc/asm/time.h new file mode 100644 index 000000000..72fcb1bd0 --- /dev/null +++ b/lib/powerpc/asm/time.h @@ -0,0 +1,30 @@ +#ifndef _ASMPOWERPC_TIME_H_ +#define _ASMPOWERPC_TIME_H_ + +#include +#include + +static inline uint64_t get_tb(void) +{ + return mfspr(SPR_TB); +} + +extern uint64_t get_clock_us(void); +extern uint64_t get_clock_ms(void); +extern void delay(uint64_t cycles); +extern void udelay(uint64_t us); +extern void sleep_tb(uint64_t cycles); +extern void usleep(uint64_t us); + +static inline void mdelay(uint64_t ms) +{ + while (ms--) + udelay(1000); +} + +static inline void msleep(uint64_t ms) +{ + usleep(ms * 1000); +} + +#endif /* _ASMPOWERPC_TIME_H_ */ diff --git a/lib/powerpc/processor.c b/lib/powerpc/processor.c index b224fc8eb..ad0d95666 100644 --- a/lib/powerpc/processor.c +++ b/lib/powerpc/processor.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -54,6 +55,16 @@ void do_handle_exception(struct pt_regs *regs) abort(); } +uint64_t get_clock_us(void) +{ + return get_tb() * 1000000 / tb_hz; +} + +uint64_t get_clock_ms(void) +{ + return get_tb() * 1000 / tb_hz; +} + void delay(uint64_t cycles) { uint64_t start = get_tb(); diff --git a/lib/powerpc/smp.c b/lib/powerpc/smp.c index afe436179..3e211eba8 100644 --- a/lib/powerpc/smp.c +++ b/lib/powerpc/smp.c @@ -7,6 +7,7 @@ */ #include +#include #include #include #include diff --git a/lib/ppc64/asm/time.h b/lib/ppc64/asm/time.h new file mode 100644 index 000000000..326d2887a --- /dev/null +++ b/lib/ppc64/asm/time.h @@ -0,0 +1 @@ +#include "../../powerpc/asm/time.h" diff --git a/powerpc/spapr_vpa.c b/powerpc/spapr_vpa.c index 6a3fe5e3f..c2075e157 100644 --- a/powerpc/spapr_vpa.c +++ b/powerpc/spapr_vpa.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include diff --git a/powerpc/sprs.c b/powerpc/sprs.c index 57e487ceb..285976488 100644 --- a/powerpc/sprs.c +++ b/powerpc/sprs.c @@ -26,6 +26,7 @@ #include #include #include +#include #include uint64_t before[1024], after[1024]; diff --git a/powerpc/tm.c b/powerpc/tm.c index 7fa916366..6b1ceeb6e 100644 --- a/powerpc/tm.c +++ b/powerpc/tm.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include From patchwork Mon Feb 26 09:38:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1904223 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=V+CkjGK/; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=patchwork.ozlabs.org) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Tjwdp3v76z23cb for ; Mon, 26 Feb 2024 20:42:54 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=V+CkjGK/; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Tjwdp1VcNz3vj6 for ; Mon, 26 Feb 2024 20:42:54 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.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=V+CkjGK/; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::533; helo=mail-pg1-x533.google.com; envelope-from=npiggin@gmail.com; receiver=lists.ozlabs.org) Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4TjwYj6ns2z3cJ9 for ; Mon, 26 Feb 2024 20:39:21 +1100 (AEDT) Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-5ce07cf1e5dso2136838a12.2 for ; Mon, 26 Feb 2024 01:39:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708940359; x=1709545159; darn=lists.ozlabs.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=WfqFlNeWfcRgXj7UGW4upVJVIE+P49J1N2eRNhWx+y8=; b=V+CkjGK/kWdweusosVB2jTnl2kUQPo882UWCtkKjUN/lnu+gVbSOWRp3IdefiX8Cc3 91dCXUAYM7Dj/bHF+lYVC+TH1F60m/RXFnSRXVa34uZCoAFeEynVpRuVRFybyDfPfIW3 QxhedCP0JllxZk7OUHaf+SW3qb35sknUrn1QjjVmQXEPm71VuCwv32L7fWw0/0T5+DiX LBwvIkHZDrxngzMZGl3vdt7nZZVpkJsNNDgK8gbgGveTEo6BqNT61w/ilpj0EOqXljLK w/Mg75ft6vN0ZECjDjtNeGHXocV8ZRu5ceougvKAB34jlzVkwSm5ZnoSrDs2OIahPsOJ I9Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708940359; x=1709545159; 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=WfqFlNeWfcRgXj7UGW4upVJVIE+P49J1N2eRNhWx+y8=; b=shHf8fD3e5X+K0MQ+ny7BGeeZJE2RVbKitFvgic+QVtw1bqeS6Kj4CNOtD9te/fDyN XGUg1m2lZFwKsLalDUsHGr7Aj+lRBOj1R9RzgsG6ptsxai/TaamKEAIxY7yXLPY1nCUz wrI5kDSav00No8Edmk3xeF7sKLkJhpbte5CGwfn2bq27TCTwarlYQdhNP8t4JSxk1cjy sz+Hf5oL+I0ZeME/tb1kifCF9pGhtTWFHFd+yvujWH9LYaHXfQPr54L0i1D17gapHNTV SEvVKOnd8x4HUbG2ynM0b+hYdJyCdhNWC287UNReS+ybwfhaP1xcJV9gYEPBMwPopj3i xTjA== X-Forwarded-Encrypted: i=1; AJvYcCUtRraSU/ylCtx4o8aGY9xsX5MPvHtDEPIQ6rwB/99bBB61sTZr9uw3yMzphtAgsFmpQxjrIeUFAt9qZw1T0D2QBUtg9b8cYfjUIkVoEg== X-Gm-Message-State: AOJu0YyvtdPD4Vej5kbpEuAt9ScCcWFqKCqFkGO7+1JGK00II5dsU466 mnXkdArJu7dXeTDbrb1FuSGARw4H7Sw4cZMpyJqa8XWFD2WZBpIupaGLTeKz X-Google-Smtp-Source: AGHT+IHbh6SI8T6/s0c3UOyoHhOzc5xA5DNsPoVfksWo0VGv11hLE0/hAfkwS0iY70YPjKgUhGHHIw== X-Received: by 2002:a05:6a20:9694:b0:1a0:e09d:8ed1 with SMTP id hp20-20020a056a20969400b001a0e09d8ed1mr3838940pzc.53.1708940359344; Mon, 26 Feb 2024 01:39:19 -0800 (PST) Received: from wheely.local0.net (220-235-194-103.tpgi.com.au. [220.235.194.103]) by smtp.gmail.com with ESMTPSA id pa3-20020a17090b264300b0029929ec25fesm6036782pjb.27.2024.02.26.01.39.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 01:39:19 -0800 (PST) From: Nicholas Piggin To: Thomas Huth Subject: [kvm-unit-tests PATCH 5/7] arch-run: Add a "continuous" migration option for tests Date: Mon, 26 Feb 2024 19:38:30 +1000 Message-ID: <20240226093832.1468383-6-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240226093832.1468383-1-npiggin@gmail.com> References: <20240226093832.1468383-1-npiggin@gmail.com> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , linux-s390@vger.kernel.org, Nico Boehr , Janosch Frank , kvm@vger.kernel.org, David Hildenbrand , linuxppc-dev@lists.ozlabs.org, Shaoqin Huang , Nicholas Piggin , Andrew Jones , Eric Auger , Marc Hartmayer , Paolo Bonzini , Claudio Imbrenda , Alexandru Elisei Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" The cooperative migration protocol is very good to control precise pre and post conditions for a migration event. However in some cases its intrusiveness to the test program, can mask problems and make analysis more difficult. For example to stress test migration vs concurrent complicated memory access, including TLB refill, ram dirtying, etc., then the tight spin at getchar() and resumption of the workload after migration is unhelpful. This adds a continuous migration mode that directs the harness to perform migrations continually. This is added to the migration selftests, which also sees cooperative migration iterations reduced to avoid increasing test time too much. Signed-off-by: Nicholas Piggin --- common/selftest-migration.c | 16 +++++++++-- lib/migrate.c | 18 ++++++++++++ lib/migrate.h | 3 ++ scripts/arch-run.bash | 55 ++++++++++++++++++++++++++++++++----- 4 files changed, 82 insertions(+), 10 deletions(-) diff --git a/common/selftest-migration.c b/common/selftest-migration.c index 0afd8581c..9a9b61835 100644 --- a/common/selftest-migration.c +++ b/common/selftest-migration.c @@ -9,12 +9,13 @@ */ #include #include +#include -#define NR_MIGRATIONS 30 +#define NR_MIGRATIONS 15 int main(int argc, char **argv) { - report_prefix_push("migration"); + report_prefix_push("migration harness"); if (argc > 1 && !strcmp(argv[1], "skip")) { migrate_skip(); @@ -24,7 +25,16 @@ int main(int argc, char **argv) for (i = 0; i < NR_MIGRATIONS; i++) migrate_quiet(); - report(true, "simple harness stress"); + report(true, "cooperative migration"); + + migrate_begin_continuous(); + mdelay(2000); + migrate_end_continuous(); + mdelay(1000); + migrate_begin_continuous(); + mdelay(2000); + migrate_end_continuous(); + report(true, "continuous migration"); } report_prefix_pop(); diff --git a/lib/migrate.c b/lib/migrate.c index 1d22196b7..770f76d5c 100644 --- a/lib/migrate.c +++ b/lib/migrate.c @@ -60,3 +60,21 @@ void migrate_skip(void) puts("Skipped VM migration (quiet)\n"); (void)getchar(); } + +void migrate_begin_continuous(void) +{ + puts("Begin continuous migration\n"); + (void)getchar(); +} + +void migrate_end_continuous(void) +{ + /* + * Migration can split this output between source and dest QEMU + * output files, print twice and match once to always cope with + * a split. + */ + puts("End continuous migration\n"); + puts("End continuous migration (quiet)\n"); + (void)getchar(); +} diff --git a/lib/migrate.h b/lib/migrate.h index db6e0c501..35b6703a2 100644 --- a/lib/migrate.h +++ b/lib/migrate.h @@ -11,3 +11,6 @@ void migrate_quiet(void); void migrate_once(void); void migrate_skip(void); + +void migrate_begin_continuous(void); +void migrate_end_continuous(void); diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash index d0f6f098f..5c7e72036 100644 --- a/scripts/arch-run.bash +++ b/scripts/arch-run.bash @@ -125,15 +125,17 @@ qmp_events () filter_quiet_msgs () { grep -v "Now migrate the VM (quiet)" | + grep -v "Begin continuous migration (quiet)" | + grep -v "End continuous migration (quiet)" | grep -v "Skipped VM migration (quiet)" } seen_migrate_msg () { if [ $skip_migration -eq 1 ]; then - grep -q -e "Now migrate the VM" < $1 + grep -q -e "Now migrate the VM" -e "Begin continuous migration" < $1 else - grep -q -e "Now migrate the VM" -e "Skipped VM migration" < $1 + grep -q -e "Now migrate the VM" -e "Begin continuous migration" -e "Skipped VM migration" < $1 fi } @@ -161,6 +163,7 @@ run_migration () src_qmpout=/dev/null dst_qmpout=/dev/null skip_migration=0 + continuous_migration=0 mkfifo ${src_outfifo} mkfifo ${dst_outfifo} @@ -186,9 +189,12 @@ run_migration () do_migration || return $? while ps -p ${live_pid} > /dev/null ; do - # Wait for test exit or further migration messages. - if ! seen_migrate_msg ${src_out} ; then + if [[ ${continuous_migration} -eq 1 ]] ; then + do_migration || return $? + elif ! seen_migrate_msg ${src_out} ; then sleep 0.1 + elif grep -q "Begin continuous migration" < ${src_out} ; then + do_migration || return $? elif grep -q "Now migrate the VM" < ${src_out} ; then do_migration || return $? elif [ $skip_migration -eq 0 ] && grep -q "Skipped VM migration" < ${src_out} ; then @@ -218,7 +224,7 @@ do_migration () # The test must prompt the user to migrate, so wait for the # "Now migrate VM" or similar console message. - while ! seen_migrate_msg ${src_out} ; do + while [[ ${continuous_migration} -eq 0 ]] && ! seen_migrate_msg ${src_out} ; do if ! ps -p ${live_pid} > /dev/null ; then echo > ${dst_infifo} qmp ${dst_qmp} '"quit"'> ${dst_qmpout} 2>/dev/null @@ -229,12 +235,32 @@ do_migration () sleep 0.1 done + if grep -q "Begin continuous migration" < ${src_out} ; then + if [[ ${continuous_migration} -eq 1 ]] ; then + echo > ${dst_infifo} + qmp ${dst_qmp} '"quit"'> ${dst_qmpout} 2>/dev/null + echo "ERROR: Continuous migration already begun." >&2 + qmp ${src_qmp} '"quit"'> ${src_qmpout} 2>/dev/null + return 3 + fi + continuous_migration=1 + echo > ${src_infifo} + fi + # Wait until the destination has created the incoming and qmp sockets while ! [ -S ${dst_incoming} ] ; do sleep 0.1 ; done while ! [ -S ${dst_qmp} ] ; do sleep 0.1 ; done if [ $skip_migration -eq 0 ] && grep -q "Skipped VM migration" < ${src_out} ; then # May not get any migrations, exit to main loop for now... + # No migrations today, shut down dst in an orderly manner... + if [[ ${continuous_migration} -eq 1 ]] ; then + echo > ${dst_infifo} + qmp ${dst_qmp} '"quit"'> ${dst_qmpout} 2>/dev/null + echo "ERROR: Can't skip in continuous migration." >&2 + qmp ${src_qmp} '"quit"'> ${src_qmpout} 2>/dev/null + return 3 + fi echo > ${dst_infifo} qmp ${dst_qmp} '"quit"'> ${dst_qmpout} 2>/dev/null echo > ${src_infifo} # Resume src and carry on. @@ -266,8 +292,23 @@ do_migration () qmp ${src_qmp} '"quit"'> ${src_qmpout} 2>/dev/null - # keypress to dst so getchar completes and test continues - echo > ${dst_infifo} + # Should we end continuous migration? + if grep -q "End continuous migration" < ${src_out} ; then + if [[ ${continuous_migration} -eq 0 ]] ; then + echo "ERROR: Can't end continuous migration when not started." >&2 + echo > ${dst_infifo} + qmp ${dst_qmp} '"quit"'> ${dst_qmpout} 2>/dev/null + qmp ${src_qmp} '"quit"'> ${src_qmpout} 2>/dev/null + return 3 + fi + continuous_migration=0 + echo > ${src_infifo} + fi + + if [[ ${continuous_migration} -eq 0 ]]; then + # keypress to dst so getchar completes and test continues + echo > ${dst_infifo} + fi # Ensure the incoming socket is removed, ready for next destination if [ -S ${dst_incoming} ] ; then From patchwork Mon Feb 26 09:38:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1904224 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=GjX1sKpr; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=patchwork.ozlabs.org) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Tjwfb4FpWz23cb for ; Mon, 26 Feb 2024 20:43:35 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=GjX1sKpr; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Tjwfb39sDz3vc8 for ; Mon, 26 Feb 2024 20:43:35 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.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=GjX1sKpr; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::1033; helo=mail-pj1-x1033.google.com; envelope-from=npiggin@gmail.com; receiver=lists.ozlabs.org) Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4TjwYq3QPfz3dH8 for ; Mon, 26 Feb 2024 20:39:27 +1100 (AEDT) Received: by mail-pj1-x1033.google.com with SMTP id 98e67ed59e1d1-2998950e951so1820234a91.2 for ; Mon, 26 Feb 2024 01:39:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708940366; x=1709545166; darn=lists.ozlabs.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=Ir8XVGfbEwUzyyUuS20ld9G5VKQJor6iBkETXZzZgso=; b=GjX1sKprcGpIG8BChj5gNt0IyAkYncp4Q9IwSHqHs3yk4og26eybJ2MfsOhE/S9oqj zVQXWypVvCBnNMNBAemjCDIdJnd9PpJydlwJIN+V1vs197uQ6DOKRi+81uuO9qV3kh4J ocAEEBG/s5PnbugwQ1F3payfC96dph01M3ugytFKjZEeyVNejB5H9SikFtHhQqm7MCPN rWSZ5CJP3rCefYwB/3SP79srDqQqgG/05HjRArqJd27CZSrJBm9WPl2DZZperS+0WqXB 6+eHIO8buLvEXtPG79qCQAaSgPbi0KqyaGZJC5rr3M+MDeCw6CqRhUaRzv5CEph1AjYF tsSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708940366; x=1709545166; 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=Ir8XVGfbEwUzyyUuS20ld9G5VKQJor6iBkETXZzZgso=; b=TNorT2XzBNQDDO9kOgjQ4wiTlD76KPWvOTm1Azg0lW8csRyJgEtFVZ1KIcg+cpiyif LWIjv7kTHyCTIBFMfxpGkK8v9WGUghEH2lAq9GsgHnWprnuYqDPDRBjc3P3byOgUavL5 HRbOo3RtGmcpCgMVGx5TBwOq8Lwo0Fu7pwGIxouSqvUZ/nI6+ap7e5fjNfl2u92nPRew LOiPt0vAzdH5Ori6KqRyitDKxSedZoyZinLkLbeeZszYzvfUQC7xUiVkmuwh4JdnwzXu zjFRb3XMPpj7+vZ0wBPpdIsQulFO5qE630MCMQXAT02rCFCjOPKim2WmXc7jBq4WIYGr FRQw== X-Forwarded-Encrypted: i=1; AJvYcCVviFKU7r1V+OAbbjnLOLvVxCxJi2AriURYwsSap6L2SKQE1S/egP6qctDb7DRZg1im7694AM90IsRdhiigd3i/YH5mYuJMg14B1QXsmg== X-Gm-Message-State: AOJu0YywwUuhJhl9X67TVD38+D0TnGoZQtV6jpOu1zMCUfJUwWqNvl6g DSeM4xIv+ATe+T6JfjW8XZaHfYnia5nzDD3w3C+4CqL5lP4kTT59 X-Google-Smtp-Source: AGHT+IGmvHjEHV9FtxS/iLLwhsoB6LA76JI/2S+B5fHnmu7Hgj2BYmypa1uOlQi8la9CdsvyNQ+YiA== X-Received: by 2002:a17:90a:1117:b0:299:14c9:94f0 with SMTP id d23-20020a17090a111700b0029914c994f0mr4250349pja.11.1708940365783; Mon, 26 Feb 2024 01:39:25 -0800 (PST) Received: from wheely.local0.net (220-235-194-103.tpgi.com.au. [220.235.194.103]) by smtp.gmail.com with ESMTPSA id pa3-20020a17090b264300b0029929ec25fesm6036782pjb.27.2024.02.26.01.39.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 01:39:25 -0800 (PST) From: Nicholas Piggin To: Thomas Huth Subject: [kvm-unit-tests PATCH 6/7] gitlab-ci: Run migration selftest on s390x and powerpc Date: Mon, 26 Feb 2024 19:38:31 +1000 Message-ID: <20240226093832.1468383-7-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240226093832.1468383-1-npiggin@gmail.com> References: <20240226093832.1468383-1-npiggin@gmail.com> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , linux-s390@vger.kernel.org, Nico Boehr , Janosch Frank , kvm@vger.kernel.org, David Hildenbrand , linuxppc-dev@lists.ozlabs.org, Shaoqin Huang , Nicholas Piggin , Andrew Jones , Eric Auger , Marc Hartmayer , Paolo Bonzini , Claudio Imbrenda , Alexandru Elisei Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" The migration harness is complicated and easy to break so CI will be helpful. Signed-off-by: Nicholas Piggin --- .gitlab-ci.yml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 71d986e98..61f196d5d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -64,26 +64,28 @@ build-arm: build-ppc64be: extends: .outoftree_template script: - - dnf install -y qemu-system-ppc gcc-powerpc64-linux-gnu + - dnf install -y qemu-system-ppc gcc-powerpc64-linux-gnu nmap-ncat - mkdir build - cd build - ../configure --arch=ppc64 --endian=big --cross-prefix=powerpc64-linux-gnu- - make -j2 - ACCEL=tcg ./run_tests.sh - selftest-setup spapr_hcall rtas-get-time-of-day rtas-get-time-of-day-base - rtas-set-time-of-day emulator + selftest-setup selftest-migration selftest-migration-skip spapr_hcall + rtas-get-time-of-day rtas-get-time-of-day-base rtas-set-time-of-day + emulator | tee results.txt - if grep -q FAIL results.txt ; then exit 1 ; fi build-ppc64le: extends: .intree_template script: - - dnf install -y qemu-system-ppc gcc-powerpc64-linux-gnu + - dnf install -y qemu-system-ppc gcc-powerpc64-linux-gnu nmap-ncat - ./configure --arch=ppc64 --endian=little --cross-prefix=powerpc64-linux-gnu- - make -j2 - ACCEL=tcg ./run_tests.sh - selftest-setup spapr_hcall rtas-get-time-of-day rtas-get-time-of-day-base - rtas-set-time-of-day emulator + selftest-setup selftest-migration selftest-migration-skip spapr_hcall + rtas-get-time-of-day rtas-get-time-of-day-base rtas-set-time-of-day + emulator | tee results.txt - if grep -q FAIL results.txt ; then exit 1 ; fi @@ -107,7 +109,7 @@ build-riscv64: build-s390x: extends: .outoftree_template script: - - dnf install -y qemu-system-s390x gcc-s390x-linux-gnu + - dnf install -y qemu-system-s390x gcc-s390x-linux-gnu nmap-ncat - mkdir build - cd build - ../configure --arch=s390x --cross-prefix=s390x-linux-gnu- @@ -133,6 +135,8 @@ build-s390x: sclp-1g sclp-3g selftest-setup + selftest-migration + selftest-migration-skip sieve smp stsi From patchwork Mon Feb 26 09:38:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1904226 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=eMZj3iXC; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=patchwork.ozlabs.org) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TjwgP1YYpz23cb for ; Mon, 26 Feb 2024 20:44:17 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=eMZj3iXC; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4TjwgN6Dqfz3vh7 for ; Mon, 26 Feb 2024 20:44:16 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.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=eMZj3iXC; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::1036; helo=mail-pj1-x1036.google.com; envelope-from=npiggin@gmail.com; receiver=lists.ozlabs.org) Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4TjwYy55SBz3cPk for ; Mon, 26 Feb 2024 20:39:34 +1100 (AEDT) Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-299ea1f1989so1256157a91.0 for ; Mon, 26 Feb 2024 01:39:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708940372; x=1709545172; darn=lists.ozlabs.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=4C3sdt0JsWbryl8xk4OG1WbSXlpSqNkR+NKIJMu9X/I=; b=eMZj3iXCH0M757jZZ41LoC1UXK6PO60Jf86YctYJfUXTlYerbVXTbHftwlKtble9Le Lkas467eUZv+PL57t8l/w4DKe0ef0AbcYSTr2qX+PVVzTdGpQIJrm7y72eH3xkmNzvqt 8Vu81PPR6SfF+ZAb/td5dhpFGODRV/A7xTHJ+6gjuA/l4EEhA91UBfFeIifr8yKPc/T1 v+PBqIuGNIm1s4hNfwIVfu0x6uTvxmM1CIpL6LNOL83e0gmF/epi2fXZjRzC4Q94Fnc4 j5P45tDdNqF5MCAru4ESsAfRyEzGrY6CtJTMhWguTf6wsL+PP1cANWuQ0dnKdAaNpb+/ cLqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708940372; x=1709545172; 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=4C3sdt0JsWbryl8xk4OG1WbSXlpSqNkR+NKIJMu9X/I=; b=aijD9HZzWr4TcmPYpvL2IjSXAPnum3fk6hwG6Z2rA9weZUj0TtDP9/xaoA4HbuVFD0 LfUjdbzCxG9qSbbUoFbjcBP7Xb2h7Q0qskwldCODy2K9YlMF8jmgVswZnzxq6cKIppsZ 73BU+fAhPfSLwWxG88bqzPoWMSEUH6HQVTlJPmuivZ1L3nqN/MqU8vug8vBYAxTmdBpt aSkhSR8BN15XvEoOP4yXZwhTNyHUD5PDQnetDYi6qp/HTEGE0B81bkIu7FUWDnlqeDO1 VUSOKPdwFm14uurTn9WFjRB92Nze784gYvAffDKp/POkOEjpMICE8dGyy2tIz7/h98i3 Lv/A== X-Forwarded-Encrypted: i=1; AJvYcCXGohsAFq8OrQOZ6c89psMO7mAqlM+XJjzGme6FzDTEA7Sh2CsUYwm4/IjrArJxLWgfXOpv0ukt+0wAmEIGw2eA+3tkmqyJrtO/4a2Yvw== X-Gm-Message-State: AOJu0Yzhncd+3gQU9/aowCsRc0UOE1zX9nIZgIga8Sj+aCHwhPoRORPM o5+3Z3uvYQaqfy5qvJ6Dv90P0KLZhaYZmND+6iY/ZGlWilxjBVJk X-Google-Smtp-Source: AGHT+IFXLyYXdyP2UAckhzh+BDfRTP5s86iCzOS+vBsDRJEkc8Q8vEMkpMw7UMDXxznIh8HlHNlNaA== X-Received: by 2002:a17:90a:db03:b0:29a:59a7:951d with SMTP id g3-20020a17090adb0300b0029a59a7951dmr3903944pjv.5.1708940372072; Mon, 26 Feb 2024 01:39:32 -0800 (PST) Received: from wheely.local0.net (220-235-194-103.tpgi.com.au. [220.235.194.103]) by smtp.gmail.com with ESMTPSA id pa3-20020a17090b264300b0029929ec25fesm6036782pjb.27.2024.02.26.01.39.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 01:39:31 -0800 (PST) From: Nicholas Piggin To: Thomas Huth Subject: [kvm-unit-tests PATCH 7/7] common: add memory dirtying vs migration test Date: Mon, 26 Feb 2024 19:38:32 +1000 Message-ID: <20240226093832.1468383-8-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240226093832.1468383-1-npiggin@gmail.com> References: <20240226093832.1468383-1-npiggin@gmail.com> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , linux-s390@vger.kernel.org, Nico Boehr , Janosch Frank , kvm@vger.kernel.org, David Hildenbrand , linuxppc-dev@lists.ozlabs.org, Shaoqin Huang , Nicholas Piggin , Andrew Jones , Eric Auger , Marc Hartmayer , Paolo Bonzini , Claudio Imbrenda , Alexandru Elisei Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" This test stores to a bunch of pages and verifies previous stores, while being continually migrated. This can fail due to a QEMU TCG physical memory dirty bitmap bug. Signed-off-by: Nicholas Piggin --- common/memory-verify.c | 48 +++++++++++++++++++++++++++++++++++++++++ powerpc/Makefile.common | 1 + powerpc/memory-verify.c | 1 + powerpc/unittests.cfg | 7 ++++++ s390x/Makefile | 1 + s390x/memory-verify.c | 1 + s390x/unittests.cfg | 6 ++++++ 7 files changed, 65 insertions(+) create mode 100644 common/memory-verify.c create mode 120000 powerpc/memory-verify.c create mode 120000 s390x/memory-verify.c diff --git a/common/memory-verify.c b/common/memory-verify.c new file mode 100644 index 000000000..7c4ec087b --- /dev/null +++ b/common/memory-verify.c @@ -0,0 +1,48 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Simple memory verification test, used to exercise dirty memory migration. + * + */ +#include +#include +#include +#include +#include + +#define NR_PAGES 32 + +int main(int argc, char **argv) +{ + void *mem = malloc(NR_PAGES*PAGE_SIZE); + bool success = true; + uint64_t ms; + long i; + + report_prefix_push("memory"); + + memset(mem, 0, NR_PAGES*PAGE_SIZE); + + migrate_begin_continuous(); + ms = get_clock_ms(); + i = 0; + do { + int j; + + for (j = 0; j < NR_PAGES*PAGE_SIZE; j += PAGE_SIZE) { + if (*(volatile long *)(mem + j) != i) { + success = false; + goto out; + } + *(volatile long *)(mem + j) = i + 1; + } + i++; + } while (get_clock_ms() - ms < 5000); +out: + migrate_end_continuous(); + + report(success, "memory verification stress test"); + + report_prefix_pop(); + + return report_summary(); +} diff --git a/powerpc/Makefile.common b/powerpc/Makefile.common index da4a7bbb8..1e181da69 100644 --- a/powerpc/Makefile.common +++ b/powerpc/Makefile.common @@ -7,6 +7,7 @@ tests-common = \ $(TEST_DIR)/selftest.elf \ $(TEST_DIR)/selftest-migration.elf \ + $(TEST_DIR)/memory-verify.elf \ $(TEST_DIR)/spapr_hcall.elf \ $(TEST_DIR)/rtas.elf \ $(TEST_DIR)/emulator.elf \ diff --git a/powerpc/memory-verify.c b/powerpc/memory-verify.c new file mode 120000 index 000000000..5985c730f --- /dev/null +++ b/powerpc/memory-verify.c @@ -0,0 +1 @@ +../common/memory-verify.c \ No newline at end of file diff --git a/powerpc/unittests.cfg b/powerpc/unittests.cfg index 89abf2095..fadd8dde6 100644 --- a/powerpc/unittests.cfg +++ b/powerpc/unittests.cfg @@ -46,6 +46,13 @@ machine = pseries groups = selftest migration extra_params = -append "skip" +# This fails due to a QEMU TCG bug so KVM-only until QEMU is fixed upstream +[migration-memory] +file = memory-verify.elf +accel = kvm +machine = pseries +groups = migration + [spapr_hcall] file = spapr_hcall.elf diff --git a/s390x/Makefile b/s390x/Makefile index 344d46d68..ddc0969f3 100644 --- a/s390x/Makefile +++ b/s390x/Makefile @@ -1,5 +1,6 @@ tests = $(TEST_DIR)/selftest.elf tests += $(TEST_DIR)/selftest-migration.elf +tests += $(TEST_DIR)/memory-verify.elf tests += $(TEST_DIR)/intercept.elf tests += $(TEST_DIR)/emulator.elf tests += $(TEST_DIR)/sieve.elf diff --git a/s390x/memory-verify.c b/s390x/memory-verify.c new file mode 120000 index 000000000..5985c730f --- /dev/null +++ b/s390x/memory-verify.c @@ -0,0 +1 @@ +../common/memory-verify.c \ No newline at end of file diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg index f613602d3..a88fe9e79 100644 --- a/s390x/unittests.cfg +++ b/s390x/unittests.cfg @@ -33,6 +33,12 @@ file = selftest-migration.elf groups = selftest migration extra_params = -append "skip" +# This fails due to a QEMU TCG bug so KVM-only until QEMU is fixed upstream +[migration-memory] +file = memory-verify.elf +accel = kvm +groups = migration + [intercept] file = intercept.elf