Subject: Re: [PATCH v2] Make 83xx perfmon support selectable

From: Scott Wood <[email-masked]>
Date: Fri, 21 Mar 2008 11:24:01 -0500

On Thu, Mar 20, 2008 at 07:59:41PM -0400, Jerry Van Baren wrote:
> Per Andy (and my limited reading of the UMs), some 83xx have the PMR  
> registers and some don't.  The compiler either supports the PMR register  
> or it doesn't.  If you make it runtime configurable, people running CPUs  
> that don't support the specific PMR will have to change compiler  
> configurations in order to compile with the PMR register in there (could  
> have unintended consequences).

I'm not saying make it runtime-only -- you can still have a config option to
determine whether to build a kernel that supports it.  I'm saying there
should be an additional runtime check so that if you run a multiplatform
kernel with perfmon enabled on a chip that doesn't support it, you won't
take a program check.

> Also, if you look at the code (arch/powerpc/kernel/pmc.c), there are  
> several different types of PMR registers, based on the core and flavor  
> of the core.  Finding or making a compiler setup that supports all of  
> the possible PMR registers could be a problem.

It only needs to support all possible registers within a class of hardware
over which we support multiplatform kernels.

> You would still have to make the PMR read/write runtime selectable  
> because the CPUs that don't support that register will raise an  
> exception IIRC (an Really Bad Thing[tm]).

Yes, that was my point.  The changelog on the patch seemed to indicate that
the compile-time option was intended to address this, not just the toolchain
problem.

-Scott