Re: [PATCH v3] powerpc/pseries: use pci_host_bridge.release_fn() to kfree(phb)

2016-08-11 Thread Mauricio Faria de Oliveira
Hi Gavin, tl;dr: thanks for the comments & suggestions; i'll submit v4. On 08/11/2016 03:40 AM, Gavin Shan wrote: [added some line breaks] It seems the user has two options here: (1) Setup bridge's release_fn() and call pcibios_free_controller() explicitly; I think the v3 design was non-in

Re: [PATCH v3] powerpc/pseries: use pci_host_bridge.release_fn() to kfree(phb)

2016-08-11 Thread Mauricio Faria de Oliveira
On 08/11/2016 02:01 AM, Andrew Donnellan wrote: In cxl, we currently call: pci_remove_root_bus(phb->bus); pcibios_free_controller(phb); which appears to break with this patch after I wire up pci_set_host_bridge_release() in cxl, as phb can be freed before we call pcibios_free_controller

Re: [PATCH v3] powerpc/pseries: use pci_host_bridge.release_fn() to kfree(phb)

2016-08-11 Thread Andrew Donnellan
On 11/08/16 16:29, Gavin Shan wrote: On Thu, Aug 11, 2016 at 03:01:44PM +1000, Andrew Donnellan wrote: On 11/08/16 07:45, Mauricio Faria de Oliveira wrote: In cxl, we currently call: pci_remove_root_bus(phb->bus); pcibios_free_controller(phb); which appears to break with thi

Re: [PATCH v3] powerpc/pseries: use pci_host_bridge.release_fn() to kfree(phb)

2016-08-10 Thread Gavin Shan
On Wed, Aug 10, 2016 at 06:45:22PM -0300, Mauricio Faria de Oliveira wrote: >This patch leverages 'struct pci_host_bridge' from the PCI subsystem >in order to free the pci_controller only after the last reference to >its devices is dropped (avoiding an oops in pcibios_release_device() >if the last

Re: [PATCH v3] powerpc/pseries: use pci_host_bridge.release_fn() to kfree(phb)

2016-08-10 Thread Gavin Shan
On Thu, Aug 11, 2016 at 03:01:44PM +1000, Andrew Donnellan wrote: >On 11/08/16 07:45, Mauricio Faria de Oliveira wrote: > >In cxl, we currently call: > > pci_remove_root_bus(phb->bus); > pcibios_free_controller(phb); > >which appears to break with this patch after I wire up >pci_set_hos

Re: [PATCH v3] powerpc/pseries: use pci_host_bridge.release_fn() to kfree(phb)

2016-08-10 Thread Andrew Donnellan
On 11/08/16 07:45, Mauricio Faria de Oliveira wrote: This patch leverages 'struct pci_host_bridge' from the PCI subsystem in order to free the pci_controller only after the last reference to its devices is dropped (avoiding an oops in pcibios_release_device() if the last reference is dropped afte

Re: [PATCH v3] powerpc/pseries: use pci_host_bridge.release_fn() to kfree(phb)

2016-08-10 Thread Mauricio Faria de Oliveira
On 08/10/2016 06:45 PM, Mauricio Faria de Oliveira wrote: Changelog: - v3: different approach: struct pci_host_bridge.release_fn() - v2: different approach: struct pci_controller.refcount Oops, the v3 submission has no cover letter, so the subject changed a bit from what was in v2. This is t

[PATCH v3] powerpc/pseries: use pci_host_bridge.release_fn() to kfree(phb)

2016-08-10 Thread Mauricio Faria de Oliveira
This patch leverages 'struct pci_host_bridge' from the PCI subsystem in order to free the pci_controller only after the last reference to its devices is dropped (avoiding an oops in pcibios_release_device() if the last reference is dropped after pcibios_free_controller()). The patch relies on pci_