Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1052798pxk; Mon, 31 Aug 2020 08:32:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrxaZwkqBcxsp9YZ+64EftOZ0EYmsMukLFvbrtdLluod7BPf8j2A/y8oTL8LJfZWxws9WO X-Received: by 2002:a17:906:311a:: with SMTP id 26mr1596943ejx.43.1598887967988; Mon, 31 Aug 2020 08:32:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598887967; cv=none; d=google.com; s=arc-20160816; b=Eq8NLiUFQOLNy4kYFt4NQIkmGI5pepZM9qKcoKlRVKhGcj8PuDO4IPYNXUcwu1SIlO KRkyf87yzRWVCpx5GfCvHGnT6bLhT4cANkxiResvuq2Uq68RVfPoNafEd46VQ2Px1ZaV JLrlHO5W+hJUzvtS4mudW3ZTcqPVS8dWhFhdCLsWrhic2T+JgA7egZ90dgx3aRA29THb Qv6mcKNvKH8SkX2UHUGEYzASj8750S5Pvj76xB45HSNhcj+33FUul+0f60IVj5y5wAPl w4RqZmxfIJ8r8WdY/wilLm8HqBHjKrOE54+OUsl0KOxV8Uf9aRLzOZHwdRVxIrQ7tLBU /LUw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NnsJGU/oBCZV0szS4Ok4YAo7F6tOLdhwYomAgwHGTUU=; b=kaBDizA3fmZlGCqOEIb/MSGPtCkFsJTJAvPhfob40xYTJ3UEQZlTnCbTapIB5oD6Qu k3AnYsEqLhEnhTRf3uyydv5breCdVl6BlPamLr0EbzS9DL9e8g/+F7Fda9jHwLX0ySV6 RrrhE88h4riibCyL8IgmM5pyBqCgJ6/PMOD1qcR2brRULngZ6tBVHJgZ6GOyhhpbeAMH o3oKZBcPolJWWuuBiUru6VMibpk6B9R16krs72gAZz4y9HwPDzbAy5IhOPTAgvkuR//L uhLaB+E6dB8KmNDcSpekAM+arR8bE9l5Nmze772K8HV0LwaSbOIQw2jgk7rd3o3ebAmq BEBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WQpZIVpT; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v26si1455246eja.287.2020.08.31.08.32.24; Mon, 31 Aug 2020 08:32:47 -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=WQpZIVpT; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728633AbgHaPa0 (ORCPT + 99 others); Mon, 31 Aug 2020 11:30:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:39536 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728556AbgHaPaR (ORCPT ); Mon, 31 Aug 2020 11:30:17 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 093642145D; Mon, 31 Aug 2020 15:30:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598887816; bh=u0Pq7CiGC8BmSqyai7/cksIuozO4tsq0yXx+8eRn6Wk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WQpZIVpTV8fDcex/Lbz7RzjU1/OoBIn9jwDQA/t8WFhorzN5GmRmHuSRp82M9StMp DaX37WRM3HsMD0qLip9tHSTTCS+up2WdD30dbK5t8KC6dW0tXFFHfPw5p9UfPEVN2i JJKZfcnOedLxxhAcKuVsbZgo5Adnc6+ccvNzrUYI= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Tomi Valkeinen , Laurent Pinchart , Sasha Levin , dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 5.8 28/42] drm/omap: fix incorrect lock state Date: Mon, 31 Aug 2020 11:29:20 -0400 Message-Id: <20200831152934.1023912-28-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200831152934.1023912-1-sashal@kernel.org> References: <20200831152934.1023912-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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 fce7e944a280b..dbf91b3fd6f08 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