[PATCH 2/3] powerpc/powernv: Encapsulate idle preparation steps in a macro

Shreyas B Prabhu shreyas at linux.vnet.ibm.com
Sat Mar 19 01:53:24 AEDT 2016


Hi Paul,

On 03/17/2016 04:45 PM, Paul Mackerras wrote:
> On Mon, Feb 29, 2016 at 05:52:59PM +0530, Shreyas B. Prabhu wrote:
>> Before entering any idle state which can result in a state loss
>> we currently save the context in the stack before entering idle.
>> Encapsulate these steps in a macro IDLE_STATE_PREP. Move this
>> and other macros to commonly accessible location.
> 
> There are two problems with this.  First, your new macro does much
> more than create a stack frame and save some registers.  It also
> messes with interrupts and potentially executes a blr instruction.
> That is not what people would expect from the name of the macro or the
> comments around it.  It also means that it would be hard to reuse the
> macro in another place.
> 
> Secondly, I don't think this change helps readability.  Since the
> macro is only used in one place, it doesn't reduce the total number of
> lines of code, in fact it increases it slightly. 

This patch was in preparation for support for new POWER ISA v3 idle
states. The idea was to have the common idle preparation steps in a
macro which be reused while adding support for the new idle states. With
this context do you think this macro with better comments make sense?


Thanks,
Shreyas



More information about the Linuxppc-dev mailing list