public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexey Khoroshilov <khoroshilov@ispras.ru>
To: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>,
	David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	ldv-project@linuxtesting.org
Subject: drm/gma500: Possible deadlock in gma_power_begin()
Date: Sat, 28 Feb 2015 18:02:33 +0300	[thread overview]
Message-ID: <54F1D889.40207@ispras.ru> (raw)

gma_power_begin() starts with locking power_ctrl_lock spinlock and then,
if gma_resume_pci(dev->pdev) succeed, it calls
  psb_irq_preinstall(dev);
  psb_irq_postinstall(dev);

psb_irq_postinstall() does some pipestat enabling/disabling dance:
    if (dev->vblank[0].enabled)
        psb_enable_pipestat(dev_priv, 0, PIPE_VBLANK_INTERRUPT_ENABLE);
    else
        psb_disable_pipestat(dev_priv, 0, PIPE_VBLANK_INTERRUPT_ENABLE);

where
void psb_enable_pipestat(struct drm_psb_private *dev_priv, int pipe, u32
mask)
{
    if ((dev_priv->pipestat[pipe] & mask) != mask) {
        u32 reg = psb_pipestat(pipe);
        dev_priv->pipestat[pipe] |= mask;
        /* Enable the interrupt, clear any pending status */
        if (gma_power_begin(dev_priv->dev, false)) {
            u32 writeVal = PSB_RVDC32(reg);
            writeVal |= (mask | (mask >> 16));
            PSB_WVDC32(writeVal, reg);
            (void) PSB_RVDC32(reg);
            gma_power_end(dev_priv->dev);
        }
    }
}

So, if a flag in dev_priv->pipestat[pipe] is not in agreement with
dev->vblank[0].enabled,
we will have a call to gma_power_begin() again and got an unavoidable
deadlock.

Thus it seems either some code is unneeded at all or we could have a
deadlock from time to time.
What do you think?

Found by Linux Driver Verification project (linuxtesting.org).

--
Alexey Khoroshilov
Linux Verification Center, ISPRAS


             reply	other threads:[~2015-02-28 16:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-28 15:02 Alexey Khoroshilov [this message]
2015-03-02 13:36 ` drm/gma500: Possible deadlock in gma_power_begin() One Thousand Gnomes

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=54F1D889.40207@ispras.ru \
    --to=khoroshilov@ispras.ru \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ldv-project@linuxtesting.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patrik.r.jakobsson@gmail.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