[PATCH RFC 05/15] powerpc/eeh: Sync eeh_pe_get_parent()
Sam Bobroff
sbobroff at linux.ibm.com
Wed Oct 2 16:02:43 AEST 2019
Synchronize access to eeh_pe.
Signed-off-by: Sam Bobroff <sbobroff at linux.ibm.com>
---
arch/powerpc/kernel/eeh_pe.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/kernel/eeh_pe.c b/arch/powerpc/kernel/eeh_pe.c
index b89ed46f14e6..0486d3c6ff20 100644
--- a/arch/powerpc/kernel/eeh_pe.c
+++ b/arch/powerpc/kernel/eeh_pe.c
@@ -469,10 +469,12 @@ struct eeh_pe *eeh_pe_find(struct pci_controller *phb,
* The whole PEs existing in the system are organized as hierarchy
* tree. The function is used to retrieve the parent PE according
* to the parent EEH device.
+ * Returns a referenced PE.
*/
static struct eeh_pe *eeh_pe_get_parent(struct eeh_dev *edev)
{
struct eeh_dev *parent;
+ struct eeh_pe *pe;
struct pci_dn *pdn = eeh_dev_to_pdn(edev);
/*
@@ -490,8 +492,14 @@ static struct eeh_pe *eeh_pe_get_parent(struct eeh_dev *edev)
if (!parent)
return NULL;
- if (parent->pe)
- return parent->pe;
+ if (parent->pe) {
+ /* TODO: Unsafe until eeh_dev can be synchronized
+ * with eeh_pe.
+ */
+ pe = parent->pe;
+ eeh_get_pe(pe);
+ return pe;
+ }
pdn = pdn->parent;
}
--
2.22.0.216.g00a2a96fc9
More information about the Linuxppc-dev
mailing list