Subject: Re: [PATCH] powerpc: fix oops in pcibios_release_device() after pcibios_free_controller()

From: Mauricio Faria de Oliveira <[email-masked]>
Date: Tue, 5 Jul 2016 10:34:47 -0300

On 07/04/2016 11:55 PM, Benjamin Herrenschmidt wrote:
> Have you considered instead adding a kref to the PHB and only freeing
> it when all devices have been freed ? Or it's too hard to tract device
> creation ?

Yes, considered it, but felt leery of possibly leaving the PHB unfreed
(or block until it is freed) in the call that is supposed to remove it:

for example, if it's not freed yet (because of an userspace program
that holds references, maybe misbehaving or in error)...

- Should the call block? -- in the sense of what would it mean to the
   DLPAR tools (say, drmgr and hmc) that might see a timeout as failure,
   and perhaps won't retry it?
   Or if the administrator requested the adapter/PHB to be removed,
   maybe he's aware of the situation and actually wants the removal
   to happen anyway.

- If it should not block, the phb struct would be left there at mercy
   of the reference holders, and perhaps complicate things if the PHB
   is re-added later on? (say, bring the adapter back to the LPAR)
   Could the tools think it's already added/still present, and then
   stop in error?

Now, putting the complicated scenarios aside, implementing krefs would
touch several other parts of code that I'm less comfortable to change
at this moment, which would probably take a lot more time to do.

So, for simplicity and schedule/backport/time constraints, I've shot
for a less intrusive change that still resolves the problem.

Do you think it's an acceptable solution as is, or needs change or to
be implemented in a different way?

Thanks,

-- 
Mauricio Faria de Oliveira
IBM Linux Technology Center