Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4186264pxk; Tue, 8 Sep 2020 12:58:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwcGeGgFOqRpEk9yV5LJ7wVa84dJjpVi2ChPFwp1rVB81QZcwDTi1hQmt7erVF1cYPGz0PR X-Received: by 2002:a17:906:6b0b:: with SMTP id q11mr112898ejr.412.1599595124652; Tue, 08 Sep 2020 12:58:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599595124; cv=none; d=google.com; s=arc-20160816; b=TrDlzHSD1ACklidle+KfxuutwTYWty3RVMSQqunbI6Do67LfSgP3KUWAPNhu1OkUCl MVoVfSdV3ucsOOS4e56MZPcGgexjbNdl5KRigO6i+4kanVAmSZ80QDtv32xORb46mCuY KzwY1JJvD9T8iOJQCA1NbQpxv8HUmmvtKD4KVEQNJZJr04Mkvy5wXYKsKFKVF4fa3D5C b36fdBaC1DBQvbdkpOhyzhFlNoxVVN7JBuCdd5cY1FHvUj0bxuVf3wGRX0Ds4wRIZzSa WWqb9Ys4c/KuIJo2akHpFEQL44XCxuiCzWasE0BoXBdMp34QiC0Cpl9errPWeLNODvJi vNCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VRhKyQl8iHyG1IOGYjGffufahkKNnfQAKOBPdxeEjK8=; b=JKceI+Dck68Es255UXE+wcHHxH2/FOOPBTDty5apUXBPzDC7DDFBkqIYqxwXEnSCOM RKtNI8zUkQcvl6vR/FvSnH680/p9ckB7ej3tArDQAgP2Pveb0S+iplUYzGOfD5K84n0i 7OMs3fSrW7ILAo/A4YAK6kqc1A6Firj/6q5jKC/Q+xdeVaG7YSr/UCpto21CoSWa58bD 1ce0bEnkukwv3wGkIHKTYyJw8EPDnCHeLr86muYdjULfKLsZCo5G2u/n92Ikguvmc+JR TG/MwZTHpDKNlfauZWuL7W4Ft22DPeHwSngapvdvqf5qSlwVxcHI2LZyK+S8JQrI9QEw Sq+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mzR50uws; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bn6si36464ejb.74.2020.09.08.12.58.22; Tue, 08 Sep 2020 12:58:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mzR50uws; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732539AbgIHT5r (ORCPT + 99 others); Tue, 8 Sep 2020 15:57:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:58872 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730552AbgIHPfu (ORCPT ); Tue, 8 Sep 2020 11:35:50 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3276E2256B; Tue, 8 Sep 2020 15:35:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599579308; bh=1EUNTz1A1r0KvF51vxWoUiWimGOeA2XSyupkEDGyzRA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mzR50uws6mQbvkYNxiI30E7yTbtIjjwu2w0aJ8iKCf6ZEBCKx0c78XLNtMgHLah/S GPzGoSL38gK5t4YKBmbT0j2nBpBVpZuZqVFyyEIYQcsXx2mIUVidHXvI0hCNWX7Zhm l1bQ15kLFQMfU9+zWy/4RWasW2ylVIpRkIDvkq1c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tomi Valkeinen , Laurent Pinchart , Sasha Levin Subject: [PATCH 5.8 024/186] drm/omap: fix incorrect lock state Date: Tue, 8 Sep 2020 17:22:46 +0200 Message-Id: <20200908152242.827276905@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200908152241.646390211@linuxfoundation.org> References: <20200908152241.646390211@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tomi Valkeinen [ Upstream commit 7fd5b25499bcec157dd4de9a713425efcf4571cd ] After commit 92cc68e35863c1c61c449efa2b2daef6e9926048 ("drm/vblank: Use spin_(un)lock_irq() in drm_crtc_vblank_on()") omapdrm locking is broken: WARNING: inconsistent lock state 5.8.0-rc2-00483-g92cc68e35863 #13 Tainted: G W -------------------------------- inconsistent {HARDIRQ-ON-W} -> {IN-HARDIRQ-W} usage. swapper/0/0 [HC1[1]:SC0[0]:HE0:SE1] takes: ea98222c (&dev->event_lock#2){?.+.}-{2:2}, at: drm_handle_vblank+0x4c/0x520 [drm] {HARDIRQ-ON-W} state was registered at: trace_hardirqs_on+0x9c/0x1ec _raw_spin_unlock_irq+0x20/0x58 omap_crtc_atomic_enable+0x54/0xa0 [omapdrm] drm_atomic_helper_commit_modeset_enables+0x218/0x270 [drm_kms_helper] omap_atomic_commit_tail+0x48/0xc4 [omapdrm] commit_tail+0x9c/0x190 [drm_kms_helper] drm_atomic_helper_commit+0x154/0x188 [drm_kms_helper] drm_client_modeset_commit_atomic+0x228/0x268 [drm] drm_client_modeset_commit_locked+0x60/0x1d0 [drm] drm_client_modeset_commit+0x24/0x40 [drm] drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa8 [drm_kms_helper] drm_fb_helper_set_par+0x2c/0x5c [drm_kms_helper] drm_fb_helper_hotplug_event.part.0+0xa0/0xbc [drm_kms_helper] drm_kms_helper_hotplug_event+0x24/0x30 [drm_kms_helper] output_poll_execute+0x1a8/0x1c0 [drm_kms_helper] process_one_work+0x268/0x800 worker_thread+0x30/0x4e0 kthread+0x164/0x190 ret_from_fork+0x14/0x20 The reason for this is that omapdrm calls drm_crtc_vblank_on() while holding event_lock taken with spin_lock_irq(). It is not clear why drm_crtc_vblank_on() and drm_crtc_vblank_get() are called while holding event_lock. I don't see any problem with moving those calls outside the lock, which is what this patch does. Signed-off-by: Tomi Valkeinen Link: https://patchwork.freedesktop.org/patch/msgid/20200819103021.440288-1-tomi.valkeinen@ti.com Reviewed-by: Laurent Pinchart Signed-off-by: Sasha Levin --- drivers/gpu/drm/omapdrm/omap_crtc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c index 6d40914675dad..328a4a74f534e 100644 --- a/drivers/gpu/drm/omapdrm/omap_crtc.c +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c @@ -451,11 +451,12 @@ static void omap_crtc_atomic_enable(struct drm_crtc *crtc, if (omap_state->manually_updated) return; - spin_lock_irq(&crtc->dev->event_lock); drm_crtc_vblank_on(crtc); + ret = drm_crtc_vblank_get(crtc); WARN_ON(ret != 0); + spin_lock_irq(&crtc->dev->event_lock); omap_crtc_arm_event(crtc); spin_unlock_irq(&crtc->dev->event_lock); } -- 2.25.1