All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicholas Piggin <npiggin@gmail.com>
To: Thomas Huth <thuth@redhat.com>
Cc: Nicholas Piggin <npiggin@gmail.com>,
	kvm@vger.kernel.org, Laurent Vivier <lvivier@redhat.com>,
	"Shaoqin Huang" <shahuang@redhat.com>,
	Andrew Jones <andrew.jones@linux.dev>,
	Nico Boehr <nrb@linux.ibm.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Alexandru Elisei <alexandru.elisei@arm.com>,
	Eric Auger <eric.auger@redhat.com>,
	Janosch Frank <frankja@linux.ibm.com>,
	Claudio Imbrenda <imbrenda@linux.ibm.com>,
	David Hildenbrand <david@redhat.com>,
	Marc Hartmayer <mhartmay@linux.ibm.com>,
	linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org
Subject: [kvm-unit-tests PATCH 1/7] arch-run: Keep infifo open
Date: Mon, 26 Feb 2024 19:38:26 +1000	[thread overview]
Message-ID: <20240226093832.1468383-2-npiggin@gmail.com> (raw)
In-Reply-To: <20240226093832.1468383-1-npiggin@gmail.com>

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 <npiggin@gmail.com>
---
 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
-- 
2.42.0


WARNING: multiple messages have this Message-ID (diff)
From: Nicholas Piggin <npiggin@gmail.com>
To: Thomas Huth <thuth@redhat.com>
Cc: Laurent Vivier <lvivier@redhat.com>,
	linux-s390@vger.kernel.org, Nico Boehr <nrb@linux.ibm.com>,
	Janosch Frank <frankja@linux.ibm.com>,
	kvm@vger.kernel.org, David Hildenbrand <david@redhat.com>,
	linuxppc-dev@lists.ozlabs.org,
	Shaoqin Huang <shahuang@redhat.com>,
	Nicholas Piggin <npiggin@gmail.com>,
	Andrew Jones <andrew.jones@linux.dev>,
	Eric Auger <eric.auger@redhat.com>,
	Marc Hartmayer <mhartmay@linux.ibm.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Claudio Imbrenda <imbrenda@linux.ibm.com>,
	Alexandru Elisei <alexandru.elisei@arm.com>
Subject: [kvm-unit-tests PATCH 1/7] arch-run: Keep infifo open
Date: Mon, 26 Feb 2024 19:38:26 +1000	[thread overview]
Message-ID: <20240226093832.1468383-2-npiggin@gmail.com> (raw)
In-Reply-To: <20240226093832.1468383-1-npiggin@gmail.com>

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 <npiggin@gmail.com>
---
 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
-- 
2.42.0


  reply	other threads:[~2024-02-26  9:38 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-26  9:38 [kvm-unit-tests PATCH 0/7] more migration enhancements and tests Nicholas Piggin
2024-02-26  9:38 ` Nicholas Piggin
2024-02-26  9:38 ` Nicholas Piggin [this message]
2024-02-26  9:38   ` [kvm-unit-tests PATCH 1/7] arch-run: Keep infifo open Nicholas Piggin
2024-03-01 13:32   ` Thomas Huth
2024-03-01 13:32     ` Thomas Huth
2024-03-05  2:21     ` Nicholas Piggin
2024-03-05  2:21       ` Nicholas Piggin
2024-02-26  9:38 ` [kvm-unit-tests PATCH 2/7] migration: Add a migrate_skip command Nicholas Piggin
2024-02-26  9:38   ` Nicholas Piggin
2024-03-04  6:05   ` Thomas Huth
2024-03-04  6:05     ` Thomas Huth
2024-02-26  9:38 ` [kvm-unit-tests PATCH 3/7] (arm|s390): Use migrate_skip in test cases Nicholas Piggin
2024-02-26  9:38   ` Nicholas Piggin
2024-03-01 13:49   ` Thomas Huth
2024-03-01 13:49     ` Thomas Huth
2024-02-26  9:38 ` [kvm-unit-tests PATCH 4/7] powerpc: add asm/time.h header with delay and get_clock_us/ms Nicholas Piggin
2024-02-26  9:38   ` Nicholas Piggin
2024-03-01 14:05   ` Thomas Huth
2024-03-01 14:05     ` Thomas Huth
2024-02-26  9:38 ` [kvm-unit-tests PATCH 5/7] arch-run: Add a "continuous" migration option for tests Nicholas Piggin
2024-02-26  9:38   ` Nicholas Piggin
2024-03-04  6:17   ` Thomas Huth
2024-03-04  6:17     ` Thomas Huth
2024-03-04  9:19     ` Andrew Jones
2024-03-04  9:19       ` Andrew Jones
2024-03-05  2:58       ` Nicholas Piggin
2024-03-05  2:58         ` Nicholas Piggin
2024-03-05  2:47     ` Nicholas Piggin
2024-03-05  2:47       ` Nicholas Piggin
2024-02-26  9:38 ` [kvm-unit-tests PATCH 6/7] gitlab-ci: Run migration selftest on s390x and powerpc Nicholas Piggin
2024-02-26  9:38   ` Nicholas Piggin
2024-03-01 14:16   ` Thomas Huth
2024-03-01 14:16     ` Thomas Huth
2024-03-05  2:38     ` Nicholas Piggin
2024-03-05  2:38       ` Nicholas Piggin
2024-03-05  6:50       ` Thomas Huth
2024-03-05  6:50         ` Thomas Huth
2024-02-26  9:38 ` [kvm-unit-tests PATCH 7/7] common: add memory dirtying vs migration test Nicholas Piggin
2024-02-26  9:38   ` Nicholas Piggin
2024-03-04  6:22   ` Thomas Huth
2024-03-04  6:22     ` Thomas Huth
2024-03-05  2:50     ` Nicholas Piggin
2024-03-05  2:50       ` Nicholas Piggin
2024-03-05  6:52       ` Thomas Huth
2024-03-05  6:52         ` Thomas Huth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240226093832.1468383-2-npiggin@gmail.com \
    --to=npiggin@gmail.com \
    --cc=alexandru.elisei@arm.com \
    --cc=andrew.jones@linux.dev \
    --cc=david@redhat.com \
    --cc=eric.auger@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=lvivier@redhat.com \
    --cc=mhartmay@linux.ibm.com \
    --cc=nrb@linux.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=shahuang@redhat.com \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.