QEMU-Devel Archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Leonardo Bras Soares Passos <lsoaresp@redhat.com>,
	qemu-devel@nongnu.org, Juan Quintela <quintela@redhat.com>
Subject: Re: [PATCH 2/2] tests: migration-test: Add dirty ring test
Date: Thu, 10 Jun 2021 15:32:27 -0400	[thread overview]
Message-ID: <YMJoy7rPDNNJpyVr@t490s> (raw)
In-Reply-To: <YMJhmOXglbMlX5P6@work-vm>

On Thu, Jun 10, 2021 at 08:01:44PM +0100, Dr. David Alan Gilbert wrote:
> > +#include <linux/kvm.h>
> 
> Does that get you the system headers, which may or may not have
> KVM_CAP_DIRTY_LOG_RING if you're on an old host, or does it get you
> qemu's linux-headers which definitely does?

I tested it and it's using the linux-headers/ file even if I also got the other
/usr/include one.  So I think the qemu one just has higher priority in the "-I"
paths.

Btw, IIUC quotting with <> or "" should be the same here for headers, so I'm
thinking maybe I should switch to "" like the rest headers.

> 
> What happens on a BSD or the like?

Ah, good point..

How about I squash this into the patch?

---8<---
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index cc6e396d1a2..9ef6b471353 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -12,7 +12,6 @@
 
 #include "qemu/osdep.h"
 
-#include <linux/kvm.h>
 #include "libqos/libqtest.h"
 #include "qapi/error.h"
 #include "qapi/qmp/qdict.h"
@@ -28,6 +27,10 @@
 #include "migration-helpers.h"
 #include "tests/migration/migration-test.h"
 
+#if defined(__linux__)
+#include "linux/kvm.h"
+#endif
+
 /* TODO actually test the results and get rid of this */
 #define qtest_qmp_discard_response(...) qobject_unref(qtest_qmp(__VA_ARGS__))
 
@@ -1392,6 +1395,7 @@ static void test_multifd_tcp_cancel(void)
 
 static bool kvm_dirty_ring_supported(void)
 {
+#if defined(__linux__)
     int ret, kvm_fd = open("/dev/kvm", O_RDONLY);
 
     if (kvm_fd < 0) {
@@ -1407,6 +1411,9 @@ static bool kvm_dirty_ring_supported(void)
     }
 
     return true;
+#else
+    return false;
+#endif
 }
 
 int main(int argc, char **argv)
---8<---

Thanks!

-- 
Peter Xu



  reply	other threads:[~2021-06-10 19:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-10  0:52 [PATCH 0/2] tests: migration-test: Fix agressive test skip, add dirty ring test Peter Xu
2021-06-10  0:52 ` [PATCH 1/2] tests: migration-test: Still run the rest even if uffd missing Peter Xu
2021-06-10 18:56   ` Dr. David Alan Gilbert
2021-06-10  0:52 ` [PATCH 2/2] tests: migration-test: Add dirty ring test Peter Xu
2021-06-10 19:01   ` Dr. David Alan Gilbert
2021-06-10 19:32     ` Peter Xu [this message]
2021-06-14 17:55       ` Dr. David Alan Gilbert

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=YMJoy7rPDNNJpyVr@t490s \
    --to=peterx@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=lsoaresp@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).