linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: Lukas Wunner <lukas@wunner.de>
Cc: "Hoyer, David" <David.Hoyer@netapp.com>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>
Subject: Re: Kernel hangs when powering up/down drive using sysfs
Date: Mon, 16 Mar 2020 11:42:00 -0700	[thread overview]
Message-ID: <20200316184200.GA1089414@dhcp-10-100-145-180.wdl.wdc.com> (raw)
In-Reply-To: <20200316181058.pidouiqrempa6qnq@wunner.de>

On Mon, Mar 16, 2020 at 07:10:58PM +0100, Lukas Wunner wrote:
> On Mon, Mar 16, 2020 at 09:15:43AM -0700, Keith Busch wrote:
> > I'm not sure why the hard-irq context is even setting the thread running
> > flag while it can still exit without handling anything. Shouldn't it leave
> > the flag cleared until knows it's actually going to do something?
> 
> No, ist_running must be set to true before the invocation of
> atomic_xchg(&ctrl->pending_events, 0).

Okay, I see what you mean.

Even with David's patch, there's still another condition that could exit
with ist_running set. It may make sense to move the setting just above
the atomic_xchg() so that clearing it doesn't need to be duplicated for
the remaining uncommon exit case.
 
> There's a time window between the atomic_xchg() and actually
> turning off the slot when pending_events is 0.  Previously we
> only checked in the sysfs functions that pending_events is 0.
> That was insufficient as we risked returning prematurely from
> the sysfs functions.  The point of ist_running is to prevent
> that.

Oh, right, I'm remembering now. And since we've a polled option for
pciehp, using synchronize_irq() from the sysfs path isn't possible.

  reply	other threads:[~2020-03-16 18:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-14 14:19 Kernel hangs when powering up/down drive using sysfs Hoyer, David
2020-03-16 16:15 ` Keith Busch
2020-03-16 18:10   ` Lukas Wunner
2020-03-16 18:42     ` Keith Busch [this message]
2020-03-18 11:53       ` Lukas Wunner
2020-03-16 18:19 ` Lukas Wunner
2020-03-16 18:25   ` Hoyer, David
2020-03-16 21:35     ` Hoyer, David
2020-03-18 11:49     ` Lukas Wunner
2020-03-18 14:06       ` Hoyer, David
2020-03-18 11:33 ` [PATCH] PCI: pciehp: Fix indefinite wait on sysfs requests Lukas Wunner
2020-03-18 16:43   ` Keith Busch
2020-03-28 20:25   ` Bjorn Helgaas

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=20200316184200.GA1089414@dhcp-10-100-145-180.wdl.wdc.com \
    --to=kbusch@kernel.org \
    --cc=David.Hoyer@netapp.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=lukas@wunner.de \
    /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).