From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com ([192.55.52.43]:42648 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388369AbeKFWpS (ORCPT ); Tue, 6 Nov 2018 17:45:18 -0500 Date: Tue, 6 Nov 2018 15:20:01 +0200 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: Chris Wilson Cc: intel-gfx@lists.freedesktop.org, stable@vger.kernel.org Subject: Re: [Intel-gfx] [PATCH] drm/i915: Don't oops during modeset shutdown after lpe audio deinit Message-ID: <20181106132001.GQ9144@intel.com> References: <20181105194604.6994-1-ville.syrjala@linux.intel.com> <154144807218.24769.14242978166683753961@skylake-alporthouse-com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <154144807218.24769.14242978166683753961@skylake-alporthouse-com> Sender: stable-owner@vger.kernel.org List-ID: On Mon, Nov 05, 2018 at 08:01:17PM +0000, Chris Wilson wrote: > Quoting Ville Syrjala (2018-11-05 19:46:04) > > From: Ville Syrj�l� > > > > We deinit the lpe audio device before we call > > drm_atomic_helper_shutdown(), which means the platform device > > may already be gone when it comes time to shut down the crtc. > > Doesn't this mean that we fail to notify the audio codec of it being > turned off? I'm wondering if we shouldn't do the display/gt idling first > (like a i915_driver_unload_prepare). Yeah, would probably be better to do the display off earlier. Not too keen on diving into that rabbit hole at this time however. > > > As we don't know when the last reference to the platform > > device gets dropped by the audio driver we can't assume that > > the device and its data are still around when turning off the > > crtc. Mark the platform device as gone as soon as we do the > > audio deinit. > > > > Cc: stable@vger.kernel.org > > Signed-off-by: Ville Syrj�l� > > --- > > drivers/gpu/drm/i915/intel_lpe_audio.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/gpu/drm/i915/intel_lpe_audio.c b/drivers/gpu/drm/i915/intel_lpe_audio.c > > index cdf19553ffac..5d5336fbe7b0 100644 > > --- a/drivers/gpu/drm/i915/intel_lpe_audio.c > > +++ b/drivers/gpu/drm/i915/intel_lpe_audio.c > > @@ -297,8 +297,10 @@ void intel_lpe_audio_teardown(struct drm_i915_private *dev_priv) > > lpe_audio_platdev_destroy(dev_priv); > > > > irq_free_desc(dev_priv->lpe_audio.irq); > > -} > > > > + dev_priv->lpe_audio.irq = -1; > > + dev_priv->lpe_audio.platdev = NULL; > > +} > > This thanks to HAS_LPE_AUDIO() (confusing macro of the day) will prevent > a use-after-free during crtc shutdown. > > Reviewed-by: Chris Wilson Thanks. Pushed. -- Ville Syrj�l� Intel