Skip to contentSkip to conversation

tests/postcopy: Use KVM on ppc64 only if it is KVM-HV

PATCH Applied Thomas Huth 5 participants 16 messages Nov 16, 2016 – Nov 18, 2016

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/postcopy: Use KVM on ppc64 only if it is KVM-HV

The ppc64 postcopy test does not work with KVM-PR, and it is also causing annoying warning messages when run on a x86 host. So let's use KVM here only if we know that we're running with KVM-HV (which automatically also means that we're running on a ppc64 host), and fall back to TCG otherwise.

---
 tests/postcopy-test.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
tests/postcopy-test.c +8 -4
index d6613c5..dafe8be 100644
@@ -380,17 +380,21 @@ static void test_migrate(void)
                                   " -incoming %s",
                                   tmpfs, bootpath, uri);
     } else if (strcmp(arch, "ppc64") == 0) {
+        const char *accel;
+
+        /* On ppc64, the test only works with kvm-hv, but not with kvm-pr */
+        accel = access("/sys/module/kvm_hv", F_OK) ? "tcg" : "kvm:tcg";
         init_bootfile_ppc(bootpath);
-        cmd_src = g_strdup_printf("-machine accel=kvm:tcg -m 256M"
+        cmd_src = g_strdup_printf("-machine accel=%s -m 256M"
                                   " -name pcsource,debug-threads=on"
                                   " -serial file:%s/src_serial"
                                   " -drive file=%s,if=pflash,format=raw",
-                                  tmpfs, bootpath);
-        cmd_dst = g_strdup_printf("-machine accel=kvm:tcg -m 256M"
+                                  accel, tmpfs, bootpath);
+        cmd_dst = g_strdup_printf("-machine accel=%s -m 256M"
                                   " -name pcdest,debug-threads=on"
                                   " -serial file:%s/dest_serial"
                                   " -incoming %s",
-                                  tmpfs, uri);
+                                  accel, tmpfs, uri);
     } else {
         g_assert_not_reached();
     }
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 16 lines · Thomas Huth

The ppc64 postcopy test does not work with KVM-PR, and it is also causing annoying warning messages when run on a x86 host. So let's use KVM here only if we know that we're running with KVM-HV (which automatically also means that we're running on a ppc64 host), and fall back to TCG otherwise.

---
 tests/postcopy-test.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
tests/postcopy-test.c +0 -0
index d6613c5..dafe8be 100644

tests/postcopy-test.c static void test_migrate(void) · line 386

Quoted 7 lines
tests/postcopy-test.c +4 -0
@@ -380,17 +380,21 @@ static void test_migrate(void)
                                   " -incoming %s",
                                   tmpfs, bootpath, uri);
     } else if (strcmp(arch, "ppc64") == 0) {
+        const char *accel;
+
+        /* On ppc64, the test only works with kvm-hv, but not with kvm-pr */
+        accel = access("/sys/module/kvm_hv", F_OK) ? "tcg" : "kvm:tcg";

why not "kvm" instead of "kvm:tcg"?
If it doesn't work it should fail.

Laurent

#2 lore raw
Quoted 14 lines · Laurent Vivier
Quoted 11 lines · Thomas Huth

The ppc64 postcopy test does not work with KVM-PR, and it is also causing annoying warning messages when run on a x86 host. So let's use KVM here only if we know that we're running with KVM-HV (which automatically also means that we're running on a ppc64 host), and fall back to TCG otherwise.

---
 tests/postcopy-test.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
Quoted 15 lines

tests/postcopy-test.c static void test_migrate(void) · line 386

Quoted 12 lines
tests/postcopy-test.c +4 -0
index d6613c5..dafe8be 100644
@@ -380,17 +380,21 @@ static void test_migrate(void)
                                   " -incoming %s",
                                   tmpfs, bootpath, uri);
     } else if (strcmp(arch, "ppc64") == 0) {
+        const char *accel;
+
+        /* On ppc64, the test only works with kvm-hv, but not with kvm-pr */
+        accel = access("/sys/module/kvm_hv", F_OK) ? "tcg" : "kvm:tcg";

why not "kvm" instead of "kvm:tcg"?
If it doesn't work it should fail.

Yes, sounds right. I'll send a v2...

Thomas

Reviewed-by on v1 1/1
#3 lore raw
In reply to Thomas Huth
Quoted 7 lines · Thomas Huth

The ppc64 postcopy test does not work with KVM-PR, and it is also causing annoying warning messages when run on a x86 host. So let's use KVM here only if we know that we're running with KVM-HV (which automatically also means that we're running on a ppc64 host), and fall back to TCG otherwise.

Quoted 35 lines
---
 tests/postcopy-test.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
tests/postcopy-test.c +8 -4
index d6613c5..dafe8be 100644
@@ -380,17 +380,21 @@ static void test_migrate(void)
                                   " -incoming %s",
                                   tmpfs, bootpath, uri);
     } else if (strcmp(arch, "ppc64") == 0) {
+        const char *accel;
+
+        /* On ppc64, the test only works with kvm-hv, but not with kvm-pr */
+        accel = access("/sys/module/kvm_hv", F_OK) ? "tcg" : "kvm:tcg";
         init_bootfile_ppc(bootpath);
-        cmd_src = g_strdup_printf("-machine accel=kvm:tcg -m 256M"
+        cmd_src = g_strdup_printf("-machine accel=%s -m 256M"
                                   " -name pcsource,debug-threads=on"
                                   " -serial file:%s/src_serial"
                                   " -drive file=%s,if=pflash,format=raw",
-                                  tmpfs, bootpath);
-        cmd_dst = g_strdup_printf("-machine accel=kvm:tcg -m 256M"
+                                  accel, tmpfs, bootpath);
+        cmd_dst = g_strdup_printf("-machine accel=%s -m 256M"
                                   " -name pcdest,debug-threads=on"
                                   " -serial file:%s/dest_serial"
                                   " -incoming %s",
-                                  tmpfs, uri);
+                                  accel, tmpfs, uri);
     } else {
         g_assert_not_reached();
     }
#4 lore raw
In reply to Thomas Huth
Quoted 6 lines · On Wed, 16 Nov 2016 09:39:31 +0100 Thomas Huth <[email protected]> wrote:

The ppc64 postcopy test does not work with KVM-PR, and it is also causing annoying warning messages when run on a x86 host. So let's use KVM here only if we know that we're running with KVM-HV (which automatically also means that we're running on a ppc64 host), and fall back to TCG otherwise.

This patch addresses two issues actually:
- the annoying warning when running on a ppc64 guest on a non-ppc64 host
- the fact that KVM-PR seems to be currently broken

I agree that the former makes sense, but what about the case of running a x86 guest on a non-x86 host ?

I'm still feeling uncomfortable with the KVM-PR case... is this a workaround we want to keep until we find out what's going on or are we starting to partially deprecate KVM PR ? In any case, I guess we should document this and probably print some meaningful error message.

Quoted 35 lines
---
 tests/postcopy-test.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
tests/postcopy-test.c +8 -4
index d6613c5..dafe8be 100644
@@ -380,17 +380,21 @@ static void test_migrate(void)
                                   " -incoming %s",
                                   tmpfs, bootpath, uri);
     } else if (strcmp(arch, "ppc64") == 0) {
+        const char *accel;
+
+        /* On ppc64, the test only works with kvm-hv, but not with kvm-pr */
+        accel = access("/sys/module/kvm_hv", F_OK) ? "tcg" : "kvm:tcg";
         init_bootfile_ppc(bootpath);
-        cmd_src = g_strdup_printf("-machine accel=kvm:tcg -m 256M"
+        cmd_src = g_strdup_printf("-machine accel=%s -m 256M"
                                   " -name pcsource,debug-threads=on"
                                   " -serial file:%s/src_serial"
                                   " -drive file=%s,if=pflash,format=raw",
-                                  tmpfs, bootpath);
-        cmd_dst = g_strdup_printf("-machine accel=kvm:tcg -m 256M"
+                                  accel, tmpfs, bootpath);
+        cmd_dst = g_strdup_printf("-machine accel=%s -m 256M"
                                   " -name pcdest,debug-threads=on"
                                   " -serial file:%s/dest_serial"
                                   " -incoming %s",
-                                  tmpfs, uri);
+                                  accel, tmpfs, uri);
     } else {
         g_assert_not_reached();
     }
#5 lore raw
Quoted 14 lines · * Greg Kurz ([email protected]) wrote:
Quoted 6 lines · On Wed, 16 Nov 2016 09:39:31 +0100 Thomas Huth <[email protected]> wrote:

The ppc64 postcopy test does not work with KVM-PR, and it is also causing annoying warning messages when run on a x86 host. So let's use KVM here only if we know that we're running with KVM-HV (which automatically also means that we're running on a ppc64 host), and fall back to TCG otherwise.

This patch addresses two issues actually:
- the annoying warning when running on a ppc64 guest on a non-ppc64 host
- the fact that KVM-PR seems to be currently broken

Quoted 7 lines

I agree that the former makes sense, but what about the case of running a x86 guest on a non-x86 host ?

I'm still feeling uncomfortable with the KVM-PR case... is this a workaround we want to keep until we find out what's going on or are we starting to partially deprecate KVM PR ? In any case, I guess we should document this and probably print some meaningful error message.

This is certainly a work around for now, it doesn't suggest anything about deprecation.

Dave

Quoted 27 lines
Quoted 27 lines
---
 tests/postcopy-test.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
tests/postcopy-test.c +7 -3
index d6613c5..dafe8be 100644
@@ -380,17 +380,21 @@ static void test_migrate(void)
                                   " -incoming %s",
                                   tmpfs, bootpath, uri);
     } else if (strcmp(arch, "ppc64") == 0) {
+        const char *accel;
+
+        /* On ppc64, the test only works with kvm-hv, but not with kvm-pr */
+        accel = access("/sys/module/kvm_hv", F_OK) ? "tcg" : "kvm:tcg";
         init_bootfile_ppc(bootpath);
-        cmd_src = g_strdup_printf("-machine accel=kvm:tcg -m 256M"
+        cmd_src = g_strdup_printf("-machine accel=%s -m 256M"
                                   " -name pcsource,debug-threads=on"
                                   " -serial file:%s/src_serial"
                                   " -drive file=%s,if=pflash,format=raw",
-                                  tmpfs, bootpath);
-        cmd_dst = g_strdup_printf("-machine accel=kvm:tcg -m 256M"
+                                  accel, tmpfs, bootpath);
+        cmd_dst = g_strdup_printf("-machine accel=%s -m 256M"
Quoted 9 lines

tests/postcopy-test.c static void test_migrate(void) · line 400

Quoted 8 lines
tests/postcopy-test.c +1 -1
                                   " -name pcdest,debug-threads=on"
                                   " -serial file:%s/dest_serial"
                                   " -incoming %s",
-                                  tmpfs, uri);
+                                  accel, tmpfs, uri);
     } else {
         g_assert_not_reached();
     }

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#6 lore raw
Quoted 18 lines · On Wed, 16 Nov 2016 12:24:50 +0000 "Dr. David Alan Gilbert"…
Quoted 17 lines · * Greg Kurz ([email protected]) wrote:
Quoted 6 lines · On Wed, 16 Nov 2016 09:39:31 +0100 Thomas Huth <[email protected]> wrote:

The ppc64 postcopy test does not work with KVM-PR, and it is also causing annoying warning messages when run on a x86 host. So let's use KVM here only if we know that we're running with KVM-HV (which automatically also means that we're running on a ppc64 host), and fall back to TCG otherwise.

This patch addresses two issues actually:
- the annoying warning when running on a ppc64 guest on a non-ppc64 host
- the fact that KVM-PR seems to be currently broken

I agree that the former makes sense, but what about the case of running a x86 guest on a non-x86 host ?

Quoted 8 lines
Quoted 4 lines

I'm still feeling uncomfortable with the KVM-PR case... is this a workaround we want to keep until we find out what's going on or are we starting to partially deprecate KVM PR ? In any case, I guess we should document this and probably print some meaningful error message.

This is certainly a work around for now, it doesn't suggest anything about deprecation.

Well it doesn't suggest anything actually, it just silently skips KVM PR... I would at least expect a comment in the code mentioning this is a workaround and maybe an explicit warning for the user. If the user really wants to run this test with KVM on ppc64, then she should ensure it is KVM HV.

Cheers.

--
Greg

Quoted 40 lines

Dave

Quoted 27 lines
Quoted 27 lines
---
 tests/postcopy-test.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
tests/postcopy-test.c +7 -3
index d6613c5..dafe8be 100644
@@ -380,17 +380,21 @@ static void test_migrate(void)
                                   " -incoming %s",
                                   tmpfs, bootpath, uri);
     } else if (strcmp(arch, "ppc64") == 0) {
+        const char *accel;
+
+        /* On ppc64, the test only works with kvm-hv, but not with kvm-pr */
+        accel = access("/sys/module/kvm_hv", F_OK) ? "tcg" : "kvm:tcg";
         init_bootfile_ppc(bootpath);
-        cmd_src = g_strdup_printf("-machine accel=kvm:tcg -m 256M"
+        cmd_src = g_strdup_printf("-machine accel=%s -m 256M"
                                   " -name pcsource,debug-threads=on"
                                   " -serial file:%s/src_serial"
                                   " -drive file=%s,if=pflash,format=raw",
-                                  tmpfs, bootpath);
-        cmd_dst = g_strdup_printf("-machine accel=kvm:tcg -m 256M"
+                                  accel, tmpfs, bootpath);
+        cmd_dst = g_strdup_printf("-machine accel=%s -m 256M"
Quoted 9 lines

tests/postcopy-test.c static void test_migrate(void) · line 400

Quoted 8 lines
tests/postcopy-test.c +1 -1
                                   " -name pcdest,debug-threads=on"
                                   " -serial file:%s/dest_serial"
                                   " -incoming %s",
-                                  tmpfs, uri);
+                                  accel, tmpfs, uri);
     } else {
         g_assert_not_reached();
     }  

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#7 lore raw
Quoted 14 lines · Greg Kurz
Quoted 11 lines · On Wed, 16 Nov 2016 12:24:50 +0000 "Dr. David Alan Gilbert"…
Quoted 10 lines · * Greg Kurz ([email protected]) wrote:
Quoted 6 lines · On Wed, 16 Nov 2016 09:39:31 +0100 Thomas Huth <[email protected]> wrote:

The ppc64 postcopy test does not work with KVM-PR, and it is also causing annoying warning messages when run on a x86 host. So let's use KVM here only if we know that we're running with KVM-HV (which automatically also means that we're running on a ppc64 host), and fall back to TCG otherwise.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

This patch addresses two issues actually:
- the annoying warning when running on a ppc64 guest on a non-ppc64 host
- the fact that KVM-PR seems to be currently broken

I agree that the former makes sense, but what about the case of running a x86 guest on a non-x86 host ?

Of course you also get these '"kvm" accelerator not found' messages there. But so far, I think nobody complained about that yet (only for ppc64 running on x86). And at least the test succeeds there - unlike with KVM-PR, where the test fails completely.

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

I'm still feeling uncomfortable with the KVM-PR case... is this a workaround we want to keep until we find out what's going on or are we starting to partially deprecate KVM PR ? In any case, I guess we should document this and probably print some meaningful error message.

Quoted 8 lines
Quoted 2 lines

This is certainly a work around for now, it doesn't suggest anything about deprecation.

Well it doesn't suggest anything actually, it just silently skips KVM PR... I would at least expect a comment in the code mentioning this is a workaround and maybe an explicit warning for the user. If the user really wants to run this test with KVM on ppc64, then she should ensure it is KVM HV.

Honestly, also considering the number of patches that Laurent already wrote here and never have been accepted, all this has become quite an ugly bike-shed painting discussion.

My opinion:

- If we want to properly test KVM (be it KVM-HV or KVM-PR), write a proper kvm-unit-test instead. I.e. I personally don't care if this test in QEMU is only run with TCG or with KVM.

- The current status of "make check" is broken, since it does not work on KVM-PR. We've got to fix that before the release.

That means I currently really don't care if we've spill out a warning message for KVM-PR here or not - sure, somebody just got to look at KVM-PR later, but that's IMHO off-topic for the test here in the QEMU context.

So if you think that the patch for fixing this issue here with the QEMU test should look differently, please propose a different patch instead. I'm fine with every other approach as long as we get this fixed in time for QEMU 2.8.

Thomas

#8 lore raw
Quoted 41 lines · On Wed, 16 Nov 2016 14:17:47 +0100 Thomas Huth <[email protected]> wrote:
Quoted 14 lines · Greg Kurz
Quoted 11 lines · On Wed, 16 Nov 2016 12:24:50 +0000 "Dr. David Alan Gilbert"…
Quoted 10 lines · * Greg Kurz ([email protected]) wrote:
Quoted 6 lines · On Wed, 16 Nov 2016 09:39:31 +0100 Thomas Huth <[email protected]> wrote:

The ppc64 postcopy test does not work with KVM-PR, and it is also causing annoying warning messages when run on a x86 host. So let's use KVM here only if we know that we're running with KVM-HV (which automatically also means that we're running on a ppc64 host), and fall back to TCG otherwise.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

This patch addresses two issues actually:
- the annoying warning when running on a ppc64 guest on a non-ppc64 host
- the fact that KVM-PR seems to be currently broken

I agree that the former makes sense, but what about the case of running a x86 guest on a non-x86 host ?

Of course you also get these '"kvm" accelerator not found' messages there. But so far, I think nobody complained about that yet (only for ppc64 running on x86). And at least the test succeeds there - unlike with KVM-PR, where the test fails completely.

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

I'm still feeling uncomfortable with the KVM-PR case... is this a workaround we want to keep until we find out what's going on or are we starting to partially deprecate KVM PR ? In any case, I guess we should document this and probably print some meaningful error message.

Quoted 8 lines
Quoted 2 lines

This is certainly a work around for now, it doesn't suggest anything about deprecation.

Well it doesn't suggest anything actually, it just silently skips KVM PR... I would at least expect a comment in the code mentioning this is a workaround and maybe an explicit warning for the user. If the user really wants to run this test with KVM on ppc64, then she should ensure it is KVM HV.

Quoted 4 lines

Honestly, also considering the number of patches that Laurent already wrote here and never have been accepted, all this has become quite an ugly bike-shed painting discussion.

Understood. I'm done with the trivial details ;)

Quoted 6 lines

My opinion:

- If we want to properly test KVM (be it KVM-HV or KVM-PR), write a proper kvm-unit-test instead. I.e. I personally don't care if this test in QEMU is only run with TCG or with KVM.

Agreed.

Quoted 8 lines

- The current status of "make check" is broken, since it does not work on KVM-PR. We've got to fix that before the release.

That means I currently really don't care if we've spill out a warning message for KVM-PR here or not - sure, somebody just got to look at KVM-PR later, but that's IMHO off-topic for the test here in the QEMU context.

Quoted 5 lines

So if you think that the patch for fixing this issue here with the QEMU test should look differently, please propose a different patch instead. I'm fine with every other approach as long as we get this fixed in time for QEMU 2.8.

The changes to the code look ok and I prefer to spend time chasing the KVM PR issue rather than arguing on a comment...

Cheers.

--
Greg

Quoted 2 lines

Thomas

Reviewed-by on v1 1/1
#13 lore raw
In reply to Thomas Huth
Quoted 8 lines · On Wed, 16 Nov 2016 09:39:31 +0100 Thomas Huth <[email protected]> wrote:

The ppc64 postcopy test does not work with KVM-PR, and it is also causing annoying warning messages when run on a x86 host. So let's use KVM here only if we know that we're running with KVM-HV (which automatically also means that we're running on a ppc64 host), and fall back to TCG otherwise.

---

FWIW

Quoted 33 lines
 tests/postcopy-test.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
tests/postcopy-test.c +8 -4
index d6613c5..dafe8be 100644
@@ -380,17 +380,21 @@ static void test_migrate(void)
                                   " -incoming %s",
                                   tmpfs, bootpath, uri);
     } else if (strcmp(arch, "ppc64") == 0) {
+        const char *accel;
+
+        /* On ppc64, the test only works with kvm-hv, but not with kvm-pr */
+        accel = access("/sys/module/kvm_hv", F_OK) ? "tcg" : "kvm:tcg";
         init_bootfile_ppc(bootpath);
-        cmd_src = g_strdup_printf("-machine accel=kvm:tcg -m 256M"
+        cmd_src = g_strdup_printf("-machine accel=%s -m 256M"
                                   " -name pcsource,debug-threads=on"
                                   " -serial file:%s/src_serial"
                                   " -drive file=%s,if=pflash,format=raw",
-                                  tmpfs, bootpath);
-        cmd_dst = g_strdup_printf("-machine accel=kvm:tcg -m 256M"
+                                  accel, tmpfs, bootpath);
+        cmd_dst = g_strdup_printf("-machine accel=%s -m 256M"
                                   " -name pcdest,debug-threads=on"
                                   " -serial file:%s/dest_serial"
                                   " -incoming %s",
-                                  tmpfs, uri);
+                                  accel, tmpfs, uri);
     } else {
         g_assert_not_reached();
     }
#12 lore raw
In reply to Thomas Huth
Quoted 19 lines · Thomas Huth
Quoted 18 lines · Greg Kurz
Quoted 15 lines · On Wed, 16 Nov 2016 12:24:50 +0000 "Dr. David Alan Gilbert"…
Quoted 14 lines · * Greg Kurz ([email protected]) wrote:
Quoted 6 lines · On Wed, 16 Nov 2016 09:39:31 +0100 Thomas Huth <[email protected]> wrote:

The ppc64 postcopy test does not work with KVM-PR, and it is also causing annoying warning messages when run on a x86 host. So let's use KVM here only if we know that we're running with KVM-HV (which automatically also means that we're running on a ppc64 host), and fall back to TCG otherwise.

This patch addresses two issues actually:
- the annoying warning when running on a ppc64 guest on a non-ppc64 host
- the fact that KVM-PR seems to be currently broken

Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

I agree that the former makes sense, but what about the case of running a x86 guest on a non-x86 host ?

Of course you also get these '"kvm" accelerator not found' messages there. But so far, I think nobody complained about that yet (only for ppc64 running on x86). And at least the test succeeds there - unlike with KVM-PR, where the test fails completely.

Well, I guess I should complain about them then. It is slightly irritating when doing my pre-pull tests on a ppc64 host, although I'm more or less used to it now.

Quoted 32 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

I'm still feeling uncomfortable with the KVM-PR case... is this a workaround we want to keep until we find out what's going on or are we starting to partially deprecate KVM PR ? In any case, I guess we should document this and probably print some meaningful error message.

Quoted 8 lines
Quoted 2 lines

This is certainly a work around for now, it doesn't suggest anything about deprecation.

Well it doesn't suggest anything actually, it just silently skips KVM PR... I would at least expect a comment in the code mentioning this is a workaround and maybe an explicit warning for the user. If the user really wants to run this test with KVM on ppc64, then she should ensure it is KVM HV.

Honestly, also considering the number of patches that Laurent already wrote here and never have been accepted, all this has become quite an ugly bike-shed painting discussion.

My opinion:

- If we want to properly test KVM (be it KVM-HV or KVM-PR), write a proper kvm-unit-test instead. I.e. I personally don't care if this test in QEMU is only run with TCG or with KVM.

- The current status of "make check" is broken, since it does not work on KVM-PR. We've got to fix that before the release.

That means I currently really don't care if we've spill out a warning message for KVM-PR here or not - sure, somebody just got to look at KVM-PR later, but that's IMHO off-topic for the test here in the QEMU context.

Quoted 4 lines

So if you think that the patch for fixing this issue here with the QEMU test should look differently, please propose a different patch instead. I'm fine with every other approach as long as we get this fixed in time for QEMU 2.8.

Hm, yeah, I concur.x

Quoted 3 lines

Thomas

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
Applied
#14 lore raw
In reply to Thomas Huth
Quoted 7 lines · Thomas Huth

The ppc64 postcopy test does not work with KVM-PR, and it is also causing annoying warning messages when run on a x86 host. So let's use KVM here only if we know that we're running with KVM-HV (which automatically also means that we're running on a ppc64 host), and fall back to TCG otherwise.

Applied to ppc-for-2.8.

Longer term, I think we should default to tcg for all these tests - on x86 as well - then run KVM *as well* when available. But in the short term we should fix make check for the 2.8 release.

Quoted 34 lines
---
 tests/postcopy-test.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
tests/postcopy-test.c +8 -4
index d6613c5..dafe8be 100644
@@ -380,17 +380,21 @@ static void test_migrate(void)
                                   " -incoming %s",
                                   tmpfs, bootpath, uri);
     } else if (strcmp(arch, "ppc64") == 0) {
+        const char *accel;
+
+        /* On ppc64, the test only works with kvm-hv, but not with kvm-pr */
+        accel = access("/sys/module/kvm_hv", F_OK) ? "tcg" : "kvm:tcg";
         init_bootfile_ppc(bootpath);
-        cmd_src = g_strdup_printf("-machine accel=kvm:tcg -m 256M"
+        cmd_src = g_strdup_printf("-machine accel=%s -m 256M"
                                   " -name pcsource,debug-threads=on"
                                   " -serial file:%s/src_serial"
                                   " -drive file=%s,if=pflash,format=raw",
-                                  tmpfs, bootpath);
-        cmd_dst = g_strdup_printf("-machine accel=kvm:tcg -m 256M"
+                                  accel, tmpfs, bootpath);
+        cmd_dst = g_strdup_printf("-machine accel=%s -m 256M"
                                   " -name pcdest,debug-threads=on"
                                   " -serial file:%s/dest_serial"
                                   " -incoming %s",
-                                  tmpfs, uri);
+                                  accel, tmpfs, uri);
     } else {
         g_assert_not_reached();
     }
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#15 lore raw
Quoted 7 lines · David Gibson
Quoted 6 lines · Thomas Huth

The ppc64 postcopy test does not work with KVM-PR, and it is also causing annoying warning messages when run on a x86 host. So let's use KVM here only if we know that we're running with KVM-HV (which automatically also means that we're running on a ppc64 host), and fall back to TCG otherwise.

Quoted 7 lines
Quoted 1 line

Applied to ppc-for-2.8.

Longer term, I think we should default to tcg for all these tests - on x86 as well - then run KVM *as well* when available. But in the short term we should fix make check for the 2.8 release.

I agree with that.

Laurent

#9 lore raw
In reply to Greg Kurz
Quoted 17 lines · Greg Kurz
Quoted 14 lines · On Wed, 16 Nov 2016 14:17:47 +0100 Thomas Huth <[email protected]> wrote:
Quoted 13 lines · Greg Kurz
Quoted 10 lines · On Wed, 16 Nov 2016 12:24:50 +0000 "Dr. David Alan Gilbert"…
Quoted 9 lines · * Greg Kurz ([email protected]) wrote:
Quoted 6 lines · On Wed, 16 Nov 2016 09:39:31 +0100 Thomas Huth <[email protected]> wrote:

The ppc64 postcopy test does not work with KVM-PR, and it is also causing annoying warning messages when run on a x86 host. So let's use KVM here only if we know that we're running with KVM-HV (which automatically also means that we're running on a ppc64 host), and fall back to TCG otherwise.

[..]

Quoted 2 lines

The changes to the code look ok and I prefer to spend time chasing the KVM PR issue rather than arguing on a comment...

For the problem itself, it seems to appear only after a BOOK3S_INTERRUPT_SYSCALL interrupt for an KVM_EXIT_PAPR_HCALL (H_PUT_TERM_CHAR). In this case, KVM has to exit to QEMU to manage the output. The following interrupt is always an BOOK3S_INTERRUPT_PROGRAM with an emulation failure.

Laurent

#10 lore raw

Hi Laurent,

Quoted 19 lines · On Thu, 17 Nov 2016 21:22:33 +0100 Laurent Vivier <[email protected]> wrote:
Quoted 17 lines · Greg Kurz
Quoted 14 lines · On Wed, 16 Nov 2016 14:17:47 +0100 Thomas Huth <[email protected]> wrote:
Quoted 13 lines · Greg Kurz
Quoted 10 lines · On Wed, 16 Nov 2016 12:24:50 +0000 "Dr. David Alan Gilbert"…
Quoted 9 lines · * Greg Kurz ([email protected]) wrote:
Quoted 6 lines · On Wed, 16 Nov 2016 09:39:31 +0100 Thomas Huth <[email protected]> wrote:

The ppc64 postcopy test does not work with KVM-PR, and it is also causing annoying warning messages when run on a x86 host. So let's use KVM here only if we know that we're running with KVM-HV (which automatically also means that we're running on a ppc64 host), and fall back to TCG otherwise.

[..]

Quoted 9 lines
Quoted 2 lines

The changes to the code look ok and I prefer to spend time chasing the KVM PR issue rather than arguing on a comment...

For the problem itself, it seems to appear only after a BOOK3S_INTERRUPT_SYSCALL interrupt for an KVM_EXIT_PAPR_HCALL (H_PUT_TERM_CHAR). In this case, KVM has to exit to QEMU to manage the output. The following interrupt is always an BOOK3S_INTERRUPT_PROGRAM with an emulation failure.

Which specific problem are you referring to ?

On my side, when running postcopy-test in a nested guest, I hit either one of the three following issues (in decreasing order of probability of occurence):

1) "Memory content inconsistency at ..." like Stefan

2) "Unexpected 32 on dest_serial serial" accompanied by the following in dmesg

[131613.428616] Couldn't emulate instruction 0x00000000 (op 0 xop 0)
[131613.503515] kvmppc_handle_exit_pr: emulation at d8 failed (00000000)

3) hang because the destination QEMU is looping on:

ioctl(19, KVM_RUN, 0) = 2 (RESUME_HOST)

Host runs OpenPower HostOS (kernel 4.9, QEMU 2.7) and guest runs fedora25.

Cheers.

--
Greg

Quoted 1 line

Laurent

#11 lore raw
Quoted 1 line · Greg Kurz

Hi Laurent,

Hi Greg,

Quoted 33 lines
Quoted 19 lines · On Thu, 17 Nov 2016 21:22:33 +0100 Laurent Vivier <[email protected]> wrote:
Quoted 17 lines · Greg Kurz
Quoted 14 lines · On Wed, 16 Nov 2016 14:17:47 +0100 Thomas Huth <[email protected]> wrote:
Quoted 13 lines · Greg Kurz
Quoted 10 lines · On Wed, 16 Nov 2016 12:24:50 +0000 "Dr. David Alan Gilbert"…
Quoted 9 lines · * Greg Kurz ([email protected]) wrote:
Quoted 6 lines · On Wed, 16 Nov 2016 09:39:31 +0100 Thomas Huth <[email protected]> wrote:

The ppc64 postcopy test does not work with KVM-PR, and it is also causing annoying warning messages when run on a x86 host. So let's use KVM here only if we know that we're running with KVM-HV (which automatically also means that we're running on a ppc64 host), and fall back to TCG otherwise.

[..]

Quoted 9 lines
Quoted 2 lines

The changes to the code look ok and I prefer to spend time chasing the KVM PR issue rather than arguing on a comment...

For the problem itself, it seems to appear only after a BOOK3S_INTERRUPT_SYSCALL interrupt for an KVM_EXIT_PAPR_HCALL (H_PUT_TERM_CHAR). In this case, KVM has to exit to QEMU to manage the output. The following interrupt is always an BOOK3S_INTERRUPT_PROGRAM with an emulation failure.

Which specific problem are you referring to ?

..

Quoted 4 lines

2) "Unexpected 32 on dest_serial serial" accompanied by the following in dmesg

[131613.428616] Couldn't emulate instruction 0x00000000 (op 0 xop 0)
[131613.503515] kvmppc_handle_exit_pr: emulation at d8 failed (00000000)

This one, test running on a bare metal PowerMac G5 (F24), 4.9.0-rc5 kernel. And I have only and everytime this error.

Laurent