Commit ef6a2857 authored by Gavin Shan's avatar Gavin Shan Committed by Benjamin Herrenschmidt

powerpc/eeh: Remove eeh_mutex

Originally, eeh_mutex was introduced to protect the PE hierarchy
tree and the attached EEH devices because EEH core was possiblly
running with multiple threads to access the PE hierarchy tree.
However, we now have only one kthread in EEH core. So we needn't
the eeh_mutex and just remove it.
Signed-off-by: default avatarGavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent ff1e7683
...@@ -151,7 +151,6 @@ struct eeh_ops { ...@@ -151,7 +151,6 @@ struct eeh_ops {
extern struct eeh_ops *eeh_ops; extern struct eeh_ops *eeh_ops;
extern int eeh_subsystem_enabled; extern int eeh_subsystem_enabled;
extern struct mutex eeh_mutex;
extern raw_spinlock_t confirm_error_lock; extern raw_spinlock_t confirm_error_lock;
extern int eeh_probe_mode; extern int eeh_probe_mode;
...@@ -173,16 +172,6 @@ static inline int eeh_probe_mode_dev(void) ...@@ -173,16 +172,6 @@ static inline int eeh_probe_mode_dev(void)
return (eeh_probe_mode == EEH_PROBE_MODE_DEV); return (eeh_probe_mode == EEH_PROBE_MODE_DEV);
} }
static inline void eeh_lock(void)
{
mutex_lock(&eeh_mutex);
}
static inline void eeh_unlock(void)
{
mutex_unlock(&eeh_mutex);
}
static inline void eeh_serialize_lock(unsigned long *flags) static inline void eeh_serialize_lock(unsigned long *flags)
{ {
raw_spin_lock_irqsave(&confirm_error_lock, *flags); raw_spin_lock_irqsave(&confirm_error_lock, *flags);
...@@ -271,9 +260,6 @@ static inline void eeh_add_sysfs_files(struct pci_bus *bus) { } ...@@ -271,9 +260,6 @@ static inline void eeh_add_sysfs_files(struct pci_bus *bus) { }
static inline void eeh_remove_bus_device(struct pci_dev *dev, int purge_pe) { } static inline void eeh_remove_bus_device(struct pci_dev *dev, int purge_pe) { }
static inline void eeh_lock(void) { }
static inline void eeh_unlock(void) { }
#define EEH_POSSIBLE_ERROR(val, type) (0) #define EEH_POSSIBLE_ERROR(val, type) (0)
#define EEH_IO_ERROR_VALUE(size) (-1UL) #define EEH_IO_ERROR_VALUE(size) (-1UL)
#endif /* CONFIG_EEH */ #endif /* CONFIG_EEH */
......
...@@ -103,9 +103,6 @@ EXPORT_SYMBOL(eeh_subsystem_enabled); ...@@ -103,9 +103,6 @@ EXPORT_SYMBOL(eeh_subsystem_enabled);
*/ */
int eeh_probe_mode; int eeh_probe_mode;
/* Global EEH mutex */
DEFINE_MUTEX(eeh_mutex);
/* Lock to avoid races due to multiple reports of an error */ /* Lock to avoid races due to multiple reports of an error */
DEFINE_RAW_SPINLOCK(confirm_error_lock); DEFINE_RAW_SPINLOCK(confirm_error_lock);
......
...@@ -78,9 +78,7 @@ int eeh_phb_pe_create(struct pci_controller *phb) ...@@ -78,9 +78,7 @@ int eeh_phb_pe_create(struct pci_controller *phb)
} }
/* Put it into the list */ /* Put it into the list */
eeh_lock();
list_add_tail(&pe->child, &eeh_phb_pe); list_add_tail(&pe->child, &eeh_phb_pe);
eeh_unlock();
pr_debug("EEH: Add PE for PHB#%d\n", phb->global_number); pr_debug("EEH: Add PE for PHB#%d\n", phb->global_number);
...@@ -185,20 +183,14 @@ void *eeh_pe_dev_traverse(struct eeh_pe *root, ...@@ -185,20 +183,14 @@ void *eeh_pe_dev_traverse(struct eeh_pe *root,
return NULL; return NULL;
} }
eeh_lock();
/* Traverse root PE */ /* Traverse root PE */
for (pe = root; pe; pe = eeh_pe_next(pe, root)) { for (pe = root; pe; pe = eeh_pe_next(pe, root)) {
eeh_pe_for_each_dev(pe, edev) { eeh_pe_for_each_dev(pe, edev) {
ret = fn(edev, flag); ret = fn(edev, flag);
if (ret) { if (ret)
eeh_unlock();
return ret; return ret;
} }
} }
}
eeh_unlock();
return NULL; return NULL;
} }
...@@ -305,8 +297,6 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev) ...@@ -305,8 +297,6 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)
{ {
struct eeh_pe *pe, *parent; struct eeh_pe *pe, *parent;
eeh_lock();
/* /*
* Search the PE has been existing or not according * Search the PE has been existing or not according
* to the PE address. If that has been existing, the * to the PE address. If that has been existing, the
...@@ -316,7 +306,6 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev) ...@@ -316,7 +306,6 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)
pe = eeh_pe_get(edev); pe = eeh_pe_get(edev);
if (pe && !(pe->type & EEH_PE_INVALID)) { if (pe && !(pe->type & EEH_PE_INVALID)) {
if (!edev->pe_config_addr) { if (!edev->pe_config_addr) {
eeh_unlock();
pr_err("%s: PE with addr 0x%x already exists\n", pr_err("%s: PE with addr 0x%x already exists\n",
__func__, edev->config_addr); __func__, edev->config_addr);
return -EEXIST; return -EEXIST;
...@@ -328,7 +317,6 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev) ...@@ -328,7 +317,6 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)
/* Put the edev to PE */ /* Put the edev to PE */
list_add_tail(&edev->list, &pe->edevs); list_add_tail(&edev->list, &pe->edevs);
eeh_unlock();
pr_debug("EEH: Add %s to Bus PE#%x\n", pr_debug("EEH: Add %s to Bus PE#%x\n",
edev->dn->full_name, pe->addr); edev->dn->full_name, pe->addr);
...@@ -347,7 +335,6 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev) ...@@ -347,7 +335,6 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)
parent->type &= ~EEH_PE_INVALID; parent->type &= ~EEH_PE_INVALID;
parent = parent->parent; parent = parent->parent;
} }
eeh_unlock();
pr_debug("EEH: Add %s to Device PE#%x, Parent PE#%x\n", pr_debug("EEH: Add %s to Device PE#%x, Parent PE#%x\n",
edev->dn->full_name, pe->addr, pe->parent->addr); edev->dn->full_name, pe->addr, pe->parent->addr);
...@@ -357,7 +344,6 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev) ...@@ -357,7 +344,6 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)
/* Create a new EEH PE */ /* Create a new EEH PE */
pe = eeh_pe_alloc(edev->phb, EEH_PE_DEVICE); pe = eeh_pe_alloc(edev->phb, EEH_PE_DEVICE);
if (!pe) { if (!pe) {
eeh_unlock();
pr_err("%s: out of memory!\n", __func__); pr_err("%s: out of memory!\n", __func__);
return -ENOMEM; return -ENOMEM;
} }
...@@ -385,7 +371,6 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev) ...@@ -385,7 +371,6 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)
if (!parent) { if (!parent) {
parent = eeh_phb_pe_get(edev->phb); parent = eeh_phb_pe_get(edev->phb);
if (!parent) { if (!parent) {
eeh_unlock();
pr_err("%s: No PHB PE is found (PHB Domain=%d)\n", pr_err("%s: No PHB PE is found (PHB Domain=%d)\n",
__func__, edev->phb->global_number); __func__, edev->phb->global_number);
edev->pe = NULL; edev->pe = NULL;
...@@ -402,7 +387,6 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev) ...@@ -402,7 +387,6 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)
list_add_tail(&pe->child, &parent->child_list); list_add_tail(&pe->child, &parent->child_list);
list_add_tail(&edev->list, &pe->edevs); list_add_tail(&edev->list, &pe->edevs);
edev->pe = pe; edev->pe = pe;
eeh_unlock();
pr_debug("EEH: Add %s to Device PE#%x, Parent PE#%x\n", pr_debug("EEH: Add %s to Device PE#%x, Parent PE#%x\n",
edev->dn->full_name, pe->addr, pe->parent->addr); edev->dn->full_name, pe->addr, pe->parent->addr);
...@@ -430,8 +414,6 @@ int eeh_rmv_from_parent_pe(struct eeh_dev *edev, int purge_pe) ...@@ -430,8 +414,6 @@ int eeh_rmv_from_parent_pe(struct eeh_dev *edev, int purge_pe)
return -EEXIST; return -EEXIST;
} }
eeh_lock();
/* Remove the EEH device */ /* Remove the EEH device */
pe = edev->pe; pe = edev->pe;
edev->pe = NULL; edev->pe = NULL;
...@@ -476,8 +458,6 @@ int eeh_rmv_from_parent_pe(struct eeh_dev *edev, int purge_pe) ...@@ -476,8 +458,6 @@ int eeh_rmv_from_parent_pe(struct eeh_dev *edev, int purge_pe)
pe = parent; pe = parent;
} }
eeh_unlock();
return 0; return 0;
} }
...@@ -550,9 +530,7 @@ static void *__eeh_pe_state_mark(void *data, void *flag) ...@@ -550,9 +530,7 @@ static void *__eeh_pe_state_mark(void *data, void *flag)
*/ */
void eeh_pe_state_mark(struct eeh_pe *pe, int state) void eeh_pe_state_mark(struct eeh_pe *pe, int state)
{ {
eeh_lock();
eeh_pe_traverse(pe, __eeh_pe_state_mark, &state); eeh_pe_traverse(pe, __eeh_pe_state_mark, &state);
eeh_unlock();
} }
/** /**
...@@ -586,9 +564,7 @@ static void *__eeh_pe_state_clear(void *data, void *flag) ...@@ -586,9 +564,7 @@ static void *__eeh_pe_state_clear(void *data, void *flag)
*/ */
void eeh_pe_state_clear(struct eeh_pe *pe, int state) void eeh_pe_state_clear(struct eeh_pe *pe, int state)
{ {
eeh_lock();
eeh_pe_traverse(pe, __eeh_pe_state_clear, &state); eeh_pe_traverse(pe, __eeh_pe_state_clear, &state);
eeh_unlock();
} }
/** /**
...@@ -673,8 +649,6 @@ struct pci_bus *eeh_pe_bus_get(struct eeh_pe *pe) ...@@ -673,8 +649,6 @@ struct pci_bus *eeh_pe_bus_get(struct eeh_pe *pe)
struct eeh_dev *edev; struct eeh_dev *edev;
struct pci_dev *pdev; struct pci_dev *pdev;
eeh_lock();
if (pe->type & EEH_PE_PHB) { if (pe->type & EEH_PE_PHB) {
bus = pe->phb->bus; bus = pe->phb->bus;
} else if (pe->type & EEH_PE_BUS || } else if (pe->type & EEH_PE_BUS ||
...@@ -691,7 +665,5 @@ struct pci_bus *eeh_pe_bus_get(struct eeh_pe *pe) ...@@ -691,7 +665,5 @@ struct pci_bus *eeh_pe_bus_get(struct eeh_pe *pe)
} }
out: out:
eeh_unlock();
return bus; return bus;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment