Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1451498

Re: [PATCH v2] drm/amdgpu: Disable RPM helpers while reprobing connectors on resume

Path csiph.com!aioe.org!gothmog.csi.it!bofh.it!news.nic.it!robomod
From Alex Deucher <alexdeucher@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2] drm/amdgpu: Disable RPM helpers while reprobing connectors on resume
Date Wed, 27 Jul 2016 22:40:01 +0200
Message-ID <rZDMt-4ga-5@gated-at.bofh.it> (permalink)
References <rWiXU-85S-13@gated-at.bofh.it>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=hCeSk41MRuc0FkuI+hw5LtSFbGYG/uzeXq1nAUyxybo=; b=VpFq1eOMEvzggZDVhgkQUuDIdfR3nLV01wu4dt+LqWyRJkcyckqVBvUwLbniHvlwTR X/6Sp/zvpw2q/+fGY5BSqMYHeHFSRj4966715v0te0i1LKev0IWFM+oR+v43k2rLLnFz vjDMOD/QUQGu1C2CYZvgNVU0Oez9jX3oB4G7GHY9n4DNzyFyc6XBGWYQ0kVrfGsceVAK tXtssqLD/5sx82jBrG+thFCRVCR8N9IwgM3azzw0pbR8/I0SjcPJ7Tu94dzz+QBx6nXu NV5WhnhGC6geNJZkl33KqEG2LCoxgZnH2Lk0tMJkpYeRLbGb2SoSHU4oqKZt0sntSYr0 LCpw==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=hCeSk41MRuc0FkuI+hw5LtSFbGYG/uzeXq1nAUyxybo=; b=BGrSupEbug82hB8eck9ElfzSVeD4G3T3ngZxCh44xVfrnRnNaDNPFxjQo8yqAmzaA+ zkBLhzzKg/Hu7QJBV8L3sk7jzmIaeDdAVLpC1ThjFduEwjYy0PdvqgV8vHpYLo8/w9ir AyyFm1RMv7CFpk5Dx7AL5Lryw617FTdx0wh2kQ1cT5Alvfaoef4QUhQ5rfOZqlRFEQlP jU/Eti5670lTqOscuNHPEYBOYVek9oPPl+yweI80g2SgCF8VRGA8AJAJAv3Mn3vzab89 LlR18OPlhktBryvfDHa1p6CNF9RCB6Ji8//3zU/jiWME2y9ku4u3XgHChTvDLXE3kivW dGVg==
X-Gm-Message-State AEkoouufgB1cOtFDOjjnWPq47Zh1j15VoeVoKtcX6SoLrTxL1t1VSDHasEfHafkOSayk7xhOaaQMEspcY7fmkw==
X-Received by 10.37.13.2 with SMTP id 2mr14800263ybn.116.1469651507878; Wed, 27 Jul 2016 13:31:47 -0700 (PDT)
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 71
Organization linux.* mail to news gateway
X-Original-Cc amd-gfx list <amd-gfx@lists.freedesktop.org>, "for 3.8" <stable@vger.kernel.org>, Alex Deucher <alexander.deucher@amd.com>, Christian König <christian.koenig@amd.com>, David Airlie <airlied@linux.ie>, Chunming Zhou <David1.Zhou@amd.com>, Jammy Zhou <Jammy.Zhou@amd.com>, Monk Liu <Monk.Liu@amd.com>, Flora Cui <Flora.Cui@amd.com>, Tom St Denis <tom.stdenis@amd.com>, "open list:RADEON and AMDGPU DRM DRIVERS" <dri-devel@lists.freedesktop.org>, open list <linux-kernel@vger.kernel.org>
X-Original-Date Wed, 27 Jul 2016 16:31:46 -0400
X-Original-Message-ID <CADnq5_PVAAoLH3RMPNKJ4tWWYLd+YOJ+NnxK98hE20=YU67Y1g@mail.gmail.com>
X-Original-References <1468856499-19246-1-git-send-email-cpaul@redhat.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1451498

Show key headers only | View raw


On Mon, Jul 18, 2016 at 11:41 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.
>
> Changes since v1:
>   - add appropriate #ifdef checks for CONFIG_PM. This is not very
>     useful, but it appears some kernel test suites test compiling amdgpu
>     with CONFIG_PM disabled, which results in this patch breaking the builds
>     if we don't include this #ifdef
>
> Cc: stable@vger.kernel.org
> Cc: Alex Deucher <alexdeucher@gmail.com>
> Signed-off-by: Lyude <cpaul@redhat.com>

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 6e92008..b7f5650 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -1841,7 +1841,23 @@ 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.
> +        */
> +#ifdef CONFIG_PM
> +       dev->dev->power.disable_depth++;
> +#endif
>         drm_helper_hpd_irq_event(dev);
> +#ifdef CONFIG_PM
> +       dev->dev->power.disable_depth--;
> +#endif
>
>         if (fbcon) {
>                 amdgpu_fbdev_set_suspend(adev, 0);
> --
> 2.7.4
>

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH v2] drm/amdgpu: Disable RPM helpers while reprobing  connectors on resume Alex Deucher <alexdeucher@gmail.com> - 2016-07-27 22:40 +0200

csiph-web