Re: [RFC 0/5] Making KVM_GET_ONE_REG/KVM_SET_ONE_REG generic.

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

 



Avi Kivity <avi@xxxxxxxxxx> writes:
>> -Capability: basic
>> +Capability: KVM_CAP_REG_LIST
>>  Architectures: arm
>
> all

OK, I guess that's to be true in future.  Fixed.

>>  Type: vcpu ioctl
>> -Parameters: struct kvm_msr_list (in/out)
>> +Parameters: struct kvm_reg_list (in/out)
>>  Returns: 0 on success; -1 on error
>>  Errors:
>> -  E2BIG:     the msr index list is too big to fit in the array specified by
>> -             the user.
>> +  E2BIG:     the reg index list is too big to fit in the array specified by
>> +             the user (the number required will be written into n).
>>  
>>  struct kvm_msr_list {
>> -	__u32 nmsrs; /* number of msrs in entries */
>> -	__u32 indices[0];
>> +	__u64 n; /* number of registers in reg[] */
>> +	__u64 reg[0];
>>  };
>>  
>
> People complain that this interface is hard to use.
>
> How about supplying the address of the array (in addition to n) so you
> don't have to deal with variable sized arrays, and dropping E2BIG in
> favour of always updating n (n changed to something bigger than you had
> -> reallocate and rerun)

We re-write n anyway, *and* return -E2BIG.  Not returning an error is
asking for trouble.

Passing an address in a struct is pretty bad, since it involves
compatibility wrappers.  I don't think that is what makes the API hard
to use.

Cheers,
Rusty.
_______________________________________________
kvmarm mailing list
kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/cucslists/listinfo/kvmarm


[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux