linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bhelgaas@google.com>
To: Taku Izumi <izumi.taku@jp.fujitsu.com>
Cc: linux-pci@vger.kernel.org, yinghai@kernel.org,
	Rajat Jain <rajatxjain@gmail.com>
Subject: Re: [PATCH] PCI: pciehp: Fix the problem that the present bit is not cleared though slot is empty
Date: Tue, 11 Feb 2014 17:49:27 -0700	[thread overview]
Message-ID: <20140212004927.GH21057@google.com> (raw)
In-Reply-To: <20140203160724.949a0ee5.izumi.taku@jp.fujitsu.com>

[+cc Rajat]

On Mon, Feb 03, 2014 at 04:07:24PM +0900, Taku Izumi wrote:
> 
> I found the problem that the present bit does not be cleared
> though the slot is empty.
> 
>  Step to reproduce:
> 
>   # cd /sys/bus/pci/slots/66
>   # cat adapter
>   0
>   --- (insert PCIe card on slot#66) ---
>   # cat adapter
>   1
>   # echo 1 > power
>   # echo 0 > power
>   --- (eject PCIe card on slot#66) ---
>   # cat adapter
>   1
>     ==> should be 0.
> 
> According to git-bisect this is caused by:
>     2debd9289997fc5d1c0043b41201a8b40d5e11d0
>        PCI: pciehp: Disable/enable link during slot power off/on
>     is the first bad commit
> 
> By reverting the above patch, this bug can be solved.
> And I also found this can be fixed by changing the timing of link-disable
> during power off the slot.
> So, this patch changes the timing of link-disable during power off.

Hi Taku,

Thanks a lot for finding and bisecting this problem.  I recently merged
some patches from Rajat that partially revert 2debd9289997.  Can you try
out my pci/pciehp branch and see whether it is enough to fix the problem
for you?

Here's the branch:
http://git.kernel.org/cgit/linux/kernel/git/helgaas/pci.git/log/?h=pci/pciehp

and the specific change Rajat made is:
http://git.kernel.org/cgit/linux/kernel/git/helgaas/pci.git/commit/?h=pci/pciehp&id=b1811d2455f32754cc3d8725bf2e961c5eda2a72

Let me know if that isn't enough to fix the problem you're seeing, and we
can work on it some more.

Bjorn

> 
> Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
> ---
>  drivers/pci/hotplug/pciehp_hpc.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
> index 14acfcc..163f0b4 100644
> --- a/drivers/pci/hotplug/pciehp_hpc.c
> +++ b/drivers/pci/hotplug/pciehp_hpc.c
> @@ -508,7 +508,12 @@ void pciehp_power_off_slot(struct slot * slot)
>  {
>  	struct controller *ctrl = slot->ctrl;
>  
> -	/* Disable the link at first */
> +	pcie_write_cmd(ctrl, PCI_EXP_SLTCTL_PWR_OFF, PCI_EXP_SLTCTL_PCC);
> +	ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", __func__,
> +		 pci_pcie_cap(ctrl->pcie->port) + PCI_EXP_SLTCTL,
> +		 PCI_EXP_SLTCTL_PWR_OFF);
> +
> +	/* Disable the link */
>  	pciehp_link_disable(ctrl);
>  	/* wait the link is down */
>  	if (ctrl->link_active_reporting)
> @@ -516,10 +521,6 @@ void pciehp_power_off_slot(struct slot * slot)
>  	else
>  		msleep(1000);
>  
> -	pcie_write_cmd(ctrl, PCI_EXP_SLTCTL_PWR_OFF, PCI_EXP_SLTCTL_PCC);
> -	ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", __func__,
> -		 pci_pcie_cap(ctrl->pcie->port) + PCI_EXP_SLTCTL,
> -		 PCI_EXP_SLTCTL_PWR_OFF);
>  }
>  
>  static irqreturn_t pcie_isr(int irq, void *dev_id)
> -- 
> 1.8.3.1
> 

  reply	other threads:[~2014-02-12  0:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-03  7:07 [PATCH] PCI: pciehp: Fix the problem that the present bit is not cleared though slot is empty Taku Izumi
2014-02-12  0:49 ` Bjorn Helgaas [this message]
2014-02-12  8:00   ` Izumi, Taku
2014-02-12 16:56     ` Bjorn Helgaas
2014-02-12 18:11       ` Rajat Jain
2014-02-13  8:00         ` Izumi, Taku
2014-02-13 16:03           ` Rajat Jain
2014-02-13 16:37             ` Takashi Iwai
2014-02-13 17:56               ` Rajat Jain
2014-02-14  7:21             ` Izumi, Taku
2014-02-14  7:26               ` Rajat Jain
2014-02-14 17:31               ` Bjorn Helgaas
2014-02-14 19:39                 ` Rajat Jain
2014-02-18 23:02                   ` Bjorn Helgaas
2014-02-19  2:54                     ` Rajat Jain
2014-02-25  3:02                   ` Rajat Jain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140212004927.GH21057@google.com \
    --to=bhelgaas@google.com \
    --cc=izumi.taku@jp.fujitsu.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=rajatxjain@gmail.com \
    --cc=yinghai@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).