From: Alex Deucher <alexdeucher@gmail.com>
To: Lyude <cpaul@redhat.com>
Cc: "amd-gfx list" <amd-gfx@lists.freedesktop.org>,
"Tom St Denis" <tom.stdenis@amd.com>,
"Jammy Zhou" <Jammy.Zhou@amd.com>,
"open list" <linux-kernel@vger.kernel.org>,
"for 3.8" <stable@vger.kernel.org>,
"open list:RADEON and AMDGPU DRM DRIVERS"
<dri-devel@lists.freedesktop.org>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Flora Cui" <Flora.Cui@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"Monk Liu" <Monk.Liu@amd.com>
Subject: Re: [PATCH] drm/amdgpu: Disable RPM helpers while reprobing connectors on resume
Date: Fri, 15 Jul 2016 14:44:17 -0400 [thread overview]
Message-ID: <CADnq5_ML-fUP9n5ANGz-rTHH52tW9gZteaNDYf2=kRB_eHrdaA@mail.gmail.com> (raw)
In-Reply-To: <1467992256-23832-1-git-send-email-cpaul@redhat.com>
On Fri, Jul 8, 2016 at 11:37 AM, Lyude <cpaul@redhat.com> wrote:
> Just about all of amdgpu's connector probing functions try to acquire
> runtime PM refs. If we try to do this in the context of
> amdgpu_resume_kms by calling drm_helper_hpd_irq_event(), we end up
> deadlocking the system.
>
> Since we're guaranteed to be holding the spinlock for RPM in
> amdgpu_resume_kms, and we already know the GPU is in working order, we
> need to prevent the RPM helpers from trying to run during the initial
> connector reprobe on resume.
>
> There's a couple of solutions I've explored for fixing this, but this
> one by far seems to be the simplest and most reliable (plus I'm pretty
> sure that's what disable_depth is there for anyway).
>
> Reproduction recipe:
> - Get any laptop dual GPUs using PRIME
> - Make sure runtime PM is enabled for amdgpu
> - Boot the machine
> - If the machine managed to boot without hanging, switch out of X to
> another VT. This should definitely cause X to hang infinitely.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Lyude <cpaul@redhat.com>
Applied. thanks!
Alex
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 6e92008..46c1fee 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -1841,7 +1841,19 @@ int amdgpu_resume_kms(struct drm_device *dev, bool resume, bool fbcon)
> }
>
> drm_kms_helper_poll_enable(dev);
> +
> + /*
> + * Most of the connector probing functions try to acquire runtime pm
> + * refs to ensure that the GPU is powered on when connector polling is
> + * performed. Since we're calling this from a runtime PM callback,
> + * trying to acquire rpm refs will cause us to deadlock.
> + *
> + * Since we're guaranteed to be holding the rpm lock, it's safe to
> + * temporarily disable the rpm helpers so this doesn't deadlock us.
> + */
> + dev->dev->power.disable_depth++;
> drm_helper_hpd_irq_event(dev);
> + dev->dev->power.disable_depth--;
>
> if (fbcon) {
> amdgpu_fbdev_set_suspend(adev, 0);
> --
> 2.7.4
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
prev parent reply other threads:[~2016-07-15 18:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-08 15:37 [PATCH] drm/amdgpu: Disable RPM helpers while reprobing connectors on resume Lyude
2016-07-15 18:44 ` Alex Deucher [this message]
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='CADnq5_ML-fUP9n5ANGz-rTHH52tW9gZteaNDYf2=kRB_eHrdaA@mail.gmail.com' \
--to=alexdeucher@gmail.com \
--cc=Flora.Cui@amd.com \
--cc=Jammy.Zhou@amd.com \
--cc=Monk.Liu@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=cpaul@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=tom.stdenis@amd.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;
as well as URLs for NNTP newsgroup(s).