Re: [PATCH V2 3/5] KVM: x86/vPMU: Create vPMU interface for VMX and SVM

Radim Krčmář
2015-04-10T12:57:40Z

2015-04-08 12:18-0400, Wei Huang:
> +/* Called before using any PMU functions above */
> +int kvm_pmu_arch_init(struct kvm_x86_ops *x86_ops)
> +{
> + kvm_pmu_ops = x86_ops->get_pmu_ops();
> +
> + if (x86_ops && (kvm_pmu_ops = x86_ops->get_pmu_ops()) != NULL)
> + return 0;
> + else
> + return -EINVAL;
> +}
> @@ -5782,6 +5783,9 @@ int kvm_arch_init(void *opaque)
>
> kvm_timer_init();
>
> + /* init pointers of PMU operations */
> + kvm_pmu_arch_init(ops);

I missed this yesterday ... the return value isn't used, so we could
check and return here, or save all the complexity in kvm_pmu_arch_init()
when we are going to BUG anyway.

(Also, the comment misalignment is caused by indentation using spaces.)