Message ID | 1415366876-30811-3-git-send-email-tomasz.nowicki@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Friday 07 November 2014 14:27:54 Tomasz Nowicki wrote: > Add special pci_mmcfg_insert_lock mutex since pci_mmcfg_lock was moved > to common file. No functional changes. > > Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org> > What is the new lock protecting against? You no longer have a mutual exclusion with the other code, which looks like it is a functional change, and also incorrect. It also sounds like the code was broken after the first patch and you need this one to make it compile again. You can't do that, and instead need to change the locking rules first. Arnd
On 07.11.2014 15:09, Arnd Bergmann wrote: > On Friday 07 November 2014 14:27:54 Tomasz Nowicki wrote: >> Add special pci_mmcfg_insert_lock mutex since pci_mmcfg_lock was moved >> to common file. No functional changes. >> >> Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org> >> > > What is the new lock protecting against? You no longer have a mutual > exclusion with the other code, which looks like it is a functional > change, and also incorrect. > > It also sounds like the code was broken after the first patch and > you need this one to make it compile again. You can't do that, and > instead need to change the locking rules first. Oh, that's right! Sorry I will take a look again. Tomasz
diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c index 94c3d38..d1e45e7 100644 --- a/arch/x86/pci/mmconfig-shared.c +++ b/arch/x86/pci/mmconfig-shared.c @@ -28,6 +28,7 @@ /* Indicate if the mmcfg resources have been placed into the resource table. */ static bool pci_mmcfg_running_state; static bool pci_mmcfg_arch_init_failed; +static DEFINE_MUTEX(pci_mmcfg_insert_lock); static const char *__init pci_mmcfg_e7520(void) { @@ -566,7 +567,7 @@ int pci_mmconfig_insert(struct device *dev, u16 seg, u8 start, u8 end, if (start > end) return -EINVAL; - mutex_lock(&pci_mmcfg_lock); + mutex_lock(&pci_mmcfg_insert_lock); cfg = pci_mmconfig_lookup(seg, start); if (cfg) { if (cfg->end_bus < end) @@ -575,12 +576,12 @@ int pci_mmconfig_insert(struct device *dev, u16 seg, u8 start, u8 end, "domain %04x [bus %02x-%02x] " "only partially covers this bridge\n", cfg->segment, cfg->start_bus, cfg->end_bus); - mutex_unlock(&pci_mmcfg_lock); + mutex_unlock(&pci_mmcfg_insert_lock); return -EEXIST; } if (!addr) { - mutex_unlock(&pci_mmcfg_lock); + mutex_unlock(&pci_mmcfg_insert_lock); return -EINVAL; } @@ -621,7 +622,7 @@ int pci_mmconfig_insert(struct device *dev, u16 seg, u8 start, u8 end, kfree(cfg); } - mutex_unlock(&pci_mmcfg_lock); + mutex_unlock(&pci_mmcfg_insert_lock); return rc; }
Add special pci_mmcfg_insert_lock mutex since pci_mmcfg_lock was moved to common file. No functional changes. Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org> --- arch/x86/pci/mmconfig-shared.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)