All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Radim Krčmář" <rkrcmar@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, Drew Jones <drjones@redhat.com>,
	Laurent Vivier <lvivier@redhat.com>,
	Thomas Huth <thuth@redhat.com>,
	David Hildenbrand <david@redhat.com>
Subject: Re: [kvm-unit-tests PATCH 5/5] arch/run: unify accelerator detection
Date: Thu, 29 Jun 2017 14:45:50 +0200	[thread overview]
Message-ID: <20170629124549.GB10661@potion> (raw)
In-Reply-To: <13f36817-1957-0c9d-2c7e-86850b695c53@redhat.com>

2017-06-28 22:48+0200, Paolo Bonzini:
> On 28/06/2017 22:08, Radim Krčmář wrote:
> > -if [ "$ACCEL" = "kvm" ] && [ "$kvm_available" != "yes" ]; then
> > -	echo "KVM is needed, but not available on this host"
> > +ACCEL=$(get_accel '([ "$HOST" = "arm" ] && [ "$ARCH" = "arm" ]) || [ "$HOST" = "aarch64" ]') ||
> >  	exit 2
> 
> Should x86 do the same as ARM (follow-up patch)?

Yeah, I'll prepare it when we've agreed on the format.

> And maybe the test could move from an argument of get_accel to a
> function "arch_kvm_available" that returns 0 if available and 1 if not?

Right, the arm condition needs to be fixed as

  ([ "$HOST" = "arm" ] && [ "$ARCH" = "arm" ]) ||
  ([ "$HOST" = "aarch64" ] && [ "$ARCH" = arm -o "$ARCH" = arm64 ])

and it would look even worse in the argument ...

Would it be ok like this?

diff --git a/arm/run b/arm/run
index f2e71eca022d..82d36d0e83f8 100755
--- a/arm/run
+++ b/arm/run
@@ -10,7 +10,12 @@ if [ -z "$STANDALONE" ]; then
 fi
 processor="$PROCESSOR"
 
-ACCEL=$(get_accel '([ "$HOST" = "arm" ] && [ "$ARCH" = "arm" ]) || [ "$HOST" = "aarch64" ]') ||
+arch_kvm_available ()
+{
+	([ "$HOST" = "arm" ] && [ "$ARCH" = "arm" ]) || [ "$HOST" = "aarch64" ]
+}
+
+ACCEL=$(get_accel) ||
 	exit 2
 
 qemu=$(search_qemu_binary) ||
diff --git a/powerpc/run b/powerpc/run
index 55b987c5efc5..9ae21f333205 100755
--- a/powerpc/run
+++ b/powerpc/run
@@ -9,7 +9,12 @@ if [ -z "$STANDALONE" ]; then
 	source scripts/arch-run.bash
 fi
 
-ACCEL=$(get_accel '[ "$HOST" = "ppc64" ] && [ "$ARCH" = "ppc64" ]') ||
+arch_kvm_available ()
+{
+	[ "$HOST" = "ppc64" ] && [ "$ARCH" = "ppc64" ]
+}
+
+ACCEL=$(get_accel) ||
 	exit 2
 
 qemu=$(search_qemu_binary) ||
diff --git a/s390x/run b/s390x/run
index 67d6e88ea7e4..361693ee4b84 100755
--- a/s390x/run
+++ b/s390x/run
@@ -9,7 +9,12 @@ if [ -z "$STANDALONE" ]; then
 	source scripts/arch-run.bash
 fi
 
-ACCEL=$(get_accel '[ "$HOST" = "s390x" ] && [ "$ARCH" = "s390x" ]') ||
+arch_kvm_available ()
+{
+	[ "$HOST" = "s390x" ] && [ "$ARCH" = "s390x" ]
+}
+
+ACCEL=$(get_accel) ||
 	exit 2
 
 qemu=$(search_qemu_binary) ||
diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash
index a696652c61b1..6c6abc6b36bc 100644
--- a/scripts/arch-run.bash
+++ b/scripts/arch-run.bash
@@ -277,7 +277,7 @@ get_accel ()
 {
 	local kvm_available
 
-	if [ -c /dev/kvm ] && eval "$@"; then
+	if [ -c /dev/kvm ] && arch_kvm_available; then
 		kvm_available=yes
 	fi
 

  reply	other threads:[~2017-06-29 12:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-28 20:08 [kvm-unit-tests PATCH 0/5] Minor fixes while getting rid of code duplication Radim Krčmář
2017-06-28 20:08 ` [kvm-unit-tests PATCH 1/5] arch/run: simplify copy-paste of the command line Radim Krčmář
2017-06-28 20:08 ` [kvm-unit-tests PATCH 2/5] run_tests: add summary to powerpc and s390 Radim Krčmář
2017-06-29  5:30   ` Thomas Huth
2017-06-29 12:53     ` Radim Krčmář
2017-06-28 20:08 ` [kvm-unit-tests PATCH 3/5] s390+powerpc/run: improve output handling Radim Krčmář
2017-06-28 20:08 ` [kvm-unit-tests PATCH 4/5] scripts/arch-run: fix qemu binary search failure path Radim Krčmář
2017-06-28 20:46   ` Paolo Bonzini
2017-06-29 12:32     ` Radim Krčmář
2017-06-28 20:08 ` [kvm-unit-tests PATCH 5/5] arch/run: unify accelerator detection Radim Krčmář
2017-06-28 20:48   ` Paolo Bonzini
2017-06-29 12:45     ` Radim Krčmář [this message]
2017-06-29 13:46       ` Radim Krčmář
2017-06-29 13:49         ` Paolo Bonzini
2017-06-29 14:28   ` [kvm-unit-tests PATCH v2 " Radim Krčmář
2017-06-29 14:32   ` [kvm-unit-tests PATCH v2 6/5] x86/run: support accelerator controls Radim Krčmář
2017-06-30 10:42     ` Paolo Bonzini
2017-06-29 11:41 ` [kvm-unit-tests PATCH 0/5] Minor fixes while getting rid of code duplication Andrew Jones

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=20170629124549.GB10661@potion \
    --to=rkrcmar@redhat.com \
    --cc=david@redhat.com \
    --cc=drjones@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=thuth@redhat.com \
    --subject='Re: [kvm-unit-tests PATCH 5/5] arch/run: unify accelerator detection' \
    /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

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.