qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Peter Xu <peterx@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: Mon, 14 Jun 2021 18:55:27 +0100	[thread overview]
Message-ID: <YMeYDzWaQdLoGFJY@work-vm> (raw)
In-Reply-To: <YMJoy7rPDNNJpyVr@t490s>

* Peter Xu (peterx@redhat.com) wrote:
> 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.

Oh in that case,

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> 
> > 
> > What happens on a BSD or the like?
> 
> Ah, good point..
> 
> How about I squash this into the patch?

I'm not sure;  I was only really worried about the build failing, I was
assuming that nothing else would have /dev/kvm so your open would fail.
Although I guess that might mean something entirely different on some
other OS, so perhaps it's worth it.

Dave

> ---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
> 
-- 
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK



      reply	other threads:[~2021-06-14 17:56 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
2021-06-14 17:55       ` Dr. David Alan Gilbert [this message]

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=YMeYDzWaQdLoGFJY@work-vm \
    --to=dgilbert@redhat.com \
    --cc=lsoaresp@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@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 NNTP newsgroup(s).