From mboxrd@z Thu Jan 1 00:00:00 1970 From: Radim =?utf-8?B?S3LEjW3DocWZ?= Subject: Re: [PATCH V2 3/5] KVM: x86/vPMU: Create vPMU interface for VMX and SVM Date: Fri, 10 Apr 2015 14:57:35 +0200 Message-ID: <20150410125735.GA6783@potion.brq.redhat.com> References: <1428509905-32352-1-git-send-email-wei@redhat.com> <1428509905-32352-4-git-send-email-wei@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, pbonzini@redhat.com, gleb@kernel.org To: Wei Huang Return-path: Received: from mx1.redhat.com ([209.132.183.28]:44740 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932288AbbDJM5k (ORCPT ); Fri, 10 Apr 2015 08:57:40 -0400 Content-Disposition: inline In-Reply-To: <1428509905-32352-4-git-send-email-wei@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: 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.)