Re: [PATCH 3/3] pciehp: Fix race condition handling surprise link-down

2016-12-09 Thread Raj, Ashok
Hi Bjorn Thanks. I have resent the last patch again with consistent lock usage as you had requested. I did attempt to make things a bit more easier to understand in one my earlier experiments, but that resulted in very substantial changes. Certainly something we should look in future to make

Re: [PATCH 3/3] pciehp: Fix race condition handling surprise link-down

2016-12-09 Thread Raj, Ashok
Hi Bjorn Thanks. I have resent the last patch again with consistent lock usage as you had requested. I did attempt to make things a bit more easier to understand in one my earlier experiments, but that resulted in very substantial changes. Certainly something we should look in future to make

Re: [PATCH 3/3] pciehp: Fix race condition handling surprise link-down

2016-12-08 Thread Bjorn Helgaas
On Thu, Dec 08, 2016 at 12:20:58PM -0500, Keith Busch wrote: > On Thu, Dec 08, 2016 at 09:11:58AM -0600, Bjorn Helgaas wrote: > > On Wed, Dec 07, 2016 at 07:04:33PM -0500, Keith Busch wrote: > > > > > > It currently looks safe to nest the p_slot->lock under the > > > p_slot->hotplug_lock if that

Re: [PATCH 3/3] pciehp: Fix race condition handling surprise link-down

2016-12-08 Thread Bjorn Helgaas
On Thu, Dec 08, 2016 at 12:20:58PM -0500, Keith Busch wrote: > On Thu, Dec 08, 2016 at 09:11:58AM -0600, Bjorn Helgaas wrote: > > On Wed, Dec 07, 2016 at 07:04:33PM -0500, Keith Busch wrote: > > > > > > It currently looks safe to nest the p_slot->lock under the > > > p_slot->hotplug_lock if that

Re: [PATCH 3/3] pciehp: Fix race condition handling surprise link-down

2016-12-08 Thread Keith Busch
On Thu, Dec 08, 2016 at 09:11:58AM -0600, Bjorn Helgaas wrote: > On Wed, Dec 07, 2016 at 07:04:33PM -0500, Keith Busch wrote: > > > > It currently looks safe to nest the p_slot->lock under the > > p_slot->hotplug_lock if that is you recommendation. > > I'm not making a recommendation; that would

Re: [PATCH 3/3] pciehp: Fix race condition handling surprise link-down

2016-12-08 Thread Keith Busch
On Thu, Dec 08, 2016 at 09:11:58AM -0600, Bjorn Helgaas wrote: > On Wed, Dec 07, 2016 at 07:04:33PM -0500, Keith Busch wrote: > > > > It currently looks safe to nest the p_slot->lock under the > > p_slot->hotplug_lock if that is you recommendation. > > I'm not making a recommendation; that would

Re: [PATCH 3/3] pciehp: Fix race condition handling surprise link-down

2016-12-08 Thread Bjorn Helgaas
On Wed, Dec 07, 2016 at 07:04:33PM -0500, Keith Busch wrote: > On Wed, Dec 07, 2016 at 05:40:54PM -0600, Bjorn Helgaas wrote: > > On Sat, Nov 19, 2016 at 12:32:47AM -0800, Ashok Raj wrote: > > > --- a/drivers/pci/hotplug/pciehp_ctrl.c > > > +++ b/drivers/pci/hotplug/pciehp_ctrl.c > > > @@ -182,6

Re: [PATCH 3/3] pciehp: Fix race condition handling surprise link-down

2016-12-08 Thread Bjorn Helgaas
On Wed, Dec 07, 2016 at 07:04:33PM -0500, Keith Busch wrote: > On Wed, Dec 07, 2016 at 05:40:54PM -0600, Bjorn Helgaas wrote: > > On Sat, Nov 19, 2016 at 12:32:47AM -0800, Ashok Raj wrote: > > > --- a/drivers/pci/hotplug/pciehp_ctrl.c > > > +++ b/drivers/pci/hotplug/pciehp_ctrl.c > > > @@ -182,6

Re: [PATCH 3/3] pciehp: Fix race condition handling surprise link-down

2016-12-07 Thread Keith Busch
On Wed, Dec 07, 2016 at 05:40:54PM -0600, Bjorn Helgaas wrote: > On Sat, Nov 19, 2016 at 12:32:47AM -0800, Ashok Raj wrote: > > --- a/drivers/pci/hotplug/pciehp_ctrl.c > > +++ b/drivers/pci/hotplug/pciehp_ctrl.c > > @@ -182,6 +182,7 @@ static void pciehp_power_thread(struct work_struct > > *work)

Re: [PATCH 3/3] pciehp: Fix race condition handling surprise link-down

2016-12-07 Thread Keith Busch
On Wed, Dec 07, 2016 at 05:40:54PM -0600, Bjorn Helgaas wrote: > On Sat, Nov 19, 2016 at 12:32:47AM -0800, Ashok Raj wrote: > > --- a/drivers/pci/hotplug/pciehp_ctrl.c > > +++ b/drivers/pci/hotplug/pciehp_ctrl.c > > @@ -182,6 +182,7 @@ static void pciehp_power_thread(struct work_struct > > *work)

Re: [PATCH 3/3] pciehp: Fix race condition handling surprise link-down

2016-12-07 Thread Bjorn Helgaas
On Sat, Nov 19, 2016 at 12:32:47AM -0800, Ashok Raj wrote: > A surprise link down may retrain very quickly, causing the same slot to > generate a link up event before handling the link down completes. > > Since the link is active, the power off work queued from the first link > down will cause a

Re: [PATCH 3/3] pciehp: Fix race condition handling surprise link-down

2016-12-07 Thread Bjorn Helgaas
On Sat, Nov 19, 2016 at 12:32:47AM -0800, Ashok Raj wrote: > A surprise link down may retrain very quickly, causing the same slot to > generate a link up event before handling the link down completes. > > Since the link is active, the power off work queued from the first link > down will cause a

[PATCH 3/3] pciehp: Fix race condition handling surprise link-down

2016-11-19 Thread Ashok Raj
A surprise link down may retrain very quickly, causing the same slot to generate a link up event before handling the link down completes. Since the link is active, the power off work queued from the first link down will cause a second down event when the power is disabled. The second down event

[PATCH 3/3] pciehp: Fix race condition handling surprise link-down

2016-11-19 Thread Ashok Raj
A surprise link down may retrain very quickly, causing the same slot to generate a link up event before handling the link down completes. Since the link is active, the power off work queued from the first link down will cause a second down event when the power is disabled. The second down event