From: Dave Airlie <airlied@redhat.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 2/2] drm/nouveau: Check that the device is enabled before processing interrupt
Date: Wed, 04 May 2011 14:22:30 +1000 [thread overview]
Message-ID: <1304482950.3676.24.camel@clockmaker-el6> (raw)
In-Reply-To: <1304482712.3255.135.camel@x201>
On Tue, 2011-05-03 at 22:18 -0600, Alex Williamson wrote:
> On Wed, 2011-05-04 at 13:50 +1000, Dave Airlie wrote:
> > On Mon, May 2, 2011 at 10:49 AM, Alex Williamson
> > <alex.williamson@redhat.com> wrote:
> > > We're likely to be sharing an interrupt line with other devices,
> > > which means our handler might get called after we've turned off
> > > the device via vga switcheroo. This can lead to all sorts of
> > > badness, like nv04_fifo_isr() spewing "PFIFO still angry after
> > > 100 spins, halt" to the console before the system enters a hard
> > > hang.
> > >
> > > We can avoid this by simply checking if the device is still
> > > enabled before processing an interrupt. To avoid races, flush
> > > any inflight interrupts using synchronize_irq(). Note that
> > > since pci_intx() is called after pci_save_state(),
> > > pci_restore_state() will automatically re-enable INTx.
> >
> > I still think we should just need the synchronize_irq followed by a
> > check in the irq handler for all fs,
> >
> > or is there a race there I'm missing?
>
> The synchronize_irq by itself doesn't guarantee anything. The irq
> handler could be immediately started on another CPU once that returns
> and be well past the first device read before we make it far enough
> through pci_set_power_state that the device becomes unresponsive. Can
> we guarantee that first device read in the interrupt handler will always
> be 0 or -1 in the suspend path? Even as the last milliamperes of charge
> drain out of the device?
It should always be a valid irq or 0xffffffff. It got nothing to do with
milliamperes of charge, and all to do with the PCI BAR decodes being
turned off.
> By adding the device enabled check in the interrupt handler, disabling
> the device, then calling synchronize_irq, we guarantee that the entire
> interrupt handler path is not being executed and won't be executed again
> until we re-enable the device. It does seem a bit odd, but how many
> other devices in the system are entirely powered off, with a driver
> attached and interrupt handler registered while the system is still
> humming along? Thanks,
The theory is lots. OLPC does this sort of things for its breakfast I'd
have thought.
which is why I still think we are missing something, when we D3 the
device it should be the same as suspend/resume cycle pretty much,
I'll have to think about it a bit more and maybe see what PM guys can
tell us.
mjg59 any clues?
Dave.
next prev parent reply other threads:[~2011-05-04 4:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-02 0:49 [PATCH 0/2] vga switcheroo: Prevent nouveau irq handler from kill the system Alex Williamson
2011-05-02 0:49 ` [PATCH 1/2] vga_switcheroo: Remove unbalanced pci_enable_device Alex Williamson
2011-05-04 3:49 ` Dave Airlie
2011-05-04 3:49 ` Dave Airlie
2011-05-02 0:49 ` [PATCH 2/2] drm/nouveau: Check that the device is enabled before processing interrupt Alex Williamson
2011-05-04 3:50 ` Dave Airlie
2011-05-04 4:18 ` Alex Williamson
2011-05-04 4:18 ` Alex Williamson
2011-05-04 4:22 ` Dave Airlie [this message]
2011-05-04 4:47 ` Alex Williamson
2011-05-04 4:55 ` Dave Airlie
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=1304482950.3676.24.camel@clockmaker-el6 \
--to=airlied@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.