On 15/11/2016 21:44, Laurent Vivier wrote: > > > On 15/11/2016 21:39, Laurent Vivier wrote: >> >> >> On 15/11/2016 20:00, Eric Blake wrote: >>> On 11/15/2016 12:48 PM, Thomas Huth wrote: >>> >>>>> Even for Power, I'd prefer to keep KVM since the problem only happens with >>>>> KVM PR which isn't the preferred way to do KVM on bare metal... until this >>>>> get fixed, I'd rather suggest people to run make check with KVM HV. >>>> >>>> OK ... what do you think about a patch like this: >>>> >>>> diff --git a/tests/postcopy-test.c b/tests/postcopy-test.c >>>> --- a/tests/postcopy-test.c >>>> +++ b/tests/postcopy-test.c >>>> @@ -380,17 +380,19 @@ static void test_migrate(void) >>>> " -incoming %s", >>>> tmpfs, bootpath, uri); >>>> } else if (strcmp(arch, "ppc64") == 0) { >>>> + const char *accel; >>>> init_bootfile_ppc(bootpath); >>>> - cmd_src = g_strdup_printf("-machine accel=kvm:tcg -m 256M" >>>> + accel = system("/sbin/lsmod | grep -q kvm_hv") ? "tcg" : >>>> "kvm:tcg"; >>> >>> Unsafe use of system() (all I have to do is stick a counterfeit 'grep' >>> earlier on my PATH to mess you up). Is there a safer way to grab that >>> information without having to call out to the shell? >> >> I think trying to open "/dev/kvm" would be enough to know if kvm is >> available or not. > > OK, I've missed you want to check KVM HV only...
So, I think you can check for "/sys/module/kvm_hv" Laurent