* Peter Xu (pet...@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 <dgilb...@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 / dgilb...@redhat.com / Manchester, UK


Reply via email to