On 30 July 2012 19:22, <[email protected]> wrote:
> +static int kvm_max_vcpus(KVMState *s)
> +{
> + int max_vcpus = 4;
> + int ret;
> + ret = kvm_check_extension(s, KVM_CAP_MAX_VCPUS);
> + if (ret) {
> + max_vcpus = ret;
> + } else {
> + ret = kvm_check_extension(s, KVM_CAP_NR_VCPUS);
> + if (ret) {
> + max_vcpus = ret;
> + }
> + }
> +
> + return max_vcpus;
> +}
A small thing, but I think having code flow like:
/* Find number of supported CPUs using the recommended
* procedure from the kernel API documentation to cope with
* older kernels that may be missing capabilities.
*/
ret = kvm_check_extension(s, KVM_CAP_MAX_VCPUS);
if (ret) {
return ret;
}
ret = kvm_check_extension(s, KVM_CAP_NR_VCPUS);
if (ret) {
return ret;
}
return 4;
would be clearer.
(also I think a comment helps suggest that 4 isn't a magic
number we made up ourselves :-))
-- PMM
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html