From: "Jan Beulich" Subject: Re: [PATCH v16 14/23] x86/VPMU: Initialize VPMUs with __initcall Date: Thu, 18 Dec 2014 14:52:56 +0000 Message-ID: <5492F8580200007800050B4D@mail.emea.novell.com> References: <1418830734-1558-1-git-send-email-boris.ostrovsky@oracle.com> <1418830734-1558-15-git-send-email-boris.ostrovsky@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1418830734-1558-15-git-send-email-boris.ostrovsky@oracle.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Boris Ostrovsky Cc: kevin.tian@intel.com, suravee.suthikulpanit@amd.com, andrew.cooper3@citrix.com, tim@xen.org, dietmar.hahn@ts.fujitsu.com, xen-devel@lists.xen.org, Aravind.Gopalakrishnan@amd.com, jun.nakajima@intel.com, dgdegra@tycho.nsa.gov List-Id: xen-devel@lists.xenproject.org >>> On 17.12.14 at 16:38, wrote: > +int __init amd_vpmu_init(void) > +{ > + if ( current_cpu_data.x86_vendor != X86_VENDOR_AMD ) > + return -EINVAL; Your only caller guarantees this not to be the case. > +int __init core2_vpmu_init(void) > +{ > + u64 caps; > + > + if ( current_cpu_data.x86_vendor != X86_VENDOR_INTEL ) > + return -EINVAL; Same here. > +static int __init vpmu_init(void) > +{ > + int vendor = current_cpu_data.x86_vendor; > + > + if ( vpmu_mode == XENPMU_MODE_OFF ) > + { > + printk(XENLOG_INFO "VPMU: disabled\n"); > + return 0; > + } > + > + switch ( vendor ) > + { > + case X86_VENDOR_AMD: > + if ( amd_vpmu_init() ) > + vpmu_mode = XENPMU_MODE_OFF; > + break; > + case X86_VENDOR_INTEL: > + if ( core2_vpmu_init() ) > + vpmu_mode = XENPMU_MODE_OFF; > + break; > + default: > + printk(XENLOG_WARNING "VPMU: Unknown CPU vendor: %d\n", vendor); > + vpmu_mode = XENPMU_MODE_OFF; Case labels indented to the same level as the containing switch please, and break missing here. > + } > + > + if ( vpmu_mode == XENPMU_MODE_OFF ) > + printk(XENLOG_WARNING "VPMU: Disabling due to initialization error\n"); > + else > + printk(XENLOG_INFO "VPMU: version %d.%d\n", > + XENPMU_VER_MAJ, XENPMU_VER_MIN); Use __stringify()? Jan