Skip to contentSkip to conversation

tests: Fix migration-test build failure for sparc

PATCH In review Peter Xu 5 participants 7 messages Jul 28, 2021 – Jul 29, 2021

lore
Share & tools
lore

Peter Xu

author
#0 lore raw

PATCH 1/1 tests: Fix migration-test build failure for sparc

Even if <linux/kvm.h> seems to exist for all archs on linux, however including it with __linux__ defined seems to be not working yet as it'll try to include asm/kvm.h and that can be missing for archs that do not support kvm.

To fix this (instead of any attempt to fix linux headers..), we can mark the header to be x86_64 only, because it's so far only service for adding the kvm dirty ring test.

No need to have "Fixes" as the issue is just introduced very recently.

---
 tests/qtest/migration-test.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
tests/qtest/migration-test.c +3 -2
index 1e8b7784ef..cc5e83d98a 100644
@@ -27,7 +27,8 @@
 #include "migration-helpers.h"
 #include "tests/migration/migration-test.h"
 
-#if defined(__linux__)
+/* For dirty ring test; so far only x86_64 is supported */
+#if defined(__linux__) && defined(HOST_X86_64)
 #include "linux/kvm.h"
 #endif
 
@@ -1395,7 +1396,7 @@ static void test_multifd_tcp_cancel(void)
 
 static bool kvm_dirty_ring_supported(void)
 {
-#if defined(__linux__)
+#if defined(__linux__) && defined(HOST_X86_64)
     int ret, kvm_fd = open("/dev/kvm", O_RDONLY);
 
     if (kvm_fd < 0) {
Signature · 1 line
2.31.1
author
#1 lore raw
Quoted 1 line · Peter Xu

No need to have "Fixes" as the issue is just introduced very recently.

And.. This is only true if this patch can be merged in 6.1...

I should have added "for 6.1" in the subject but I forgot. Sorry.

Signature · 1 line
Peter Xu
Reviewed-by on v1 1/1
#2 lore raw
In reply to Peter Xu
Quoted 9 lines · Peter Xu

Even if <linux/kvm.h> seems to exist for all archs on linux, however including it with __linux__ defined seems to be not working yet as it'll try to include asm/kvm.h and that can be missing for archs that do not support kvm.

To fix this (instead of any attempt to fix linux headers..), we can mark the header to be x86_64 only, because it's so far only service for adding the kvm dirty ring test.

No need to have "Fixes" as the issue is just introduced very recently.

What an odd thing to say. How do I know that without the link?

Fixes 1f546b709d61

Anyway,

r~

Quoted 31 lines
---
  tests/qtest/migration-test.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
tests/qtest/migration-test.c +3 -2
index 1e8b7784ef..cc5e83d98a 100644
@@ -27,7 +27,8 @@
  #include "migration-helpers.h"
  #include "tests/migration/migration-test.h"
 
-#if defined(__linux__)
+/* For dirty ring test; so far only x86_64 is supported */
+#if defined(__linux__) && defined(HOST_X86_64)
  #include "linux/kvm.h"
  #endif
 
@@ -1395,7 +1396,7 @@ static void test_multifd_tcp_cancel(void)
 
  static bool kvm_dirty_ring_supported(void)
  {
-#if defined(__linux__)
+#if defined(__linux__) && defined(HOST_X86_64)
      int ret, kvm_fd = open("/dev/kvm", O_RDONLY);
 
      if (kvm_fd < 0) {
Reviewed-by on v1 1/1
#3 lore raw
In reply to Peter Xu
Quoted 9 lines · Peter Xu

Even if <linux/kvm.h> seems to exist for all archs on linux, however including it with __linux__ defined seems to be not working yet as it'll try to include asm/kvm.h and that can be missing for archs that do not support kvm.

To fix this (instead of any attempt to fix linux headers..), we can mark the header to be x86_64 only, because it's so far only service for adding the kvm dirty ring test.

No need to have "Fixes" as the issue is just introduced very recently.

Personally I find it very useful to navigate in gitk without having to use git-blame.

Fixes 1f546b709d6 ("tests: migration-test: Add dirty ring test")
Quoted 31 lines
---
 tests/qtest/migration-test.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
tests/qtest/migration-test.c +3 -2
index 1e8b7784ef..cc5e83d98a 100644
@@ -27,7 +27,8 @@
 #include "migration-helpers.h"
 #include "tests/migration/migration-test.h"
 
-#if defined(__linux__)
+/* For dirty ring test; so far only x86_64 is supported */
+#if defined(__linux__) && defined(HOST_X86_64)
 #include "linux/kvm.h"
 #endif
 
@@ -1395,7 +1396,7 @@ static void test_multifd_tcp_cancel(void)
 
 static bool kvm_dirty_ring_supported(void)
 {
-#if defined(__linux__)
+#if defined(__linux__) && defined(HOST_X86_64)
     int ret, kvm_fd = open("/dev/kvm", O_RDONLY);
 
     if (kvm_fd < 0) {
author
#4 lore raw
Quoted 5 lines · Philippe Mathieu-Daudé
Quoted 4 lines · Peter Xu

Even if <linux/kvm.h> seems to exist for all archs on linux, however including it with __linux__ defined seems to be not working yet as it'll try to include asm/kvm.h and that can be missing for archs that do not support kvm.

Quoted 8 lines
Quoted 5 lines

To fix this (instead of any attempt to fix linux headers..), we can mark the header to be x86_64 only, because it's so far only service for adding the kvm dirty ring test.

No need to have "Fixes" as the issue is just introduced very recently.

Personally I find it very useful to navigate in gitk without having to use git-blame.

Makes sense.

Quoted 3 lines
Fixes 1f546b709d6 ("tests: migration-test: Add dirty ring test")

Thanks all!

Signature · 1 line
Peter Xu
Acked-by on v1 1/1
#5 lore raw
In reply to Peter Xu
Quoted 32 lines · Peter Xu

Even if <linux/kvm.h> seems to exist for all archs on linux, however including it with __linux__ defined seems to be not working yet as it'll try to include asm/kvm.h and that can be missing for archs that do not support kvm.

To fix this (instead of any attempt to fix linux headers..), we can mark the header to be x86_64 only, because it's so far only service for adding the kvm dirty ring test.

No need to have "Fixes" as the issue is just introduced very recently.

---
  tests/qtest/migration-test.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
tests/qtest/migration-test.c +2 -1
index 1e8b7784ef..cc5e83d98a 100644
@@ -27,7 +27,8 @@
  #include "migration-helpers.h"
  #include "tests/migration/migration-test.h"
 
-#if defined(__linux__)
+/* For dirty ring test; so far only x86_64 is supported */
+#if defined(__linux__) && defined(HOST_X86_64)
  #include "linux/kvm.h"
  #endif
 

tests/qtest/migration-test.c static void test_multifd_tcp_cancel(void) · line 1402

Quoted 8 lines
tests/qtest/migration-test.c +1 -1
@@ -1395,7 +1396,7 @@ static void test_multifd_tcp_cancel(void)
 
  static bool kvm_dirty_ring_supported(void)
  {
-#if defined(__linux__)
+#if defined(__linux__) && defined(HOST_X86_64)
      int ret, kvm_fd = open("/dev/kvm", O_RDONLY);
 
      if (kvm_fd < 0) {

Juan, Dave, if you don't mind I can take this through my testing branch - I'm planning to send a pull request today anyway.

Thomas

#6 lore raw
Quoted 40 lines · * Thomas Huth ([email protected]) wrote:
Quoted 29 lines · Peter Xu

Even if <linux/kvm.h> seems to exist for all archs on linux, however including it with __linux__ defined seems to be not working yet as it'll try to include asm/kvm.h and that can be missing for archs that do not support kvm.

To fix this (instead of any attempt to fix linux headers..), we can mark the header to be x86_64 only, because it's so far only service for adding the kvm dirty ring test.

No need to have "Fixes" as the issue is just introduced very recently.

---
  tests/qtest/migration-test.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
tests/qtest/migration-test.c +2 -1
index 1e8b7784ef..cc5e83d98a 100644
@@ -27,7 +27,8 @@
  #include "migration-helpers.h"
  #include "tests/migration/migration-test.h"
-#if defined(__linux__)
+/* For dirty ring test; so far only x86_64 is supported */
+#if defined(__linux__) && defined(HOST_X86_64)
  #include "linux/kvm.h"
  #endif

tests/qtest/migration-test.c static void test_multifd_tcp_cancel(void) · line 1401

Quoted 7 lines
tests/qtest/migration-test.c +1 -1
@@ -1395,7 +1396,7 @@ static void test_multifd_tcp_cancel(void)
  static bool kvm_dirty_ring_supported(void)
  {
-#if defined(__linux__)
+#if defined(__linux__) && defined(HOST_X86_64)
      int ret, kvm_fd = open("/dev/kvm", O_RDONLY);
      if (kvm_fd < 0) {
 
Quoted 2 lines

Juan, Dave, if you don't mind I can take this through my testing branch - I'm planning to send a pull request today anyway.

Please do; thanks!

Dave

Quoted 2 lines

Thomas

Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK