Re: [Qemu-devel] [PATCH] kvm: Add helpers for checking and requiring kvm extensions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Avi Kivity <avi@xxxxxxxxxx> wrote:

Hi

> diff --git a/kvm-all.c b/kvm-all.c
> index 36659a9..1642a2a 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -64,6 +64,30 @@ struct KVMState
>  
>  static KVMState *kvm_state;
>  
> +int kvm_check_extension(int extension)
> +{
> +    int ret;
> +
> +    ret = kvm_ioctl(kvm_state, KVM_CHECK_EXTENSION, extension);
> +    if (ret < 0) {
> +        fprintf(stderr, "KVM_CHECK_EXTENSION failed: %s\n", strerror(errno));
> +        exit(1);
> +    }
> +    return ret;
> +}
>
Are you sure you want the exit(1) in this case?
With the exit() call, you are unable to check if one extension is
present at all.  And you check the return of the following code.
>      s->coalesced_mmio = 0;
>  #ifdef KVM_CAP_COALESCED_MMIO
> -    ret = kvm_ioctl(s, KVM_CHECK_EXTENSION, KVM_CAP_COALESCED_MMIO);
> -    if (ret > 0)
> -        s->coalesced_mmio = ret;
> +    s->coalesced_mmio = kvm_check_extension(KVM_CAP_COALESCED_MMIO);
>  #endif

You can remove the ifdef at this point.

Later, Juan.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux