From: Daniel Vetter Subject: Re: [PATCH v2] drm/i915: Discard previous atomic state on resume if connectors change Date: Mon, 9 May 2016 16:53:51 +0200 Message-ID: <20160509145351.GB27098@phenom.ffwll.local> References: <1462570796-22500-1-git-send-email-cpaul@redhat.com> <20160509064214.GH27098@phenom.ffwll.local> <1462802828.8121.8.camel@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Content-Disposition: inline In-Reply-To: <1462802828.8121.8.camel@redhat.com> Sender: stable-owner@vger.kernel.org To: Lyude Paul Cc: Daniel Vetter , intel-gfx@lists.freedesktop.org, stable@vger.kernel.org, "open list:INTEL DRM DRIVERS excluding Poulsbo, Moorestow..., linux-kernel@vger.kernel.org open list" , Daniel Vetter List-Id: dri-devel@lists.freedesktop.org On Mon, May 09, 2016 at 10:07:08AM -0400, Lyude Paul wrote: > Yep, Dave's patches fix the issue on their own so this is only going = to be > needed for 4.6. Ok, so not the first one that only needs to be applied to stable kernel= s. =46or that to work you need to explain that this is the most minimal fi= x for stabel kernels, and add a reference to the final commit in upstream tha= t fixes the issue for real. Otherwise Greg KH won't take it. It still nee= ds my ack. Probably best to have an entire dp mst series for all of those, but may= be ping me first on irc so I can check them quickly before you hit send. -Daniel >=20 > On Mon, 2016-05-09 at 08:42 +0200, Daniel Vetter wrote: > > On Fri, May 06, 2016 at 05:39:56PM -0400, Lyude wrote: > > >=20 > > > If an MST device is disconnected while the machine is suspended, = the > > > number of connectors will change as well after we call > > > intel_dp_mst_resume(). This means that any previous atomic state = we had > > > before suspending is no longer valid, since it'll still be pointi= ng to > > > missing connectors. We need to check for this before committing t= he > > > state, otherwise we'll kernel panic on resume whenever if any MST > > > display was disconnected before we started resuming: > > >=20 > > > BUG: unable to handle kernel NULL pointer dereference at 00000000= 00000008 > > > IP: [] drm_atomic_helper_check_modeset+0x29f/0x= b40 > > > [drm_kms_helper] > > > Call Trace: > > > =A0[] intel_atomic_check+0x34/0x1180 [i915] > > > =A0[] ? mark_held_locks+0x6f/0xa0 > > > =A0[] ? trace_hardirqs_on_caller+0x129/0x1b0 > > > =A0[] drm_atomic_check_only+0x192/0x620 [drm] > > > =A0[] ? pci_pm_thaw+0x21/0x90 > > > =A0[] drm_atomic_commit+0x17/0x60 [drm] > > > =A0[] intel_display_resume+0xbd/0x160 [i915] > > > =A0[] ? pci_pm_thaw+0x90/0x90 > > > =A0[] i915_drm_resume+0xd8/0x160 [i915] > > > =A0[] i915_pm_resume+0x25/0x30 [i915] > > > =A0[] pci_pm_resume+0x64/0xa0 > > > =A0[] dpm_run_callback+0x90/0x190 > > > =A0[] device_resume+0xd5/0x1f0 > > > =A0[] async_resume+0x1d/0x50 > > > =A0[] async_run_entry_fn+0x48/0x150 > > > =A0[] process_one_work+0x1e9/0x5c0 > > > =A0[] ? process_one_work+0x166/0x5c0 > > > =A0[] worker_thread+0x48/0x4e0 > > > =A0[] ? process_one_work+0x5c0/0x5c0 > > > =A0[] kthread+0xe4/0x100 > > > =A0[] ret_from_fork+0x22/0x50 > > > =A0[] ? kthread_create_on_node+0x200/0x200 > > >=20 > > > Changes since v1: > > > =A0 - Move drm_atomic_state_free() call down so we're holding the > > > =A0=A0=A0=A0appropriate locks when destroying the atomic state > > >=20 > > > Cc: stable@vger.kernel.org > > > Signed-off-by: Lyude > > Is this still an issue on -nightly with the connector refcounting f= ixed? > > -Daniel > >=20 > > >=20 > > > --- > > > =A0drivers/gpu/drm/i915/intel_display.c | 12 ++++++++++++ > > > =A01 file changed, 12 insertions(+) > > >=20 > > > diff --git a/drivers/gpu/drm/i915/intel_display.c > > > b/drivers/gpu/drm/i915/intel_display.c > > > index 0f29ef6..d68efc7 100644 > > > --- a/drivers/gpu/drm/i915/intel_display.c > > > +++ b/drivers/gpu/drm/i915/intel_display.c > > > @@ -15934,6 +15934,18 @@ void intel_display_resume(struct drm_dev= ice *dev) > > > =A0retry: > > > =A0 ret =3D drm_modeset_lock_all_ctx(dev, &ctx); > > > =A0 > > > + /* > > > + =A0* With MST, the number of connectors can change between susp= end > > > and > > > + =A0* resume, which means that the state we want to restore migh= t now > > > be > > > + =A0* impossible to use since it'll be pointing to non-existant > > > + =A0* connectors. > > > + =A0*/ > > > + if (ret =3D=3D 0 && > > > + =A0=A0=A0=A0state->num_connector !=3D dev->mode_config.num_conn= ector) { > > > + drm_atomic_state_free(state); > > > + state =3D NULL; > > > + } > > > + > > > =A0 if (ret =3D=3D 0 && !setup) { > > > =A0 setup =3D true; > > > =A0 > > > --=A0 > > > 2.5.5 > > >=20 > > > _______________________________________________ > > > dri-devel mailing list > > > dri-devel@lists.freedesktop.org > > > https://lists.freedesktop.org/mailman/listinfo/dri-devel > --=20 > Cheers, > Lyude >=20 --=20 Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch