Subject: Re: [PATCH] powerpc/eeh: Validate arch in eeh_add_device_early()

From: "Guilherme G. Piccoli" <[email-masked]>
Date: Wed, 13 Jan 2016 10:08:32 -0200

On 01/13/2016 08:38 AM, Michael Ellerman wrote:
> But eeh_enabled() is still false? That seems like it's liable to cause breakage
> elsewhere.

Yes, eeh_enabled() is false as expected. Notice that eeh_enabled() is 
telling if EEH is enabled or not, and since it's not (because there's no 
PCI adapters on machine yet!), makes sense it returns false.

At the end of runs of eeh_add_device_early(), the devices are probed and 
EEH is enabled, so the function will reflect this. Notice that the 
problem addressed by this patch is the use of eeh_enabled() in hotplug 
operations only, which in my opinion is not correct. I checked every 
other use of eeh_enable() in the code, and they all seems appropriate, 
so I expect no errors at all.

> Shouldn't the PCI hotplug code instead be taught to initialise EEH correctly
> when the first device is added?

Well, for sure there are other ways to achieve this patch's goal, like 
refactor PCI hotplug code in lots of places. But notice although the 
proposed solution is simple, it solves the issue because 
eeh_add_device_early() is ultimately the function used by PCI hotplug 
mechanism (no matter if pseries/cell/etc or the type of hotplug) to 
initialize EEH by probing the devices at the moment they are added to 
the system. In my opinion, this is exactly the location we want to 
change code to address this issue.

What do you think? Thanks very much for the review.

Cheers,

Guilherme