From: Bjorn Helgaas <helgaas@kernel.org>
To: Pankaj Dubey <pankaj.dubey@samsung.com>
Cc: David Laight <David.Laight@ACULAB.COM>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Kishon Vijay Abraham I <kishon@ti.com>,
Bjorn Helgaas <bhelgaas@google.com>,
Jingoo Han <jingoohan1@gmail.com>,
Joao Pinto <Joao.Pinto@synopsys.com>
Subject: Re: [PATCH] PCI: dwc: designware: don't sleep in atomic context
Date: Fri, 20 Oct 2017 13:19:17 -0500 [thread overview]
Message-ID: <20171020181917.GL6332@bhelgaas-glaptop.roam.corp.google.com> (raw)
In-Reply-To: <70cd34bd-01db-cd93-ddf7-d82114ccc61a@samsung.com>
On Fri, Oct 13, 2017 at 09:10:38AM +0530, Pankaj Dubey wrote:
>
>
> On 10/12/2017 04:09 PM, David Laight wrote:
> >From: Pankaj Dubey
> >>Sent: 12 October 2017 08:55
> >>In pcie-designware.c many places we are calling "usleep_range" which
> >>are in atomic context. This patch fixes these potential BUGs and
> >>replaces "usleep_range" with mdelay calls.
> >>
> >>Signed-off-by: Pankaj Dubey <pankaj.dubey@samsung.com>
> >>---
> >> drivers/pci/dwc/pcie-designware.c | 8 ++++----
> >> drivers/pci/dwc/pcie-designware.h | 3 +--
> >> 2 files changed, 5 insertions(+), 6 deletions(-)
> >>
> >>diff --git a/drivers/pci/dwc/pcie-designware.c b/drivers/pci/dwc/pcie-designware.c
> >>index 88abddd..35d19b9 100644
> >>--- a/drivers/pci/dwc/pcie-designware.c
> >>+++ b/drivers/pci/dwc/pcie-designware.c
> >>@@ -138,7 +138,7 @@ static void dw_pcie_prog_outbound_atu_unroll(struct dw_pcie *pci, int index,
> >> if (val & PCIE_ATU_ENABLE)
> >> return;
> >>
> >>- usleep_range(LINK_WAIT_IATU_MIN, LINK_WAIT_IATU_MAX);
> >>+ mdelay(LINK_WAIT_IATU_MIN);
> >> }
> >Spinning for 9ms (possibly 10 times) isn't really a good idea.
>
> Yes. It may not be a good idea, however in our experiment it never
> hit maximum retry count. I just converted usleep_range to mdelay
> keeping min time limitation as it is, though I am not sure, how do
> we arrived on these numbers in original code, may be Joao Pinto from
> Synopsys have some idea, I will try to do few experiment and try to
> find out what is sufficient minimum time in our hardware for these
> mdelay.
Just based on the preceding comment, it looks like the wait is
essential because subsequent config and I/O accesses won't work
correctly until the ATU enable takes effect.
If we timeout here, I suspect it's because something is seriously
wrong in the hardware, so I doubt there's any point in trying to
minimize the timeout period. If something is that broken, it doesn't
matter whether we wait 9ms or 900ms.
Maybe the message should be more strident or maybe we should even
return failure so the caller can do something, e.g., fail an access,
instead of just printing an error and continuing on.
I'm also looking for an ack from Joao and/or Jingoo.
Bjorn
next prev parent reply other threads:[~2017-10-20 18:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20171012075438epcas2p32599c2db4ed1512c81d1039bb1ed5607@epcas2p3.samsung.com>
2017-10-12 7:54 ` Pankaj Dubey
2017-10-12 10:39 ` David Laight
2017-10-13 3:40 ` Pankaj Dubey
2017-10-20 18:19 ` Bjorn Helgaas [this message]
2017-10-23 9:14 ` David Laight
2017-11-06 19:30 ` Bjorn Helgaas
2017-12-21 16:39 ` Jingoo Han
2017-12-28 9:53 ` Pankaj Dubey
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=20171020181917.GL6332@bhelgaas-glaptop.roam.corp.google.com \
--to=helgaas@kernel.org \
--cc=David.Laight@ACULAB.COM \
--cc=Joao.Pinto@synopsys.com \
--cc=bhelgaas@google.com \
--cc=jingoohan1@gmail.com \
--cc=kishon@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=pankaj.dubey@samsung.com \
/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
all inboxes | Powered by JetHome®