From patchwork Wed Jan 4 12:00:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 9497125 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 00F82606B4 for ; Wed, 4 Jan 2017 18:06:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF8C42811E for ; Wed, 4 Jan 2017 18:06:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E452A28179; Wed, 4 Jan 2017 18:06:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 546F52811E for ; Wed, 4 Jan 2017 18:06:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1CE836E796; Wed, 4 Jan 2017 18:06:15 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllnx209.ext.ti.com (fllnx209.ext.ti.com [198.47.19.16]) by gabe.freedesktop.org (Postfix) with ESMTPS id 671B96E24A for ; Wed, 4 Jan 2017 12:01:00 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id v04C0cOn011819; Wed, 4 Jan 2017 06:00:38 -0600 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v04C0bvi021807; Wed, 4 Jan 2017 06:00:38 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.294.0; Wed, 4 Jan 2017 06:00:37 -0600 Received: from feketebors.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id v04C0YAS024920; Wed, 4 Jan 2017 06:00:35 -0600 From: Peter Ujfalusi To: , , , Subject: [PATCH] drm: Schedule the output_poll_work with 1s delay if we have delayed event Date: Wed, 4 Jan 2017 14:00:53 +0200 Message-ID: <20170104120053.31882-1-peter.ujfalusi@ti.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 04 Jan 2017 18:06:13 +0000 Cc: gleb@fastmail.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, freedesktop-bugs@PaulSD.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Instead of scheduling the work to handle the initial delayed event, use 1s delay. When the delayed event is handled w/o delay - in a similar matter when the poll had been initialized before drm_helper_probe_single_connector_modes() is called - it triggers a race in Optimus setups. Fixes: 339fd36238dd ("drm: drm_probe_helper: Fix output_poll_work scheduling") Cc: stable@vger.kernel.org # v4.9 Signed-off-by: Peter Ujfalusi --- Hi, related bug report: https://bugs.freedesktop.org/show_bug.cgi?id=98690 Regards, Peter drivers/gpu/drm/drm_probe_helper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c index 98ed110e28ed..f30c14b0a72f 100644 --- a/drivers/gpu/drm/drm_probe_helper.c +++ b/drivers/gpu/drm/drm_probe_helper.c @@ -146,8 +146,9 @@ void drm_kms_helper_poll_enable_locked(struct drm_device *dev) drm_connector_list_iter_put(&conn_iter); if (dev->mode_config.delayed_event) { + /* Use short (1s) delay to handle the initial delayed event */ poll = true; - delay = 0; + delay = HZ; } if (poll)