From patchwork Fri Feb 2 06:57:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 13542205 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C1EC717BA1; Fri, 2 Feb 2024 06:58:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706857091; cv=none; b=StNFiy6GVJqfUnjHflNEYlh5Zpg/S1Xtt9QfbwJivGU6DfDhAnv/055UomBjwDIE6hfZIMRpyn99wnEbDxIX3Awqfwd3E6p2OYHQVDVgjcgByvd2cjx2z6HBZtXNnQbPZjHg7MxOD6EXyiFycXDpmVeUxdfG9rylGSfUlpbBjzA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706857091; c=relaxed/simple; bh=b+QxyzhsvZN3OwzcPJaOYnXe1uuKxDesUKwJYAtosxU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=SooEekvaUUFjOH7+gVcBd70i93ESpyvgT0MQCXRyYchqzoNGh/qY2K8QqtZi0mLp4lWoL9RzAMofK4np2rpiAFTDpZdoPBezqJjGb/bpUEuxcTJPB/tXoxh8Mbh+eG91zmUCr2wA47+x92+pRwUWsmtcs2BrWdBwXjZTKYmxMJw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=BKTbAn1q; arc=none smtp.client-ip=209.85.214.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BKTbAn1q" Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1d928a8dee8so20121385ad.1; Thu, 01 Feb 2024 22:58:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706857089; x=1707461889; darn=vger.kernel.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=ISYOFWMJ8Ya9qR54XDhg0pvkVFnzxzaLNa6Ru0XuDgY=; b=BKTbAn1qThrnIWvVB41bje/SGmdpwsf+zgt0usYaU5bAEAuncyfNP+ZHGKbtwy3OFO ilpBL2qQmzI5AygVyfPSeyQd0UoostECTTsC/a+crsQgwnzDQ7zecODymDnAWHL3R8UM Pk/d1+jb+TAneix4Ei/mz0Ls1v0MBNZSj07ZhlzQugQx5DSXp/lhjbv3lAk4lMOQEFJr VFdmaTOgGoqB5OZ0fgPqNxGd+kiQlEChcDEX9YbDqK3abHNsPXtfl5sXT6CpcgPaenWF M0ZL+3BOA/LGS4P/vp7NgTKHrLfoorHKSc5AdW+ASKXfLVGKWFIyWq1HRudnkOgBx0fo zXmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706857089; x=1707461889; 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=ISYOFWMJ8Ya9qR54XDhg0pvkVFnzxzaLNa6Ru0XuDgY=; b=QgNHtzmkJxrnAypFzMkWR7zdYfxG2fFedx2YeMsxKZykxy8CNxLk3AXnJOY0Rhz0Ny r3PZiiiJCAUBwk4pmCeMoTv0yr/hIYigyjuP9xyU35HfGzgGTA9aVxFWCuN5FeO//qeF zY3F5g/QA6VkD5auSo8E5RUjIoa8fUFqSNTfp+nr7nri3LJ81E04okzS0eHh7mXomYp9 Phqz1xiUeqGHVsdUjq3zgbEqWyG88JK/y/iNsdyoiL208t1RAPI4IBHwS3B7gua/RSKM UtKnkWAAG0G7rudKhlE22fF8X5s8RwgKxgUwQmqLQOZn00NodAXURWoTIAji2pKPWzii N00w== X-Gm-Message-State: AOJu0YwXdnZY45Db2s34jrOE3bheisixeKdzECX6Gu7+TKxQQF9QTFw4 8JElavuk3OlMgD4dRBdLL+TCg5gQ4Wro5nlM0pLNpQCbkd6MHmLt X-Google-Smtp-Source: AGHT+IHuRTzUNEDoBrt5G53jiaYXfJZtXJVA0vZJoFpKTVNkOajG1pLBiy86JSnIBL/sauMLQIgPVg== X-Received: by 2002:a17:902:c20b:b0:1d9:30e3:ea84 with SMTP id 11-20020a170902c20b00b001d930e3ea84mr1670212pll.2.1706857089045; Thu, 01 Feb 2024 22:58:09 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCWjZNe27ib/vYkFoWq6/PqYfbalOs5zAPw9skB+ZgcK8jg9IvDXE9J+CmHt9/N5zRNbuarqznq7Q4qopRSOqZX2cn9N8IgrYYggfQalfDEBinpojSGVWOT/EUIfWj16iA7eMjjbF9xT/aeq1KFiH2OriigGgcx/JOmtm/bu/PB4qwkshtB8p/24b9LK/rvjJ41vh1YFLdy13VZGXmTAgSqseL5L2VuWBtBaGkypdBLoRkYX2ODngQHJ1LN7EXIzX/ToWEwUbOsvUzQTdXEd26i5jE2nHMk6k1YUOPq4uEUj3WVbE9EdmpS52VgYk0FqSiry4mg+XLFagmWYk7cJDMr37edC1DZbObWmmZsb5HBPOTFs5UYkR+wZ1f8hF83cM4b28GvJiZm6Irid1eoOsd0ThO6B9s/31Z7jYPgg5YzzBggQrhRnvihG5vRvumkQNDNelKznW16NnTC6/ktXq9qy1yXpuoRkjqKCDvxb68MO3ZFcGim9OZPwXv2fOMaV0AVd1R2NojYBw3M= Received: from wheely.local0.net ([1.146.53.155]) by smtp.gmail.com with ESMTPSA id d18-20020a170903209200b001d948adc19fsm905734plc.46.2024.02.01.22.58.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 22:58:08 -0800 (PST) From: Nicholas Piggin To: Thomas Huth Cc: Nicholas Piggin , kvm@vger.kernel.org, Laurent Vivier , "Shaoqin Huang" , Andrew Jones , Nico Boehr , Paolo Bonzini , Alexandru Elisei , Eric Auger , Janosch Frank , Claudio Imbrenda , David Hildenbrand , Marc Hartmayer , linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, kvmarm@lists.linux.dev Subject: [kvm-unit-tests PATCH v2 1/9] (arm|powerpc|s390x): Makefile: Fix .aux.o generation Date: Fri, 2 Feb 2024 16:57:32 +1000 Message-ID: <20240202065740.68643-2-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240202065740.68643-1-npiggin@gmail.com> References: <20240202065740.68643-1-npiggin@gmail.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Using all prerequisites for the source file results in the build dying on the second time around with: gcc: fatal error: cannot specify ‘-o’ with ‘-c’, ‘-S’ or ‘-E’ with multiple files This is due to auxinfo.h becoming a prerequisite after the first build recorded the dependency. Use the first prerequisite for this recipe. Fixes: f2372f2d49135 ("(arm|powerpc|s390x): Makefile: add `%.aux.o` target") Signed-off-by: Nicholas Piggin Reviewed-by: Marc Hartmayer --- arm/Makefile.common | 2 +- powerpc/Makefile.common | 2 +- s390x/Makefile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arm/Makefile.common b/arm/Makefile.common index 54cb4a63..c2ee568c 100644 --- a/arm/Makefile.common +++ b/arm/Makefile.common @@ -71,7 +71,7 @@ FLATLIBS = $(libcflat) $(LIBFDT_archive) $(libeabi) ifeq ($(CONFIG_EFI),y) %.aux.o: $(SRCDIR)/lib/auxinfo.c - $(CC) $(CFLAGS) -c -o $@ $^ \ + $(CC) $(CFLAGS) -c -o $@ $< \ -DPROGNAME=\"$(@:.aux.o=.efi)\" -DAUXFLAGS=$(AUXFLAGS) %.so: EFI_LDFLAGS += -defsym=EFI_SUBSYSTEM=0xa --no-undefined diff --git a/powerpc/Makefile.common b/powerpc/Makefile.common index 483ff648..eb88398d 100644 --- a/powerpc/Makefile.common +++ b/powerpc/Makefile.common @@ -48,7 +48,7 @@ cflatobjs += lib/powerpc/smp.o OBJDIRS += lib/powerpc %.aux.o: $(SRCDIR)/lib/auxinfo.c - $(CC) $(CFLAGS) -c -o $@ $^ -DPROGNAME=\"$(@:.aux.o=.elf)\" + $(CC) $(CFLAGS) -c -o $@ $< -DPROGNAME=\"$(@:.aux.o=.elf)\" FLATLIBS = $(libcflat) $(LIBFDT_archive) %.elf: CFLAGS += $(arch_CFLAGS) diff --git a/s390x/Makefile b/s390x/Makefile index e64521e0..b72f7578 100644 --- a/s390x/Makefile +++ b/s390x/Makefile @@ -177,7 +177,7 @@ lds-autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d -MT $@ $(CPP) $(lds-autodepend-flags) $(CPPFLAGS) -P -C -o $@ $< %.aux.o: $(SRCDIR)/lib/auxinfo.c - $(CC) $(CFLAGS) -c -o $@ $^ -DPROGNAME=\"$(@:.aux.o=.elf)\" + $(CC) $(CFLAGS) -c -o $@ $< -DPROGNAME=\"$(@:.aux.o=.elf)\" .SECONDEXPANSION: %.elf: $(FLATLIBS) $(asmlib) $(SRCDIR)/s390x/flat.lds $$(snippets-obj) $$(snippet-hdr-obj) %.o %.aux.o From patchwork Fri Feb 2 06:57:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 13542206 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3BD6717BC2; Fri, 2 Feb 2024 06:58:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706857099; cv=none; b=dYEslCfgXO8KtVJWpnwMzOThqCO0YTXf8lq2s6cWnr5mYREyosEx6GWTnl+mF/J9wwwfYcVM43FSxE8yCwLYU1Lj2uz6Yrzmfgu1yf1uOP7aifXYC4AJKexXfl8NSGyRrvI/euzGBPdE4miw4Gig0VsifSOxiSdf7XYqMGtg66Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706857099; c=relaxed/simple; bh=bfyX8EE4/uU+JXe129hEHOC/zLEOlb2+oTpWsMsoZPs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rdDM7ib49VXYvFKt5pdjSPhwt/RaiwZ6TZva1aclIGf1gx1b7UHVmtRGXdp6LLV1ERBNN2PhBBkV+RLquyWEc+5qfY2dBzcJqLPZt5hinVQ5hOM8YJQiAimclmpAdNbrQT9Q/q5lu1EffRVYptE1oS7Ksl2FsfAQoLV8gl567Rs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=DMhKWY4x; arc=none smtp.client-ip=209.85.214.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DMhKWY4x" Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-1d918008b99so14157195ad.3; Thu, 01 Feb 2024 22:58:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706857097; x=1707461897; darn=vger.kernel.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=aeVnbjWEi5yI3wZCxJZ+3TFl6uPEJpXO65IAKcNUOWw=; b=DMhKWY4xeMmxF6+dP012AH4IhDNrqIg3BnIOhrlyCFRP4SFY8Iw74E3/8AAAOCqTmy qNotH6YVwqeMc1+FoWHYz2SCnAqtSCOWER2OvOlSz8ALl5yWHL70XvQ4QAME4aqsK1og 9ldqVyGIbgeBE82ZhHfGTebWOIPh4OceS137b+EechI6gawXlCovvjynB66pTyiPcNYu 13le2I2UiHVscbs+g0NTzgjhNlI456AG5a7Xe86UBsIA5fmjqDExEzWDTYNc8bKI+mUM 3A1fRXXjZDlrwiBiegfwRKtZabOV2Yu0+UkhOngkqMNRuR7dfV1coNy0Cxh52UjfEZLR MrUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706857097; x=1707461897; 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=aeVnbjWEi5yI3wZCxJZ+3TFl6uPEJpXO65IAKcNUOWw=; b=b+QhnNT0WT4XW2BUTcbb/xZuDyi3sbcHBqnA34KVbMFvtwDA5hmBJ6BiIyeMz1K+l2 BiMn5NWA8F9zLqfjkB1g+lUgwbe9ih32RcCeyC8wD+caAn+Z2ZlJDvpuKmQg/A4LaTQR VYAv76fJOxAkWgPSB8mZSaD53t8u+yOqcyWxnEcRH5Kw9A5n1rKG+IfU3/lFL52t/u08 brYU47FDE8/PDalPNibxSY8VitvFHVHJQACnVJImI0t0W4GUHyUTXGDfCH9mXztSaelh 1Q/CQfNJeaNkR9IAdXBCqyjXKMZCq39+wdBvEx8vWTo4U0+0QpoJQtQMgakmk73H3vOg 2SfQ== X-Gm-Message-State: AOJu0YyeKoWSpON3/pan7NH+JZJYzdshrD06ltNa+X/4MxL7LfHrI4bQ kUAQyv7Bkvyc0Nw4WyPLLyBzSS8czXhAsjDWBmgoLNo0xpviXV1UPHCr7c/W X-Google-Smtp-Source: AGHT+IFBf6XLeyraYLqpgaXllqfIV8nP9aOkiHz9H9CBuCbU+/Yzwi3JwhbazRyvCR+MSQuAhK3haw== X-Received: by 2002:a17:902:ce8c:b0:1d9:7412:834 with SMTP id f12-20020a170902ce8c00b001d974120834mr718546plg.8.1706857097435; Thu, 01 Feb 2024 22:58:17 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCVJmtn1TofVQ50OkhQ3d7+h/hvpgY3hL3pMQR9S++DrXoJ95NmPFx5wFTv7bvP1p2/l1zKasGkK1rD+WWnzk0PdekgWWBoWRk4nYWS8BRvT70PElYjZom3Rl0qdTRjjdtOjns3331AdDSmEOawg0WnT2m8XyVQDQAYwn7JPuJP81H7+qD7eL00OM7eZO4aKstDvUSDy6kLbKV5SaTYhXjNv5bPHsj3fWPSZMsvPgE7p1uaxNJfAY2jceiXMTarske+gOQQArkw+uqLvSq5bWvZg6PEEwChSgxUg9SJlP/fYrh3NV4WAq/ldvN/DezZK9hI7K3zk9mqC3a8UEDoxSunAP8OzgOJRcpdqNwykqePnm3DAQ9tZlxD5vWC+kH4QwqVMQf3gFEGrrprsp4X7Ez5x6S4cT1HtvqoNHsrstfzGR8kDguZc6NNun+ggT2fufC+TbxJjBqqNBEr8AK5yEGxHSjNEFgJ1aqV8sTR/1zRNnen1Dio6xSdaw+FCJi3AIxME1Z58TikkJmw= Received: from wheely.local0.net ([1.146.53.155]) by smtp.gmail.com with ESMTPSA id d18-20020a170903209200b001d948adc19fsm905734plc.46.2024.02.01.22.58.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 22:58:17 -0800 (PST) From: Nicholas Piggin To: Thomas Huth Cc: Nicholas Piggin , kvm@vger.kernel.org, Laurent Vivier , "Shaoqin Huang" , Andrew Jones , Nico Boehr , Paolo Bonzini , Alexandru Elisei , Eric Auger , Janosch Frank , Claudio Imbrenda , David Hildenbrand , Marc Hartmayer , linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, kvmarm@lists.linux.dev Subject: [kvm-unit-tests PATCH v2 2/9] arch-run: Clean up temporary files properly Date: Fri, 2 Feb 2024 16:57:33 +1000 Message-ID: <20240202065740.68643-3-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240202065740.68643-1-npiggin@gmail.com> References: <20240202065740.68643-1-npiggin@gmail.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Migration files weren't being removed when tests were interrupted. This improves the situation. Signed-off-by: Nicholas Piggin Reviewed-by: Thomas Huth --- scripts/arch-run.bash | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash index d0864360..f22ead6f 100644 --- a/scripts/arch-run.bash +++ b/scripts/arch-run.bash @@ -134,12 +134,14 @@ run_migration () qmp1=$(mktemp -u -t mig-helper-qmp1.XXXXXXXXXX) qmp2=$(mktemp -u -t mig-helper-qmp2.XXXXXXXXXX) fifo=$(mktemp -u -t mig-helper-fifo.XXXXXXXXXX) + + # race here between file creation and trap + trap "trap - TERM ; kill 0 ; exit 2" INT TERM + trap "rm -f ${migout1} ${migsock} ${qmp1} ${qmp2} ${fifo}" RETURN EXIT + qmpout1=/dev/null qmpout2=/dev/null - trap 'kill 0; exit 2' INT TERM - trap 'rm -f ${migout1} ${migsock} ${qmp1} ${qmp2} ${fifo}' RETURN EXIT - eval "$@" -chardev socket,id=mon1,path=${qmp1},server=on,wait=off \ -mon chardev=mon1,mode=control | tee ${migout1} & live_pid=`jobs -l %+ | grep "eval" | awk '{print$2}'` @@ -211,8 +213,8 @@ run_panic () qmp=$(mktemp -u -t panic-qmp.XXXXXXXXXX) - trap 'kill 0; exit 2' INT TERM - trap 'rm -f ${qmp}' RETURN EXIT + trap "trap - TERM ; kill 0 ; exit 2" INT TERM + trap "rm -f ${qmp}" RETURN EXIT # start VM stopped so we don't miss any events eval "$@" -chardev socket,id=mon1,path=${qmp},server=on,wait=off \ From patchwork Fri Feb 2 06:57:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 13542207 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3BE6A17C72; Fri, 2 Feb 2024 06:58:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706857108; cv=none; b=oDh5nfojxK0AK6bv80aZ+cQnaLp0XXjURzruU26x2AOdaT70qsrVu3P6Nxca3+nmkcERi9KLnr3wki7WT7dF/2HKYOcslT0r5JMslgDwXfWfzU9Itqxz27TI21I5Ns8F1bD66A4v4AkjP2qXbFdLMGEnuDRuctm8tmnsyQD6s2s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706857108; c=relaxed/simple; bh=4yScsOrcnjKTTDzCPnl6oSqQbBcwqPOJzQMwRvXXfl8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GKzorPg/5p0Eet/V2wdEwC+blfAJLDzDZxd6485w6ZVIX3Y7hDjutGtLCuhnnXqi4ihOIFeLk4kWBeH5iaoy0uy718YniVsj2GDzYrfHQMr3DHuzWiag6d/Zi4Xq1iKFGwYoUp6MzVjPLFmuJF2olcGEYbzTYerzy50YJRw+eQ8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=PFEpSd9i; arc=none smtp.client-ip=209.85.214.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PFEpSd9i" Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-1d8e7df6abcso16662555ad.1; Thu, 01 Feb 2024 22:58:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706857106; x=1707461906; darn=vger.kernel.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=EawXcrWZcj4wjBdULRz+yh78MdJFfpIVMXufen8CLio=; b=PFEpSd9iABdv0Rs4jJjTgfG9YOUwIoAdNPj/Hwlf68QO7WJxKTKiWRbv1CYvu0S6U7 478w7BnKhUBywiIkt1OSVBZEHHjoNO9QJYOW4i/pkanr+7MGqmRQtJz3J9N6NOkH/7mg LsUt8J3WqoSMfEV7aLe4Qn7GIwvRCgHvuwHKwBv2F5CEXKN9KkwFgsm/HK3+crHmqykR uvrI2mMKyNHl0iyNmPJ9hI0qG227IjTyZ3sUGA+X2lKrgBxhE5iCV2y+qC3af9+E8eeX meh7dS/zD62deX/U0uMZxErLhyEReKLIM7lEFpDSW4IZjA8kaNcWvScktozy/5Pq+Lat sFBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706857106; x=1707461906; 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=EawXcrWZcj4wjBdULRz+yh78MdJFfpIVMXufen8CLio=; b=rmo2AjBGEEXjs+Dz0+M+wTXhqFFLacMPtS0zcmmq2t+b7MMO1m7zifNR4IDBV9AZoA 7ynRnTMAXFhqYuPFtgs0tvtKufyAGKSeX2gIiwA0hGdJiZTxU+7plMtPV+HhTczLPQgN fiXpQlj6mqoQNRybExoohbiiQff6kGhfmXj1OVv2fE122gvglKHhqKetGsxkIPxl6vZm YNBf7znHv6n4BG40Bo0wm1yIkv1+vKUJ/qkJjjvcx8d3F2d12C/x6U2+e13qOyCysss4 BfQ6nr6BuqONRwQV5K9RVecrgbJRXoRF9rIX8IMEukvFnzqMOCnNG2sx/2YCBRuuSJDc xbdg== X-Gm-Message-State: AOJu0YxWrg4uoMwNf5B/FshirENSFXq/+K2tb16QI2VfqJ0ppeESafAf PAuusodObHO+4BMxXe/um3kigf5kifYdVwJwch6TMbPHWOAo/d30 X-Google-Smtp-Source: AGHT+IGl/XMjvd9Klgg2/FWxCwJMxKc63HwstNQDO2ClYm/78uC2k5jJZCUW+UiCZN8A2rtA+7mFiQ== X-Received: by 2002:a17:903:445:b0:1d9:5ef2:abdd with SMTP id iw5-20020a170903044500b001d95ef2abddmr1116146plb.0.1706857106567; Thu, 01 Feb 2024 22:58:26 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCW/IOgMZYUZthoBpoNRMf/oli+krs0I7QalTXQLhmUUWWhn4KTEGdDr/tD4cxALPr5YanOFmAHpezVtwao2TQzO+RlJR3Ey/l7/3QH/K3g+wJhke1+8D7EBboNPM5WoqME9ClFM8Tb2qCEIYjo+bDj+JytizB/Z/HHC2r1N33PYMUgH67boLyOHJbDw9bZpjApoN82XPi+TIHolN046l5iX1K13QrymhO+WP1rEnsSa9hFW05dJESbK9n9XsLx0/+71n2h46K26UvtQ2Tvhi4CxxSgx61auRLuHt8a4ivXCW09clAuX2orO6qQmVgmRP6m0MuduJ7wcFMpF4m/Yyx8XgB+x2QC4G9sG0uUxRP61DypLkLC/HukTiuGgrKuWO8070olj+6YNjeeQFlx6mz0z7Ta+qF2P+x5aggZgJT35GSJypgDz0pyEIOTAPK75Tgu99P65NQ0dXD3u4iLw7/cZe08vmV/GqS8qWhRhxtJKwMQsq18X2q834tfjJ55jslSnq+Pu+viz/94= Received: from wheely.local0.net ([1.146.53.155]) by smtp.gmail.com with ESMTPSA id d18-20020a170903209200b001d948adc19fsm905734plc.46.2024.02.01.22.58.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 22:58:26 -0800 (PST) From: Nicholas Piggin To: Thomas Huth Cc: Nicholas Piggin , kvm@vger.kernel.org, Laurent Vivier , "Shaoqin Huang" , Andrew Jones , Nico Boehr , Paolo Bonzini , Alexandru Elisei , Eric Auger , Janosch Frank , Claudio Imbrenda , David Hildenbrand , Marc Hartmayer , linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, kvmarm@lists.linux.dev Subject: [kvm-unit-tests PATCH v2 3/9] arch-run: Clean up initrd cleanup Date: Fri, 2 Feb 2024 16:57:34 +1000 Message-ID: <20240202065740.68643-4-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240202065740.68643-1-npiggin@gmail.com> References: <20240202065740.68643-1-npiggin@gmail.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Rather than put a big script into the trap handler, have it call a function. Signed-off-by: Nicholas Piggin --- scripts/arch-run.bash | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash index f22ead6f..cc7da7c5 100644 --- a/scripts/arch-run.bash +++ b/scripts/arch-run.bash @@ -271,10 +271,20 @@ search_qemu_binary () export PATH=$save_path } +initrd_cleanup () +{ + if [ "$KVM_UNIT_TESTS_ENV_OLD" ]; then + export KVM_UNIT_TESTS_ENV="$KVM_UNIT_TESTS_ENV_OLD" + else + unset KVM_UNIT_TESTS_ENV + unset KVM_UNIT_TESTS_ENV_OLD + fi +} + initrd_create () { if [ "$ENVIRON_DEFAULT" = "yes" ]; then - trap_exit_push 'rm -f $KVM_UNIT_TESTS_ENV; [ "$KVM_UNIT_TESTS_ENV_OLD" ] && export KVM_UNIT_TESTS_ENV="$KVM_UNIT_TESTS_ENV_OLD" || unset KVM_UNIT_TESTS_ENV; unset KVM_UNIT_TESTS_ENV_OLD' + trap_exit_push 'rm -f $KVM_UNIT_TESTS_ENV; initrd_cleanup' [ -f "$KVM_UNIT_TESTS_ENV" ] && export KVM_UNIT_TESTS_ENV_OLD="$KVM_UNIT_TESTS_ENV" export KVM_UNIT_TESTS_ENV=$(mktemp) env_params From patchwork Fri Feb 2 06:57:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 13542208 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E18AD18030; Fri, 2 Feb 2024 06:58:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706857117; cv=none; b=HsJaJMfvKyshfpdJGDZvvOPjqPNC84mGj0jP/qbD6sIR64/rFWk6Dh5sIH0I40BcztENU+GpNOHUfajTS9f9J6N5hK7twGevR9pBfgb5nSHpN1+cuV830+pKK1Ep+Y12nXxN6qZ2cuL6D6xOvN5pXOyHGZHZiETpAtHivcRV+w8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706857117; c=relaxed/simple; bh=vZ3YMwX66EaqbN2ORZOVXLG/sa0Qdj2N0D2ckqa3J3g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Eif5tzWxlcZ4S3rmmXS94PElaBH6U1ftAmb2KCoHV7z9cx0I11Q6sUAYZV+FkeaSxRVnCci8LS8im4C2pQBbprk8atUfXhUzNXntYHNTaCoJq3Cufz7efdg7gqUIbh6cSv32yWEbFbJ/Z8tTQgsTO8vrN8vJPCiXvPzAV9GNHc0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=V8hFuEHF; arc=none smtp.client-ip=209.85.214.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="V8hFuEHF" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1d780a392fdso14972805ad.3; Thu, 01 Feb 2024 22:58:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706857115; x=1707461915; darn=vger.kernel.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=csZzn8Tts4GDrY3qLQnkSR7QOMG8LbSslE35UizKPQ4=; b=V8hFuEHFAA38bYgjXPmLOFeiEbL2Ig3B4OFIf9tCdW2oJ41LnyvFsPHRwEaKvO8w2b Wzzas+cweOMFaAYV1Hw8grPX1K7yv5oZV5e8F6rzgbuYbRDvscNSo1u11lkDOJoSJCZ/ 2gVvDwjvf3vIP7kOncGLOWNO0VxrShYmZ+BOtBvegaQ7p/0duI/gpQvzXlk2cztNErGM WA5TFiVgEifQK3NMgdWrqh/Q5VBUbBgbxJIjdj7nQJiZNoQouXLenRs6UTxlVUtrTcuM TodtvlDgsjPGQC+8tKFOiHLjoiZy/mwJuV/2DH/ry25NINLYqcLqLWX2yQrkzhTEwHaL d1NQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706857115; x=1707461915; 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=csZzn8Tts4GDrY3qLQnkSR7QOMG8LbSslE35UizKPQ4=; b=FjVzduLI5re0NTaFQh7xsPzpXwfmBeNxzphZc9SrxSMpfTLQHuA5gfNLYhsb+DdpZN OsDFysNo5b5ui2nJvmZN7FeE6VvsKX4T3aPY0CfT/TF1pIJzY6HTZ3e7qoZYDLRaOJ1Y 2z+syFUIOvQjBcXdPxSFAjj6TOo/ILFVEWhFkYSHnlmhiF4NtHAW5BRqcQqjLOlpvW+w nFggFC5WqOj8a8W4/S4wwIDBu86xOCHEnIhSMJc0CMeo1UJCPxpt1Rvaf2InRmfTR3ug cC0MZ0V0W94C61zf0hzENPN6tnA4iweNxnsS/4cINhEUKsU1p+kMg0MmOBIxf0XfABqG DbQA== X-Gm-Message-State: AOJu0YyfMDADwMi0WRkwO2DUUS23SCSwEUrZq8Gyepq5uCikdZVnt50S Ox3Hw/hP3xXYzu8YoBcylGYh1TQkeOl2eQ10l5rRZDuJj6018fuE X-Google-Smtp-Source: AGHT+IHQJovP9cuDfLX1LEk4K/alkVzLIkRzxJY+QcE5oL7Dd9yHKan4WRASlSMcGCHpHROzl2ZLRQ== X-Received: by 2002:a17:902:784a:b0:1d7:67ed:f359 with SMTP id e10-20020a170902784a00b001d767edf359mr4716325pln.4.1706857115153; Thu, 01 Feb 2024 22:58:35 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCVSwo2DhWJztWTa9U1WjnG2OEHk75aqypz9EENMaN9rCVjm2aNTvzqOjqreNJITShoHo9T7x+ko5qmg+0mV1bnB2ksDTXi9h0E+gKzF0gwzaPU7sZRfQKEE5GBwSp3vXM5daMc87iFTEbp+kKmWIGcoKllxbyyc7GHbbHP2MYk2R6FbS5cCICb3jeBoC95PLl3gQXdpeY3YdDjwN4gufC5UMsFyXUoMhxStsJ7LBtInri13Lv8ml/nw6NMfYwKBWGeEJ8tZYTOh8QEzFmsxwtypjQFDMaYc+rxpO3wB6cftW99sR9jBOzuqUTKG+KBI89qEH5I6L5LJLboUVYgjQm0h4CApMhlBMlEHF30OUwc1tiunLj3s1xlRislLrnE6gQk4nxX+bgKMbXi7ZyK+VprLwbV1fjrSnPLI+OjdwQoV5pGegIY6Uq6Z/3Mb2gELJE4vKhs+PHAA27nlDncGqIpzsXgCDW3i017CdB2wccIpLULEqbD1ub59rwYxNwXZYWe6tGz+X72qL8Y= Received: from wheely.local0.net ([1.146.53.155]) by smtp.gmail.com with ESMTPSA id d18-20020a170903209200b001d948adc19fsm905734plc.46.2024.02.01.22.58.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 22:58:34 -0800 (PST) From: Nicholas Piggin To: Thomas Huth Cc: Nicholas Piggin , kvm@vger.kernel.org, Laurent Vivier , "Shaoqin Huang" , Andrew Jones , Nico Boehr , Paolo Bonzini , Alexandru Elisei , Eric Auger , Janosch Frank , Claudio Imbrenda , David Hildenbrand , Marc Hartmayer , linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, kvmarm@lists.linux.dev Subject: [kvm-unit-tests PATCH v2 4/9] migration: use a more robust way to wait for background job Date: Fri, 2 Feb 2024 16:57:35 +1000 Message-ID: <20240202065740.68643-5-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240202065740.68643-1-npiggin@gmail.com> References: <20240202065740.68643-1-npiggin@gmail.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Starting a pipeline of jobs in the background does not seem to have a simple way to reliably find the pid of a particular process in the pipeline (because not all processes are started when the shell continues to execute). The way PID of QEMU is derived can result in a failure waiting on a PID that is not running. This is easier to hit with subsequent multiple-migration support. Changing this to use $! by swapping the pipeline for a fifo is more robust. Signed-off-by: Nicholas Piggin --- scripts/arch-run.bash | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash index cc7da7c5..8fbfc50c 100644 --- a/scripts/arch-run.bash +++ b/scripts/arch-run.bash @@ -131,6 +131,7 @@ run_migration () migsock=$(mktemp -u -t mig-helper-socket.XXXXXXXXXX) migout1=$(mktemp -t mig-helper-stdout1.XXXXXXXXXX) + migout_fifo1=$(mktemp -u -t mig-helper-fifo-stdout1.XXXXXXXXXX) qmp1=$(mktemp -u -t mig-helper-qmp1.XXXXXXXXXX) qmp2=$(mktemp -u -t mig-helper-qmp2.XXXXXXXXXX) fifo=$(mktemp -u -t mig-helper-fifo.XXXXXXXXXX) @@ -143,8 +144,9 @@ run_migration () qmpout2=/dev/null eval "$@" -chardev socket,id=mon1,path=${qmp1},server=on,wait=off \ - -mon chardev=mon1,mode=control | tee ${migout1} & - live_pid=`jobs -l %+ | grep "eval" | awk '{print$2}'` + -mon chardev=mon1,mode=control > ${migout_fifo1} & + live_pid=$! + cat ${migout_fifo1} | tee ${migout1} & # 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 @@ -152,7 +154,7 @@ run_migration () mkfifo ${fifo} eval "$@" -chardev socket,id=mon2,path=${qmp2},server=on,wait=off \ -mon chardev=mon2,mode=control -incoming unix:${migsock} < <(cat ${fifo}) & - incoming_pid=`jobs -l %+ | awk '{print$2}'` + incoming_pid=$! # The test must prompt the user to migrate, so wait for the "migrate" keyword while ! grep -q -i "Now migrate the VM" < ${migout1} ; do @@ -166,6 +168,10 @@ run_migration () sleep 1 done + # Wait until the destination has created the incoming and qmp sockets + while ! [ -S ${migsock} ] ; do sleep 0.1 ; done + while ! [ -S ${qmp2} ] ; do sleep 0.1 ; done + qmp ${qmp1} '"migrate", "arguments": { "uri": "unix:'${migsock}'" }' > ${qmpout1} # Wait for the migration to complete From patchwork Fri Feb 2 06:57:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 13542209 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF75A18036; Fri, 2 Feb 2024 06:58:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706857126; cv=none; b=FPNKMymPdTVHjwEblIjKMF+JDRa+SDxlYIE6GjdIM4wAHzFIv/hdPGA42ZwR8i2WfjGpCpjC8d4Y6M9IN8zH/XBMsTy1tJwhB8/91/qxI/s7HXciHUkmocRTYupqIxeHreKY2BuGrZSNQ2t/L+5xtWAntTNJbCv7g83frZwxefw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706857126; c=relaxed/simple; bh=qf+Z507zWm1DYmhr84DySroy53fHkmOS7q7f629dhLo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JXopRguK9VGvt7pEYXApHVe604o0dsVq04GgZHcBREoRi0eg2u6yrC1KoGNHIyAGqze/xq8OQjSJ+S5TRs2tRfp5splGbHkGExoLXbGWbzXhdjCGlelLgnXLFEk8oCghaIPsZdAXPHK/VAFuUxZDhN0L8swsa02/OGVRtmhX1Sg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=A2EIvxfo; arc=none smtp.client-ip=209.85.214.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="A2EIvxfo" Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-1d751bc0c15so15399915ad.2; Thu, 01 Feb 2024 22:58:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706857124; x=1707461924; darn=vger.kernel.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=CEmc8hWH0N3MbdgZGlp8+ITWi7wqdjs4A+FtzR//oQE=; b=A2EIvxfo7MIoFhDuiSu0WDmwHczfsXcNssVd8mOFcgddTiTHeKXbddOQGIHEF37Sv8 jvkeRENnNIfl0Wt2m9PNKwUU3iaQ8knyAIceE+WfJHFNtf4f+Txfc+Cyf8iaBqRJxaFl C6HJ+RAUE3QZj8F75GqcJF+4WTnZVvn9RmX3iuHZupeejT2LxasK7MqB737Qi8OQE8tt KtTfDavhwEtv3eOpb34+8MA39vkl2J9yLiOVRFaY+G7ysFKNEQGi0Fg8V3+4vLPV1Kfq 4yvhLFJxIbKI8mL8fLgTAM8XpsdFHxo//BzhVQymJ3Oc/ajhOwBOzvTvbIeS7LkLH8rc 77Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706857124; x=1707461924; 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=CEmc8hWH0N3MbdgZGlp8+ITWi7wqdjs4A+FtzR//oQE=; b=JeF43bykzNjllDCs7Qo7hkUJZ976oo9vaYamb0AegOxSx93svbtDtJONwIRwnB3cut eD0CILLYKrgMN0C3oFuNbS0cOlhbfW8ww+gvHBhveRamYZWI8JbJr1lL3aO/3dGooJ0M nI7pspcB2u60rMucScvh+HrBmbE/8uAejfTAjSTZ9w8HTQEzMNBuAC+FeyWYwdRFZeCc K108smxtKEucS0hqjyuzFttlWfvkK+EkBsOtN0D6BaCWxQu3hH6K8TrgH48GVEnIvYnX 6VpRkysmld6PTPqZ9vLCvSV2+qid0daxBla8I0rYTak/d4M3oyLAdEU5YvnUh1GweSWN /emw== X-Gm-Message-State: AOJu0Yw1Xs8X8wgpGji9YQrLbCIEfn17pa9Kw6yZykHWVUcKehPkk2Iw m1i2G/t5jqKcy3Wf3aAFKmOSpgw9qOhUKP7ylL82GOdXt2nPxjsL X-Google-Smtp-Source: AGHT+IEKYSABCOjkDGMGdflmfxV2qc3jRIH3QBD7Yhpq7BkGGiFXaxmnSnvXekXjilfsnWCWCzgQEw== X-Received: by 2002:a17:902:ee44:b0:1d9:711b:2698 with SMTP id 4-20020a170902ee4400b001d9711b2698mr803903plo.11.1706857124309; Thu, 01 Feb 2024 22:58:44 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCVGs40QBZIB/PfkkQGjhB9nNwbC6szViKBKZbD4ssk5eDDBBXi3L3W4/xnS+CNzjZjseBDW6soqOFMTzUp7VUdlpLWOvvbqW0ZFKRdKAlITp0zIzzXEvie/kSq/k6NkaBf6OdKxreuobIT8w8amTZSCylrDZGsgpRAWKCv71MuBaILpYLuGNeYdwkdOxsXiYxfVtPa8bI5CAYATcitzsm3j/RHzXjMf4iji5mNgAR5szw/iLTWEEcWbap/JJliBi3QrUH7tvtUbTbs3RFX4LodEpXF6ygmvVoaQoCqNkwGQnB0363KLrjutPDGK40bX7dAAlpTNKgGjtCfvquUCTFm68Z2xoH1j7VP1PHDltFnZHpxTBM83/CC7WOknxgF/MyMQcXhQhV1+YxbZHTKlK7gAQ4FDgtA3IYk3wawkOvOwVNj3azwgzD7w3xun3mqkX0Y7T5/3Of98pM32Q7DbHnzvqnVrejo0j6//MVmoXE/iL1MIJK2aVoMuqo4uYSLbi9+sosQGzqLwFGo= Received: from wheely.local0.net ([1.146.53.155]) by smtp.gmail.com with ESMTPSA id d18-20020a170903209200b001d948adc19fsm905734plc.46.2024.02.01.22.58.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 22:58:43 -0800 (PST) From: Nicholas Piggin To: Thomas Huth Cc: Nicholas Piggin , kvm@vger.kernel.org, Laurent Vivier , "Shaoqin Huang" , Andrew Jones , Nico Boehr , Paolo Bonzini , Alexandru Elisei , Eric Auger , Janosch Frank , Claudio Imbrenda , David Hildenbrand , Marc Hartmayer , linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, kvmarm@lists.linux.dev Subject: [kvm-unit-tests PATCH v2 5/9] migration: Support multiple migrations Date: Fri, 2 Feb 2024 16:57:36 +1000 Message-ID: <20240202065740.68643-6-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240202065740.68643-1-npiggin@gmail.com> References: <20240202065740.68643-1-npiggin@gmail.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Support multiple migrations by flipping dest file/socket variables to source after the migration is complete, ready to start again. A new destination is created if the test outputs the migrate line again. Test cases may now switch to calling migrate() one or more times. Signed-off-by: Nicholas Piggin --- lib/migrate.c | 8 ++-- lib/migrate.h | 1 + scripts/arch-run.bash | 93 +++++++++++++++++++++++++++++++++++++------ 3 files changed, 85 insertions(+), 17 deletions(-) diff --git a/lib/migrate.c b/lib/migrate.c index 527e63ae..b7721659 100644 --- a/lib/migrate.c +++ b/lib/migrate.c @@ -8,8 +8,10 @@ #include #include "migrate.h" -/* static for now since we only support migrating exactly once per test. */ -static void migrate(void) +/* + * Initiate migration and wait for it to complete. + */ +void migrate(void) { puts("Now migrate the VM, then press a key to continue...\n"); (void)getchar(); @@ -19,8 +21,6 @@ static void migrate(void) /* * Initiate migration and wait for it to complete. * If this function is called more than once, it is a no-op. - * Since migrate_cmd can only migrate exactly once this function can - * simplify the control flow, especially when skipping tests. */ void migrate_once(void) { diff --git a/lib/migrate.h b/lib/migrate.h index 3c94e6af..2af06a72 100644 --- a/lib/migrate.h +++ b/lib/migrate.h @@ -6,4 +6,5 @@ * Author: Nico Boehr */ +void migrate(void); void migrate_once(void); diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash index 8fbfc50c..1ea0f8bc 100644 --- a/scripts/arch-run.bash +++ b/scripts/arch-run.bash @@ -132,29 +132,76 @@ run_migration () migsock=$(mktemp -u -t mig-helper-socket.XXXXXXXXXX) migout1=$(mktemp -t mig-helper-stdout1.XXXXXXXXXX) migout_fifo1=$(mktemp -u -t mig-helper-fifo-stdout1.XXXXXXXXXX) + migout2=$(mktemp -t mig-helper-stdout2.XXXXXXXXXX) + migout_fifo2=$(mktemp -u -t mig-helper-fifo-stdout2.XXXXXXXXXX) qmp1=$(mktemp -u -t mig-helper-qmp1.XXXXXXXXXX) qmp2=$(mktemp -u -t mig-helper-qmp2.XXXXXXXXXX) fifo=$(mktemp -u -t mig-helper-fifo.XXXXXXXXXX) # race here between file creation and trap trap "trap - TERM ; kill 0 ; exit 2" INT TERM - trap "rm -f ${migout1} ${migsock} ${qmp1} ${qmp2} ${fifo}" RETURN EXIT + trap "rm -f ${migout1} ${migout2} ${migout_fifo1} ${migout_fifo2} ${migsock} ${qmp1} ${qmp2} ${fifo}" RETURN EXIT qmpout1=/dev/null qmpout2=/dev/null + migcmdline=$@ - eval "$@" -chardev socket,id=mon1,path=${qmp1},server=on,wait=off \ + mkfifo ${migout_fifo1} + mkfifo ${migout_fifo2} + + eval "$migcmdline" \ + -chardev socket,id=mon1,path=${qmp1},server=on,wait=off \ -mon chardev=mon1,mode=control > ${migout_fifo1} & live_pid=$! cat ${migout_fifo1} | tee ${migout1} & - # 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... + # The test must prompt the user to migrate, so wait for the "migrate" + # keyword + while ! grep -q -i "Now migrate the VM" < ${migout1} ; do + if ! ps -p ${live_pid} > /dev/null ; then + echo "ERROR: Test exit before migration point." >&2 + qmp ${qmp1} '"quit"'> ${qmpout1} 2>/dev/null + return 3 + fi + sleep 0.1 + done + + # This starts the first source QEMU in advance of the test reaching the + # migration point, since we expect at least one migration. Subsequent + # sources are started as the test hits migrate keywords. + do_migration || return $? + + while ps -p ${live_pid} > /dev/null ; do + # Wait for EXIT or further migrations + if ! grep -q -i "Now migrate the VM" < ${migout1} ; then + sleep 0.1 + else + do_migration || return $? + fi + done + + wait ${live_pid} + ret=$? + + while (( $(jobs -r | wc -l) > 0 )); do + sleep 0.1 + done + + return $ret +} + +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 ${fifo} - eval "$@" -chardev socket,id=mon2,path=${qmp2},server=on,wait=off \ - -mon chardev=mon2,mode=control -incoming unix:${migsock} < <(cat ${fifo}) & + eval "$migcmdline" \ + -chardev socket,id=mon2,path=${qmp2},server=on,wait=off \ + -mon chardev=mon2,mode=control -incoming unix:${migsock} \ + < <(cat ${fifo}) > ${migout_fifo2} & incoming_pid=$! + cat ${migout_fifo2} | tee ${migout2} & # The test must prompt the user to migrate, so wait for the "migrate" keyword while ! grep -q -i "Now migrate the VM" < ${migout1} ; do @@ -165,7 +212,7 @@ run_migration () qmp ${qmp2} '"quit"'> ${qmpout2} 2>/dev/null return 3 fi - sleep 1 + sleep 0.1 done # Wait until the destination has created the incoming and qmp sockets @@ -177,7 +224,7 @@ run_migration () # Wait for the migration to complete migstatus=`qmp ${qmp1} '"query-migrate"' | grep return` while ! grep -q '"completed"' <<<"$migstatus" ; do - sleep 1 + sleep 0.1 if ! migstatus=`qmp ${qmp1} '"query-migrate"'`; then echo "ERROR: Querying migration state failed." >&2 echo > ${fifo} @@ -193,14 +240,34 @@ run_migration () return 2 fi done + qmp ${qmp1} '"quit"'> ${qmpout1} 2>/dev/null + + # keypress to dst so getchar completes and test continues echo > ${fifo} - wait $incoming_pid + rm ${fifo} + + # Ensure the incoming socket is removed, ready for next destination + if [ -S ${migsock} ] ; then + echo "ERROR: Incoming migration socket not removed after migration." >& 2 + qmp ${qmp2} '"quit"'> ${qmpout2} 2>/dev/null + return 2 + fi + + wait ${live_pid} ret=$? - while (( $(jobs -r | wc -l) > 0 )); do - sleep 0.5 - done + # Now flip the variables because dest becomes source + live_pid=${incoming_pid} + tmp=${migout1} + migout1=${migout2} + migout2=${tmp} + tmp=${migout_fifo1} + migout_fifo1=${migout_fifo2} + migout_fifo2=${tmp} + tmp=${qmp1} + qmp1=${qmp2} + qmp2=${tmp} return $ret } From patchwork Fri Feb 2 06:57:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 13542210 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 492BF182A7; Fri, 2 Feb 2024 06:58:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706857134; cv=none; b=d6mq732dhwzm0HTO9qu/1VwbI+TtDs4RqlZfr/y+HfgzPcV/MM7bTGBvfT8r9nVVUTIgmrAuV5ctA/OYZ+N3tZHRLpj0nabrlakuuwp2kNpTL/lcLb6XW4Eit6Cj8Vyj39XG/9FkAGQpUDnB7xqbY3fGKdyej3WpUpb5MW14ycg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706857134; c=relaxed/simple; bh=k/P3mR8fsIYxfqTmx4AUyrHMn1pKj7edNiwO+rhP/4U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=exTmyp2PWI0xDnMmdwtZr91ja+NKjLD05tQ9RqxO9x7C/qq78uDKUApsVqcPo5YLIhZyRVfTmu5jihCUoMlJtfzGQDQLQdqo+nwthCirUwhuxhkXitjv2b8qpBNA98Jno7Bl7zgOxzMbnPyc9So13BEFhFSZGMZrINe1eJ8QTKc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZO04/Fp7; arc=none smtp.client-ip=209.85.214.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZO04/Fp7" Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1d780a392fdso14973975ad.3; Thu, 01 Feb 2024 22:58:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706857132; x=1707461932; darn=vger.kernel.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=fSBY/qUR3vEv/4J5fGD2VKLCaKXAp4kdXbDH3R5DRjk=; b=ZO04/Fp7jTOYnqotKUZyTpRG2DvFmKnqD1FrHj2SMtXG2gWDWyfQckMunINDr6efKN BQ1hE9o4JrDt/sUx6HatyPWWBTghIu8Sod2t39eDRJ4RRJYpKdvZaSPqfcJ0IgaBceHY RQykVVkAvl33lLrVU3irZsQJzRy9aYehWz9RwI65uhmP8ExT9In3ok8brPMZqhBoC7XF 3F0rCG1t8XFNu8omeZnx69gD9nMfDCa8OHft5Gl/Z++9XgTrUWF/Fupxr3MBNzC+Y7+r 4mjsGuMrHaCxpRtO2NDK3gM4csbgwZUONxworNCkfGJAFnHmvr9Al1NM+ezxfOPDUATi Brgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706857132; x=1707461932; 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=fSBY/qUR3vEv/4J5fGD2VKLCaKXAp4kdXbDH3R5DRjk=; b=AlfsD4zEpTjYad5CWVCGSKlQlWqePQPxX+h7HaABCiVjNEIxpVUbQxyQ8wCpD2cNkF T39bKqsN5Fbj+gz3ldlqO2PLn66qi7Eql+Kfa7NuPY7SPJ923KWJ6a7GtLSyGCfpcePt RZ89LpmrwaoJNNa8DlEEeeQJfeYSo/W7rgaQHcKrXJvCwXdx3dBIT4amLUFe+9HRSL7I +In+e3z0ju/pyq7JKQ4BZmbueng0R7bbQ8EUZfEt6qKKnNgneF1FciXeFDn1jMXNnter 5ng/hGvSv9C0j52KjM/m2JdTqmZu8naBl99l+9j2+HXQhPdhdL/UJhowMEqq6Uq04b9V DeoQ== X-Gm-Message-State: AOJu0YyXpeqDzFVS7TKN+LKafLOpFvVzrHfURANvavh2Z3Y8NLwcOiFc i7ePyHQcGWHweVdmAPTuwPrU25WE0V4CRsViCwXgdNuLkaWcXPak X-Google-Smtp-Source: AGHT+IGGWkPpz9cV+EqJznvJjULk/Kf3RcDOGkpaaivKSaza5AuYnVyC7UlPmSNta4kkSAyCE2hL7w== X-Received: by 2002:a17:902:f807:b0:1d8:cda6:7ed0 with SMTP id ix7-20020a170902f80700b001d8cda67ed0mr3751650plb.59.1706857132599; Thu, 01 Feb 2024 22:58:52 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCWPJuGCnjBjriAPBKYD/3la8s9SF0GNZmQhuTi4oGje0EqvGe991nJDa7WAr6cANvY8FPwcs0OC8ql+ygmQkAHSnysMxDYXxrNd4qV7sceYT8SxGULB/MPFHFxSFeKbwRKDR0P6eMrg/1WotJ6ph6aRHP43SkeoB2zAFIe6ur4ZmaZU5vwJw1YsdBA12p4+RcwdOISurqTGwcc+czNFCVJfy9uZ/cckNoIWoSq97IyW7aDv+36iBFHLC1YmKW3d3FAPiak+CoKcbvvcHBfhjjql8rJwq0peYKbIPd5uopOVkw2GaFIeDagnYdxwESRog044MC9FUVa1fMw0KMYK+NxEir0l7sWuj5BFRMw8897j3MPsmvkaEGjsN2gvOLgCoMsSFBHKHiTMiqa5ILmKXC7VAoBe822BA2XhBWzwYATv8wFJRR1ZV/nCufn83p35DSBI08qjQaNr3FVHSG3WvuSBN4lzpAOOl0I6/pHGWof7xS39HDZ5GPeObntRDXiafRLamzQEpzrO9eg= Received: from wheely.local0.net ([1.146.53.155]) by smtp.gmail.com with ESMTPSA id d18-20020a170903209200b001d948adc19fsm905734plc.46.2024.02.01.22.58.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 22:58:52 -0800 (PST) From: Nicholas Piggin To: Thomas Huth Cc: Nicholas Piggin , kvm@vger.kernel.org, Laurent Vivier , "Shaoqin Huang" , Andrew Jones , Nico Boehr , Paolo Bonzini , Alexandru Elisei , Eric Auger , Janosch Frank , Claudio Imbrenda , David Hildenbrand , Marc Hartmayer , linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, kvmarm@lists.linux.dev Subject: [kvm-unit-tests PATCH v2 6/9] arch-run: rename migration variables Date: Fri, 2 Feb 2024 16:57:37 +1000 Message-ID: <20240202065740.68643-7-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240202065740.68643-1-npiggin@gmail.com> References: <20240202065740.68643-1-npiggin@gmail.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Using 1 and 2 for source and destination is confusing, particularly now with multiple migrations that flip between them. Do a rename pass to tidy things up. Signed-off-by: Nicholas Piggin --- scripts/arch-run.bash | 112 +++++++++++++++++++++--------------------- 1 file changed, 57 insertions(+), 55 deletions(-) diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash index 1ea0f8bc..0feaa190 100644 --- a/scripts/arch-run.bash +++ b/scripts/arch-run.bash @@ -129,38 +129,39 @@ run_migration () return 77 fi - migsock=$(mktemp -u -t mig-helper-socket.XXXXXXXXXX) - migout1=$(mktemp -t mig-helper-stdout1.XXXXXXXXXX) - migout_fifo1=$(mktemp -u -t mig-helper-fifo-stdout1.XXXXXXXXXX) - migout2=$(mktemp -t mig-helper-stdout2.XXXXXXXXXX) - migout_fifo2=$(mktemp -u -t mig-helper-fifo-stdout2.XXXXXXXXXX) - qmp1=$(mktemp -u -t mig-helper-qmp1.XXXXXXXXXX) - qmp2=$(mktemp -u -t mig-helper-qmp2.XXXXXXXXXX) - fifo=$(mktemp -u -t mig-helper-fifo.XXXXXXXXXX) + dst_incoming=$(mktemp -u -t mig-helper-socket-incoming.XXXXXXXXXX) + src_out=$(mktemp -t mig-helper-stdout1.XXXXXXXXXX) + src_outfifo=$(mktemp -u -t mig-helper-fifo-stdout1.XXXXXXXXXX) + dst_out=$(mktemp -t mig-helper-stdout2.XXXXXXXXXX) + 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) # race here between file creation and trap trap "trap - TERM ; kill 0 ; exit 2" INT TERM - trap "rm -f ${migout1} ${migout2} ${migout_fifo1} ${migout_fifo2} ${migsock} ${qmp1} ${qmp2} ${fifo}" RETURN EXIT + trap "rm -f ${src_out} ${dst_out} ${src_outfifo} ${dst_outfifo} ${dst_incoming} ${src_qmp} ${dst_qmp} ${dst_infifo}" RETURN EXIT + + src_qmpout=/dev/null + dst_qmpout=/dev/null - qmpout1=/dev/null - qmpout2=/dev/null migcmdline=$@ - mkfifo ${migout_fifo1} - mkfifo ${migout_fifo2} + mkfifo ${src_outfifo} + mkfifo ${dst_outfifo} eval "$migcmdline" \ - -chardev socket,id=mon1,path=${qmp1},server=on,wait=off \ - -mon chardev=mon1,mode=control > ${migout_fifo1} & + -chardev socket,id=mon,path=${src_qmp},server=on,wait=off \ + -mon chardev=mon,mode=control > ${src_outfifo} & live_pid=$! - cat ${migout_fifo1} | tee ${migout1} & + cat ${src_outfifo} | tee ${src_out} & # The test must prompt the user to migrate, so wait for the "migrate" # keyword - while ! grep -q -i "Now migrate the VM" < ${migout1} ; do + while ! grep -q -i "Now migrate the VM" < ${src_out} ; do if ! ps -p ${live_pid} > /dev/null ; then echo "ERROR: Test exit before migration point." >&2 - qmp ${qmp1} '"quit"'> ${qmpout1} 2>/dev/null + qmp ${src_qmp} '"quit"'> ${src_qmpout} 2>/dev/null return 3 fi sleep 0.1 @@ -173,7 +174,7 @@ run_migration () while ps -p ${live_pid} > /dev/null ; do # Wait for EXIT or further migrations - if ! grep -q -i "Now migrate the VM" < ${migout1} ; then + if ! grep -q -i "Now migrate the VM" < ${src_out} ; then sleep 0.1 else do_migration || return $? @@ -195,79 +196,80 @@ 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 ${fifo} + mkfifo ${dst_infifo} eval "$migcmdline" \ - -chardev socket,id=mon2,path=${qmp2},server=on,wait=off \ - -mon chardev=mon2,mode=control -incoming unix:${migsock} \ - < <(cat ${fifo}) > ${migout_fifo2} & + -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} & incoming_pid=$! - cat ${migout_fifo2} | tee ${migout2} & + cat ${dst_outfifo} | tee ${dst_out} & # The test must prompt the user to migrate, so wait for the "migrate" keyword - while ! grep -q -i "Now migrate the VM" < ${migout1} ; do + while ! grep -q -i "Now migrate the VM" < ${src_out} ; do if ! ps -p ${live_pid} > /dev/null ; then echo "ERROR: Test exit before migration point." >&2 - echo > ${fifo} - qmp ${qmp1} '"quit"'> ${qmpout1} 2>/dev/null - qmp ${qmp2} '"quit"'> ${qmpout2} 2>/dev/null + echo > ${dst_infifo} + qmp ${src_qmp} '"quit"'> ${src_qmpout} 2>/dev/null + qmp ${dst_qmp} '"quit"'> ${dst_qmpout} 2>/dev/null return 3 fi sleep 0.1 done # Wait until the destination has created the incoming and qmp sockets - while ! [ -S ${migsock} ] ; do sleep 0.1 ; done - while ! [ -S ${qmp2} ] ; do sleep 0.1 ; done + while ! [ -S ${dst_incoming} ] ; do sleep 0.1 ; done + while ! [ -S ${dst_qmp} ] ; do sleep 0.1 ; done - qmp ${qmp1} '"migrate", "arguments": { "uri": "unix:'${migsock}'" }' > ${qmpout1} + qmp ${src_qmp} '"migrate", "arguments": { "uri": "unix:'${dst_incoming}'" }' > ${src_qmpout} # Wait for the migration to complete - migstatus=`qmp ${qmp1} '"query-migrate"' | grep return` + migstatus=`qmp ${src_qmp} '"query-migrate"' | grep return` while ! grep -q '"completed"' <<<"$migstatus" ; do sleep 0.1 - if ! migstatus=`qmp ${qmp1} '"query-migrate"'`; then + if ! migstatus=`qmp ${src_qmp} '"query-migrate"'`; then echo "ERROR: Querying migration state failed." >&2 - echo > ${fifo} - qmp ${qmp2} '"quit"'> ${qmpout2} 2>/dev/null + echo > ${dst_infifo} + qmp ${dst_qmp} '"quit"'> ${dst_qmpout} 2>/dev/null return 2 fi migstatus=`grep return <<<"$migstatus"` if grep -q '"failed"' <<<"$migstatus"; then echo "ERROR: Migration failed." >&2 - echo > ${fifo} - qmp ${qmp1} '"quit"'> ${qmpout1} 2>/dev/null - qmp ${qmp2} '"quit"'> ${qmpout2} 2>/dev/null + echo > ${dst_infifo} + qmp ${src_qmp} '"quit"'> ${src_qmpout} 2>/dev/null + qmp ${dst_qmp} '"quit"'> ${dst_qmpout} 2>/dev/null return 2 fi done - qmp ${qmp1} '"quit"'> ${qmpout1} 2>/dev/null + qmp ${src_qmp} '"quit"'> ${src_qmpout} 2>/dev/null # keypress to dst so getchar completes and test continues - echo > ${fifo} - rm ${fifo} + echo > ${dst_infifo} + rm ${dst_infifo} # Ensure the incoming socket is removed, ready for next destination - if [ -S ${migsock} ] ; then + if [ -S ${dst_incoming} ] ; then echo "ERROR: Incoming migration socket not removed after migration." >& 2 - qmp ${qmp2} '"quit"'> ${qmpout2} 2>/dev/null + qmp ${dst_qmp} '"quit"'> ${dst_qmpout} 2>/dev/null return 2 fi wait ${live_pid} ret=$? - # Now flip the variables because dest becomes source + # Now flip the variables because destination machine becomes source + # for the next migration. live_pid=${incoming_pid} - tmp=${migout1} - migout1=${migout2} - migout2=${tmp} - tmp=${migout_fifo1} - migout_fifo1=${migout_fifo2} - migout_fifo2=${tmp} - tmp=${qmp1} - qmp1=${qmp2} - qmp2=${tmp} + tmp=${src_out} + src_out=${dst_out} + dst_out=${tmp} + tmp=${src_outfifo} + src_outfifo=${dst_outfifo} + dst_outfifo=${tmp} + tmp=${src_qmp} + src_qmp=${dst_qmp} + dst_qmp=${tmp} return $ret } @@ -290,8 +292,8 @@ run_panic () trap "rm -f ${qmp}" RETURN EXIT # start VM stopped so we don't miss any events - eval "$@" -chardev socket,id=mon1,path=${qmp},server=on,wait=off \ - -mon chardev=mon1,mode=control -S & + eval "$@" -chardev socket,id=mon,path=${qmp},server=on,wait=off \ + -mon chardev=mon,mode=control -S & panic_event_count=$(qmp_events ${qmp} | jq -c 'select(.event == "GUEST_PANICKED")' | wc -l) if [ "$panic_event_count" -lt 1 ]; then From patchwork Fri Feb 2 06:57:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 13542211 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C8110182B9; Fri, 2 Feb 2024 06:59:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706857144; cv=none; b=uHxDiSYZUEZzYE077UlmKoaZ9leNWyQQWTKTYII+5S7OtDFU+MDVn/8L//wb0/OIcMAwftjzWgekF2iA1BBvZ4ry0MX0YVcKqb3Z3Sfjum/fiumqzqInaCxl1GmHLMcRKUish6Nxx9QacojF2IJGoMbntrymz/0pcrXiGfNwYTM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706857144; c=relaxed/simple; bh=2beTdUj4YXNqigb6jUTF4KkxHyvHbagk5SI7K1z8HW0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YDO4gojNJjJfIfMju16pviCw7qcAOeAW5VGiBaY0pgrQesMfD1anlAW9RRYO6kUJdelA747A3pfuKbSpgUHROkMcBg8YknrpKlzRdHyxGxMS5ZpH84HW3huZKgX/dDVNGy0CALJ2qwkIXM1HluPmukC+yUc3DHnmI2MPClmqfNU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=D+H37xl6; arc=none smtp.client-ip=209.85.214.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="D+H37xl6" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1d7858a469aso13496465ad.2; Thu, 01 Feb 2024 22:59:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706857142; x=1707461942; darn=vger.kernel.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=AcbZ3b72z5JTsiEYQiD8/BwtKqeQBzzGW/MZj7+sxQo=; b=D+H37xl6WXQcYsA4x9f26iEE4XQx4I7jkX7gIa5jnr/POMecNkuB9Cr/03kqtdlJL+ PDwyC0vFsVOBrJwuhqWD5F17bmIiCY3jcEXl9syLQ7JBMORqOxe4fIao9wPDsqETscwz MF8Kaw8JBXLhTL1nKtUGBUg5ekMURjXKCjhHKWN3svuO0hCNMN6lz0MwYjo1RDhepD/w KIDI9H1MqYKcBu7By5+3tCVIPHK/yPTFUnZj81lamvfTcE2KXwOrJYy+H9rxJ04pCJmP m3JIYCgeS9CZycY3krJXbedBgTUzsMnsbUOnY6shPQtL9xf1DTajIv87XtBSVHsgo9Lb Gn4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706857142; x=1707461942; 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=AcbZ3b72z5JTsiEYQiD8/BwtKqeQBzzGW/MZj7+sxQo=; b=Q+tW3S1HDqhtYVNI1vFuHbeuSbqLFV9Itgbh4tBsfbeTaWD2rZSXR9YjrdKxxlZGAo G8hXt91xRCwzb6pldVTZVWQ9JHgEv+j3NB9ZX1btRV/ynI837ga0spfIALo5w8X3xvlF jtC8BdEW+09NnEI90JmMxRJjOxFc6A80C+6qgLhoNuCqDLlsQvILSDr6lzvYKmqQf7hQ 9Vxynued54k4NYA7uknZ8k60nQ2De4P1CNcJpfNXppL4tajx7tGVuxFdk68eJKdHaCU0 GUOHbgMKVdkJjoyJ74/3IZh92QLHVY9a6Zy7qujE90mfDYDigG+Kf2aex8pD3NUDPAsK c6oQ== X-Gm-Message-State: AOJu0YwDv5aQ9I/DJvIrFDMgatdgy6yn1dfl+E5Osvsd/7FXwMr3R9eI oI6vopMPDGoxe6yTXFlsAHAcuIkXON/yI2U2D47wWGZ4S+bn57Ar X-Google-Smtp-Source: AGHT+IFs+IN8kqrNAOK7L1kdhKg2x+fFZzGf5XMf2+FBY9Nbg8lXWJKa6GZTbVG9lE7J4tad2sbYug== X-Received: by 2002:a17:902:ce8c:b0:1d9:7412:834 with SMTP id f12-20020a170902ce8c00b001d974120834mr719999plg.8.1706857141947; Thu, 01 Feb 2024 22:59:01 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCWSPDjupVheTRpWjNG3qQOcVOPZJWHEhIlPhxS7xEOECZT/j+hA5vA7EhckWrkOUVp1YN/gMV83pWB6BlPQnN464jm5KGO0FaR/AV/72oUiwHzfmmMXB6AfWsXAYGreRlgFfBq4q4v6indtcbkufNSdGjsgqswIjC9s7nUFqPjexotrw7C85wdEReHZ4i4Hc+8/N4m44m9fAMAT3yAWTKAuRw+HxNNdwwHUbfL06hssswrFRRGhvZqesWG9HRgrSFM5+hbwwelX/CD22eTA4iFEQsrzWQ1WCRHt1Rl3QDWgENNcYBjqIAfOAr+7Nw+VVm+kmHyXa61hG/SGbSzt47XfF81ZEZIU4/dt0kycXB3YA5i/hltb8mlyQhIfojSw8EiSEAX/hczMK1BJxR1JblUApaYd1Yu1trsAUfTu5Efg2L8YNp3UnHiMD9WXpZJcE6f79A5grOoZGB/t1Fq41wpCqsWUsrcSembgQLmQNRqA2UZytjtZI/hxLRLhl13CTJQgHhr2cqx8R6E= Received: from wheely.local0.net ([1.146.53.155]) by smtp.gmail.com with ESMTPSA id d18-20020a170903209200b001d948adc19fsm905734plc.46.2024.02.01.22.58.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 22:59:01 -0800 (PST) From: Nicholas Piggin To: Thomas Huth Cc: Nicholas Piggin , kvm@vger.kernel.org, Laurent Vivier , "Shaoqin Huang" , Andrew Jones , Nico Boehr , Paolo Bonzini , Alexandru Elisei , Eric Auger , Janosch Frank , Claudio Imbrenda , David Hildenbrand , Marc Hartmayer , linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, kvmarm@lists.linux.dev Subject: [kvm-unit-tests PATCH v2 7/9] migration: Add quiet migration support Date: Fri, 2 Feb 2024 16:57:38 +1000 Message-ID: <20240202065740.68643-8-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240202065740.68643-1-npiggin@gmail.com> References: <20240202065740.68643-1-npiggin@gmail.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Console output required to support migration becomes quite noisy when doing lots of migrations. Provide a migrate_quiet() call that suppresses console output and doesn't log a message. Signed-off-by: Nicholas Piggin --- lib/migrate.c | 12 ++++++++++++ lib/migrate.h | 1 + scripts/arch-run.bash | 4 ++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/migrate.c b/lib/migrate.c index b7721659..4e0ab516 100644 --- a/lib/migrate.c +++ b/lib/migrate.c @@ -18,6 +18,18 @@ void migrate(void) report_info("Migration complete"); } +/* + * Like migrate() but supporess output and logs, useful for intensive + * migration stress testing without polluting logs. Test cases should + * provide relevant information about migration in failure reports. + */ +void migrate_quiet(void) +{ + puts("Now migrate the VM (quiet)\n"); + (void)getchar(); +} + + /* * Initiate migration and wait for it to complete. * If this function is called more than once, it is a no-op. diff --git a/lib/migrate.h b/lib/migrate.h index 2af06a72..95b9102b 100644 --- a/lib/migrate.h +++ b/lib/migrate.h @@ -7,4 +7,5 @@ */ void migrate(void); +void migrate_quiet(void); void migrate_once(void); diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash index 0feaa190..5810f9a1 100644 --- a/scripts/arch-run.bash +++ b/scripts/arch-run.bash @@ -154,7 +154,7 @@ run_migration () -chardev socket,id=mon,path=${src_qmp},server=on,wait=off \ -mon chardev=mon,mode=control > ${src_outfifo} & live_pid=$! - cat ${src_outfifo} | tee ${src_out} & + cat ${src_outfifo} | tee ${src_out} | grep -v "Now migrate the VM (quiet)" & # The test must prompt the user to migrate, so wait for the "migrate" # keyword @@ -202,7 +202,7 @@ do_migration () -mon chardev=mon,mode=control -incoming unix:${dst_incoming} \ < <(cat ${dst_infifo}) > ${dst_outfifo} & incoming_pid=$! - cat ${dst_outfifo} | tee ${dst_out} & + cat ${dst_outfifo} | tee ${dst_out} | grep -v "Now migrate the VM (quiet)" & # The test must prompt the user to migrate, so wait for the "migrate" keyword while ! grep -q -i "Now migrate the VM" < ${src_out} ; do From patchwork Fri Feb 2 06:57:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 13542212 Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 03D8818633; Fri, 2 Feb 2024 06:59:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706857152; cv=none; b=YCFxfUJOZLIbusBXXnemMHaZNbPhFBHySlvCJC4KDstiqTTyPfs0a5LexM2oAq9qc6AcWWr0Iu9tsXt9z2k9hKNabUdUtdCEN0HbDIHtVHO8ba9m0hs+5YRGMhBGtbvHYlEfE+t+UI5vkPksobU7O38OmbbSzPI7GB8Pi+j9dXo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706857152; c=relaxed/simple; bh=6JbG9et4ggNViHk+xpnp84ZGRBT58T7v98W3F6J80+o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sQLYp/q6Fm5dD4SISicFOl1Iy16tKCEzn2i4mwLZ9wqSaxAuaX3ESEY4ozoPzkTHKJQOYrAHmn3LhopUav+ZobM61+esTTO0jtsbXn2BLlg2qN0bnHj+PxcpVdUU/ZvE5hGh0tOmK4uKAly6XinSfzKCiFCZBwMpwapVba1ZlTs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MdPPs7wn; arc=none smtp.client-ip=209.85.215.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MdPPs7wn" Received: by mail-pg1-f172.google.com with SMTP id 41be03b00d2f7-5c229dabbb6so1109599a12.0; Thu, 01 Feb 2024 22:59:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706857150; x=1707461950; darn=vger.kernel.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=2A8b0YOIg6lGChxKQRkSufzy4suZ23mRhNBzFJEEdSM=; b=MdPPs7wnGcwVQaczChjld4M5qdezWMBJaNJmIRz9q/HWczQ8mnAtAq38Kxv24Xtdub WebusI/3P4mDjNxsTl0DG3hxibf1J0dR71ztkDgKWkn+SB55XK+84zH/zglCNnuTvXq2 izjva+zcevqFmN9bg2RCPk3DNA+wlamRxmtjXCYsW6nEqwqYCl25eYtxcz3iJd7Y2KjO 1hllkFiqdSJTMev15x86y9x7v5H5D6rrCImGVpYTD82HLoIz4b8cuUL+QELGvKCTOr+9 NKnkD8VmGwug/4O3C/yby4U7e6Gvs439HstWcRgUm8XVCPc1izlE/HITN7/DybxFHuA8 ircA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706857150; x=1707461950; 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=2A8b0YOIg6lGChxKQRkSufzy4suZ23mRhNBzFJEEdSM=; b=v+zanfytUrh9LUBQHDqVY8Z1yubOJjTBkiJUN74iOc9jvuI0Or6BhCu8SjW695KdRC uP4vSU2ky921ki4w6nKT2d1Q/v2WSNSi9G5+5bZm/9BLZzq5tD/ODGKRFtegVYWrrlr5 BuudCsME6Tv5hACKsy7GezdPhFE23TnXAcLXIAXBqkKaSr5x5/ZX87/nd4XxAXTmnABC LWfoaTURRaQfQVTP0fgXC8oiHuh1Ij3F+W/cqXeEHzrPGv7YOP2GxRQBtbfnZaTqFzxZ HFI7hu8R9qkxuYBgvi5drs4NUtB/C4xkPSJgUg+SIVNoj3znNqPxYNq8jfxAVci13S9E 73Xw== X-Gm-Message-State: AOJu0YwByqbxaWKZvohTi6d+L8xFqfkMj8X84bWIrR+c/UBzARsitm9J oDOJh7k/8npNkB9MCfrF5HUr0o9X116HJCiFgPe8symePI65acIN X-Google-Smtp-Source: AGHT+IEFt7kfJGu61jZUZZl3OY3s2dKrBdsO6NiQuZ9E3dIRck/n/RDkAL+FrMyrpMKk6m8nizxRPw== X-Received: by 2002:a17:902:7c97:b0:1d8:fae3:2216 with SMTP id y23-20020a1709027c9700b001d8fae32216mr5679839pll.35.1706857150341; Thu, 01 Feb 2024 22:59:10 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCUYncYvmvYyn1bIo4nQyp/+E/FnRz/SeAmt64eUXq2CiSJIqXGaPkB7FxwGpzIlNiEzEzB+LkGRAgVN2ozGXSgcLqCVtAOixnufvjh5CF4R7/qutE1ZgrgE8KPEDt4fEwlzL5vi4cWxKE2403WAfOQvf2qfTnsOZzjq6Bmn0UG5URuvkXMko5RrllOPDZ6rWDnfJe/g/oThk6+GyqcslLMVeLxnrFBw8vNdmX7qajZ8/TLHzwe4MC82JvQe07k0oMntr18YdbhE4iIh2XZVXmUOqvb/OUVvkCBThcjEti0ruRHPUECZ6k6xtj42LMpSwYOklQ9yQrKG5eg1EI/PkK11hDlHCljnGJcrbLlaaeWFCOQqUIS36VObLTPRw2jRtK0FVwVPAm9AWYvxfHOoGpAtpmnBkf8oFFpaUF//HU8VfpLXiNqo3RpxpdXdPQIsTmbOtlx+UbGTdVN/GI9VfcohRq7mEAffaqJs/ZAwZ5xRv1zdOrnEkFhJGpUJORVnhWanLA8LXQ7azRg= Received: from wheely.local0.net ([1.146.53.155]) by smtp.gmail.com with ESMTPSA id d18-20020a170903209200b001d948adc19fsm905734plc.46.2024.02.01.22.59.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 22:59:10 -0800 (PST) From: Nicholas Piggin To: Thomas Huth Cc: Nicholas Piggin , kvm@vger.kernel.org, Laurent Vivier , "Shaoqin Huang" , Andrew Jones , Nico Boehr , Paolo Bonzini , Alexandru Elisei , Eric Auger , Janosch Frank , Claudio Imbrenda , David Hildenbrand , Marc Hartmayer , linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, kvmarm@lists.linux.dev Subject: [kvm-unit-tests PATCH v2 8/9] Add common/ directory for architecture-independent tests Date: Fri, 2 Feb 2024 16:57:39 +1000 Message-ID: <20240202065740.68643-9-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240202065740.68643-1-npiggin@gmail.com> References: <20240202065740.68643-1-npiggin@gmail.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 x86/sieve.c is used by s390x and arm via symbolic link. Make a new directory common/ for architecture-independent tests and move sieve.c here. Signed-off-by: Nicholas Piggin --- arm/sieve.c | 2 +- common/sieve.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ s390x/sieve.c | 2 +- x86/sieve.c | 52 +------------------------------------------------- 4 files changed, 54 insertions(+), 53 deletions(-) create mode 100644 common/sieve.c mode change 100644 => 120000 x86/sieve.c diff --git a/arm/sieve.c b/arm/sieve.c index 8f14a5c3..fe299f30 120000 --- a/arm/sieve.c +++ b/arm/sieve.c @@ -1 +1 @@ -../x86/sieve.c \ No newline at end of file +../common/sieve.c \ No newline at end of file diff --git a/common/sieve.c b/common/sieve.c new file mode 100644 index 00000000..8150f2d9 --- /dev/null +++ b/common/sieve.c @@ -0,0 +1,51 @@ +#include "alloc.h" +#include "libcflat.h" + +static int sieve(char* data, int size) +{ + int i, j, r = 0; + + for (i = 0; i < size; ++i) + data[i] = 1; + + data[0] = data[1] = 0; + + for (i = 2; i < size; ++i) + if (data[i]) { + ++r; + for (j = i*2; j < size; j += i) + data[j] = 0; + } + return r; +} + +static void test_sieve(const char *msg, char *data, int size) +{ + int r; + + printf("%s:", msg); + r = sieve(data, size); + printf("%d out of %d\n", r, size); +} + +#define STATIC_SIZE 1000000 +#define VSIZE 100000000 +char static_data[STATIC_SIZE]; + +int main(void) +{ + void *v; + int i; + + printf("starting sieve\n"); + test_sieve("static", static_data, STATIC_SIZE); + setup_vm(); + test_sieve("mapped", static_data, STATIC_SIZE); + for (i = 0; i < 3; ++i) { + v = malloc(VSIZE); + test_sieve("virtual", v, VSIZE); + free(v); + } + + return 0; +} diff --git a/s390x/sieve.c b/s390x/sieve.c index 8f14a5c3..fe299f30 120000 --- a/s390x/sieve.c +++ b/s390x/sieve.c @@ -1 +1 @@ -../x86/sieve.c \ No newline at end of file +../common/sieve.c \ No newline at end of file diff --git a/x86/sieve.c b/x86/sieve.c deleted file mode 100644 index 8150f2d9..00000000 --- a/x86/sieve.c +++ /dev/null @@ -1,51 +0,0 @@ -#include "alloc.h" -#include "libcflat.h" - -static int sieve(char* data, int size) -{ - int i, j, r = 0; - - for (i = 0; i < size; ++i) - data[i] = 1; - - data[0] = data[1] = 0; - - for (i = 2; i < size; ++i) - if (data[i]) { - ++r; - for (j = i*2; j < size; j += i) - data[j] = 0; - } - return r; -} - -static void test_sieve(const char *msg, char *data, int size) -{ - int r; - - printf("%s:", msg); - r = sieve(data, size); - printf("%d out of %d\n", r, size); -} - -#define STATIC_SIZE 1000000 -#define VSIZE 100000000 -char static_data[STATIC_SIZE]; - -int main(void) -{ - void *v; - int i; - - printf("starting sieve\n"); - test_sieve("static", static_data, STATIC_SIZE); - setup_vm(); - test_sieve("mapped", static_data, STATIC_SIZE); - for (i = 0; i < 3; ++i) { - v = malloc(VSIZE); - test_sieve("virtual", v, VSIZE); - free(v); - } - - return 0; -} diff --git a/x86/sieve.c b/x86/sieve.c new file mode 120000 index 00000000..fe299f30 --- /dev/null +++ b/x86/sieve.c @@ -0,0 +1 @@ +../common/sieve.c \ No newline at end of file From patchwork Fri Feb 2 06:57:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 13542213 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A63FC1863E; Fri, 2 Feb 2024 06:59:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706857161; cv=none; b=boU0ZNobDA653VygXmjApmjbeXPpmCYP9C6VjICvs0w9ubiVcwKENPeZMInYYt8ouBa+fZIIsR7MR0qa3jcvejc7Yg+Mz4dXQumOZX+dh5VaLZTvXxLoLIX/bpY9frjGdhOklYs8EoXjeYiJRXIS2w7zfpBWzxfSMM3275lHqa8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706857161; c=relaxed/simple; bh=RzVPdOIfzAxNtVdgDbvFjWjEIWTRZqcwvTXSWOWEVGE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=e/7tgXRb9W+rKQdBPUQ5iqDxG3Dr7zS882CduWdJeuNoKSsDsOToIu8AkaMPPkdWvDrIU0AfvuqkjbvWz24MCLvsmTf6Jzu6gtX0tzJpKRDpuwaXAsylDnvHSQBrVfZb75XuWl8tByLD9mwOEAL83WtFEmN4p8Gqua6BSc0ThjY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=LJ52ZUqr; arc=none smtp.client-ip=209.85.214.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LJ52ZUqr" Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1d8e7df6abcso16665925ad.1; Thu, 01 Feb 2024 22:59:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706857159; x=1707461959; darn=vger.kernel.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=mjGoSmks1AnXMChnPHaCCI0+kK+ugRn2W8NsPjJCZUU=; b=LJ52ZUqrzCUBbZNyGG/IHjv47MQMdcV8O3MIeBS4uOl1J1Y9NbXC0YrfgWPUFSkYax XsuXyNzEXe99K4xmjwvz0dBjwA0Ct0cQosrm45epMOoGQw3BNi0H66Wd5E6MjmX38+S4 dYm6RdFBHAhNhTUBNXL4WgfJ7dGGZMpAX85aPA48kPQbFgrCYTkwSIF4y9QoQ3OGOJE2 XOk1U9LnMXEY1vH4vGr5LdXUlRgsS/8ihE7GD3bfuy38KZgmJy+hEFSa6ncCGR/n6ISx U/aWqa4LIymm0wqZGJxTt1tqeJ9pmjh9tY51A8I6yVop7jpEpg10NZvW6axV4IJYPbSJ Dc7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706857159; x=1707461959; 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=mjGoSmks1AnXMChnPHaCCI0+kK+ugRn2W8NsPjJCZUU=; b=CGddM0+BnMUWR/2aq7FY5tB/aeEx6EOp1yx+OtpzjirpdDq/nF+/n8a43itARuOC2c IcOLEpEtLtxy1G34ab5m8b+RaKOwEZko9VvM0wu9viPK+8XicKrqtKsbp2cRAbhnyZJp nblrxiF1rV7ivWdN0MQAnhl1dyyqfihXhDHJ1EuPLUN7QOvCRTmDPBYU80oWfJ6QmRfu pRNvtpKCg0uprTU46LnvZHvJmMjECUl8Q8CGbf+xv64/JpoiwqAr6Fq7UAKNbOSweubC 9Of43yvDfi3Mne2MnbdkXiF8x8CvogqAyzlD1KsKqCZWRsl40prIrsEAJY0ItYuRInbi YAMQ== X-Gm-Message-State: AOJu0YwAY0VIc6E8mc9Zq88Jq7EaLcZR+c4CDFM/7S1zUykTq+rb+K2R jUlT7SkrfTviloT15LICt5VdQWj5Geyj2FHC05haPrW6JZLSA4cG X-Google-Smtp-Source: AGHT+IGNcwlMvoqjjMx7S0tilyD6LP0972eDlmeEGxt1rTpDEdMA+PGwhHdjfkb9sruwSSLgt7sSAQ== X-Received: by 2002:a17:902:7847:b0:1d9:d:5730 with SMTP id e7-20020a170902784700b001d9000d5730mr1104086pln.3.1706857159061; Thu, 01 Feb 2024 22:59:19 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCXMFpmzv+sw/9fGzfBrXMtUzkOqt4yxTX4S9LpgchJ6GlcxuaqKoM5whKP+fJRmXM2QTFsy5mwrFyimGhnVxwjB/BgfCxbfpoHa44jAc1Pu6xlt4NK0D0oLh8AUgQqek5byqjl409Tdco3PHCd0eRC0Sz7mc/EcR+p7yuPWqyv8mElN/Wq6FDWVuSMPyhyF5vdo/Mu2OIWXvwnAY9AlYnSW02WUPnkVlZN+XZzks5G1peQOyAlX49ftWwZI6VDWG14w/pbGyMi72CTfs15ZvezIdTtqLJtIWEiQpeX6XOPN88RNtPdMifLkZk7mFmK8vC17sPUKR2QJv5MQ9VJdj8rGOM9cUYxzqUOYDf2ChlOLYuw4nEksUOFdp5gL7N0RrknPqLjUHSjl2/YLSFg9zaCJfsizkIhiYi/G8Wj8bMNm7Bw/OR/mSi/6Us6VWoBYeSKbf+cspqYPDKM1GMuFirWAmoRKG2lTlWzcQgIzPfZGeo7fT5BtLaQeXnzLU/xVq3xu38fp+WC/YpE= Received: from wheely.local0.net ([1.146.53.155]) by smtp.gmail.com with ESMTPSA id d18-20020a170903209200b001d948adc19fsm905734plc.46.2024.02.01.22.59.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 22:59:18 -0800 (PST) From: Nicholas Piggin To: Thomas Huth Cc: Nicholas Piggin , kvm@vger.kernel.org, Laurent Vivier , "Shaoqin Huang" , Andrew Jones , Nico Boehr , Paolo Bonzini , Alexandru Elisei , Eric Auger , Janosch Frank , Claudio Imbrenda , David Hildenbrand , Marc Hartmayer , linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, kvmarm@lists.linux.dev Subject: [kvm-unit-tests PATCH v2 9/9] migration: add a migration selftest Date: Fri, 2 Feb 2024 16:57:40 +1000 Message-ID: <20240202065740.68643-10-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240202065740.68643-1-npiggin@gmail.com> References: <20240202065740.68643-1-npiggin@gmail.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add a selftest for migration support in guest library and test harness code. It performs migrations a tight loop to irritate races and bugs in the test harness code. Acked-by: Claudio Imbrenda (s390x) Signed-off-by: Nicholas Piggin This has flushed out several bugs in developing the multi migration test harness code already. --- arm/Makefile.common | 1 + arm/unittests.cfg | 6 ++++++ common/selftest-migration.c | 34 ++++++++++++++++++++++++++++++++++ powerpc/Makefile.common | 1 + powerpc/unittests.cfg | 4 ++++ s390x/Makefile | 1 + s390x/unittests.cfg | 4 ++++ 7 files changed, 51 insertions(+) create mode 100644 common/selftest-migration.c diff --git a/arm/Makefile.common b/arm/Makefile.common index c2ee568c..371a2c6a 100644 --- a/arm/Makefile.common +++ b/arm/Makefile.common @@ -5,6 +5,7 @@ # tests-common = $(TEST_DIR)/selftest.$(exe) +tests-common += $(TEST_DIR)/selftest-migration.$(exe) tests-common += $(TEST_DIR)/spinlock-test.$(exe) tests-common += $(TEST_DIR)/pci-test.$(exe) tests-common += $(TEST_DIR)/pmu.$(exe) diff --git a/arm/unittests.cfg b/arm/unittests.cfg index fe601cbb..1ffd9a82 100644 --- a/arm/unittests.cfg +++ b/arm/unittests.cfg @@ -55,6 +55,12 @@ smp = $MAX_SMP extra_params = -append 'smp' groups = selftest +# Test migration +[selftest-migration] +file = selftest-migration.flat +groups = selftest migration + +arch = arm64 # Test PCI emulation [pci-test] file = pci-test.flat diff --git a/common/selftest-migration.c b/common/selftest-migration.c new file mode 100644 index 00000000..f70c505f --- /dev/null +++ b/common/selftest-migration.c @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Machine independent migration tests + * + * This is just a very simple test that is intended to stress the migration + * support in the test harness. This could be expanded to test more guest + * library code, but architecture-specific tests should be used to test + * migration of tricky machine state. + */ +#include +#include + +#if defined(__arm__) || defined(__aarch64__) +/* arm can only call getchar 15 times */ +#define NR_MIGRATIONS 15 +#else +#define NR_MIGRATIONS 100 +#endif + +int main(int argc, char **argv) +{ + int i = 0; + + report_prefix_push("migration"); + + for (i = 0; i < NR_MIGRATIONS; i++) + migrate_quiet(); + + report(true, "simple harness stress test"); + + report_prefix_pop(); + + return report_summary(); +} diff --git a/powerpc/Makefile.common b/powerpc/Makefile.common index eb88398d..da4a7bbb 100644 --- a/powerpc/Makefile.common +++ b/powerpc/Makefile.common @@ -6,6 +6,7 @@ tests-common = \ $(TEST_DIR)/selftest.elf \ + $(TEST_DIR)/selftest-migration.elf \ $(TEST_DIR)/spapr_hcall.elf \ $(TEST_DIR)/rtas.elf \ $(TEST_DIR)/emulator.elf \ diff --git a/powerpc/unittests.cfg b/powerpc/unittests.cfg index e71140aa..7ce57de0 100644 --- a/powerpc/unittests.cfg +++ b/powerpc/unittests.cfg @@ -36,6 +36,10 @@ smp = 2 extra_params = -m 256 -append 'setup smp=2 mem=256' groups = selftest +[selftest-migration] +file = selftest-migration.elf +groups = selftest migration + [spapr_hcall] file = spapr_hcall.elf diff --git a/s390x/Makefile b/s390x/Makefile index b72f7578..344d46d6 100644 --- a/s390x/Makefile +++ b/s390x/Makefile @@ -1,4 +1,5 @@ tests = $(TEST_DIR)/selftest.elf +tests += $(TEST_DIR)/selftest-migration.elf tests += $(TEST_DIR)/intercept.elf tests += $(TEST_DIR)/emulator.elf tests += $(TEST_DIR)/sieve.elf diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg index f5024b6e..a7ad522c 100644 --- a/s390x/unittests.cfg +++ b/s390x/unittests.cfg @@ -24,6 +24,10 @@ groups = selftest # please keep the kernel cmdline in sync with $(TEST_DIR)/selftest.parmfile extra_params = -append 'test 123' +[selftest-migration] +file = selftest-migration.elf +groups = selftest migration + [intercept] file = intercept.elf