From patchwork Fri Feb 2 06:43:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shradha Gupta X-Patchwork-Id: 195628 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp247843dyc; Thu, 1 Feb 2024 22:47:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IEhj2zBYhZOgbzIn+vvcmKz90Oa43+u3izv2C7Hubp+jzBIncEuMTO1ZMT8DWdr5bj3Igkr X-Received: by 2002:a05:622a:2289:b0:42b:f3ea:8974 with SMTP id ay9-20020a05622a228900b0042bf3ea8974mr4149983qtb.36.1706856468218; Thu, 01 Feb 2024 22:47:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706856468; cv=pass; d=google.com; s=arc-20160816; b=h58zBnVt+aXw855ktCkAmM2LaX6Vmu0B4HqG78t10R5rb+h15x9BF5eEi2rspDzR/V aGIn+X355TiPaU+sjGN2n58p9upPOc3iH4Aoknfi8gYLilNvUoHwrhr1jtJOt+tN9+oM 4SXVRfvq5k1anvxSmC6o5K6ouUl9+lGvukpeiq6dhlRoF5tu61q6hFyV++L0CndHkTA/ QOkLoYwC79+AYLxTi3ThegKuLyJxthxAeYbGIzNJNDbLaHm9e2Zu1NDr4DwgXJqcCIJZ D/j7P6tPvk9cohmNbqH6DbTAE3Cl/eTCSMtV6Wk6oldm7tPk5Au6mndkYwcmvaZ5y82L SQXQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :dkim-filter; bh=/bx6QDZpUAu0zrSd8HA7Hzv58wlXmlOwd1w++Z5qd8c=; fh=yvMYEBbRSu9ZURoi/GcHBtF5i17ycG18LW450l5NgyI=; b=OG9qhWrMiCEMKXkHUImlqjml3YnEGi1GRgE43BFnJNlne/yhjNPizE6LmNYeuKx2hi CtTymlQTc9F75OKfEMV9mues7GTeBEMlESm7WeYyHA/zpWviQAvvoobC4nIIPdyP5x1L JOX5EVYYNA/pltcMDN6t2Wj9AuXzLeq+f2t2gT4eYjJ2jDWDZxDbwmTQjjngaorPEQrx +MUX/WP3pdpSZ3PLBRzMZBMgDAc5gdDCkDu8uLDVZmVYWpixkwNfDLwuIVDUljowsQVG 6TywrKAZCZq/zOii3jqvWa/xG6EPxk6G8tkrBAsZmXWvcrdr8g91eawZxmV2Mm0amKaR F+Zg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=QdhZU2uW; arc=pass (i=1 spf=pass spfdomain=linux.microsoft.com dkim=pass dkdomain=linux.microsoft.com dmarc=pass fromdomain=linux.microsoft.com); spf=pass (google.com: domain of linux-kernel+bounces-49301-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49301-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com X-Forwarded-Encrypted: i=1; AJvYcCV7D2vJbrlV3xJ2ogivxs7uiremYzat7sazMaHlTWpS1/vSdkS8OWifmepPLRrGO33rNp8EofoQxjdw/ixaJ6ookjnYNg== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id o6-20020a05622a138600b0042be02b2be5si1323000qtk.136.2024.02.01.22.47.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 22:47:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-49301-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=QdhZU2uW; arc=pass (i=1 spf=pass spfdomain=linux.microsoft.com dkim=pass dkdomain=linux.microsoft.com dmarc=pass fromdomain=linux.microsoft.com); spf=pass (google.com: domain of linux-kernel+bounces-49301-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49301-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id EE37A1C253F2 for ; Fri, 2 Feb 2024 06:47:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B8DE71A28C; Fri, 2 Feb 2024 06:43:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="QdhZU2uW" Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1FB9D18E28 for ; Fri, 2 Feb 2024 06:43:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706856212; cv=none; b=IhrLvb8Zlbng0NLz0ERw19YZ5lxZbXm//enQwcGyGVqRp927EKCgtwV9JZUaZMyrb7YkiIEkqDsUgPB2N1b9drT5uv64XSv5OJUEvRRfOJKviSkO0gSrZKUX471C1g97u3JwKD7f/lgvEBNvYECm9mEG+F4zt2Z78uyqgHKwhC0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706856212; c=relaxed/simple; bh=1abfXCBdaVL06qhbdUchwr0RLvq8rUYXW2BJ8pcbj+Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=HI0SvYbmeSy1gyz6KVtwAQfG5bKgGLGr5ym56Go91sHTE0U516fbYqJACIfJx6Bezz+tS9TdpDY2cHi29yaRBhnGcdnjUnXaSHOg0vAUNIymXzZ/7IDXkxNb2k0G+3DiiSRQNERtrnLs+95Txm1BVo4TBLLkhOz9QYeRlhfLeaY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b=QdhZU2uW; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Received: by linux.microsoft.com (Postfix, from userid 1134) id C4CDD20B2000; Thu, 1 Feb 2024 22:43:30 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com C4CDD20B2000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1706856210; bh=/bx6QDZpUAu0zrSd8HA7Hzv58wlXmlOwd1w++Z5qd8c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QdhZU2uWQWHXyEgfYWLD1DveLDO8kE+lv1wiSfe5h0KXuSgz1p7NfoCb+4+WfzXRy a1F/BLKb1PQujut7dyK0vnngiK/dWsXFXVw+FAbe3U0B0dtrTeKbs2FDX8YwO5Bn9M HAqPN5ZHHobOGeyyRHWltE9/LugzXQOIasB8Yts8= From: Shradha Gupta To: linux-kernel@vger.kernel.org, Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, Saurabh Singh Sengar Cc: Shradha Gupta , Shradha Gupta Subject: [PATCH v4, 1/2] drm: Check output polling initialized before disabling Date: Thu, 1 Feb 2024 22:43:28 -0800 Message-Id: <1706856208-9617-1-git-send-email-shradhagupta@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1706856176-9483-1-git-send-email-shradhagupta@linux.microsoft.com> References: <1706856176-9483-1-git-send-email-shradhagupta@linux.microsoft.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789768728130455235 X-GMAIL-MSGID: 1789768728130455235 In drm_kms_helper_poll_disable() check if output polling support is initialized before disabling polling. If not flag this as a warning. Additionally in drm_mode_config_helper_suspend() and drm_mode_config_helper_resume() calls, that re the callers of these functions, avoid invoking them if polling is not initialized. For drivers like hyperv-drm, that do not initialize connector polling, if suspend is called without this check, it leads to suspend failure with following stack [ 770.719392] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done. [ 770.720592] printk: Suspending console(s) (use no_console_suspend to debug) [ 770.948823] ------------[ cut here ]------------ [ 770.948824] WARNING: CPU: 1 PID: 17197 at kernel/workqueue.c:3162 __flush_work.isra.0+0x212/0x230 [ 770.948831] Modules linked in: rfkill nft_counter xt_conntrack xt_owner udf nft_compat crc_itu_t nft_fib_inet nft_fib_ipv4 nft_fib_ipv6 nft_fib nft_reject_inet nf_reject_ipv4 nf_reject_ipv6 nft_reject nft_ct nft_chain_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 ip_set nf_tables nfnetlink vfat fat mlx5_ib ib_uverbs ib_core mlx5_core intel_rapl_msr intel_rapl_common kvm_amd ccp mlxfw kvm psample hyperv_drm tls drm_shmem_helper drm_kms_helper irqbypass pcspkr syscopyarea sysfillrect sysimgblt hv_balloon hv_utils joydev drm fuse xfs libcrc32c pci_hyperv pci_hyperv_intf sr_mod sd_mod cdrom t10_pi sg hv_storvsc scsi_transport_fc hv_netvsc serio_raw hyperv_keyboard hid_hyperv crct10dif_pclmul crc32_pclmul crc32c_intel hv_vmbus ghash_clmulni_intel dm_mirror dm_region_hash dm_log dm_mod [ 770.948863] CPU: 1 PID: 17197 Comm: systemd-sleep Not tainted 5.14.0-362.2.1.el9_3.x86_64 #1 [ 770.948865] Hardware name: Microsoft Corporation Virtual Machine/Virtual Machine, BIOS Hyper-V UEFI Release v4.1 05/09/2022 [ 770.948866] RIP: 0010:__flush_work.isra.0+0x212/0x230 [ 770.948869] Code: 8b 4d 00 4c 8b 45 08 89 ca 48 c1 e9 04 83 e2 08 83 e1 0f 83 ca 02 89 c8 48 0f ba 6d 00 03 e9 25 ff ff ff 0f 0b e9 4e ff ff ff <0f> 0b 45 31 ed e9 44 ff ff ff e8 8f 89 b2 00 66 66 2e 0f 1f 84 00 [ 770.948870] RSP: 0018:ffffaf4ac213fb10 EFLAGS: 00010246 [ 770.948871] RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffffff8c992857 [ 770.948872] RDX: 0000000000000001 RSI: 0000000000000001 RDI: ffff9aad82b00330 [ 770.948873] RBP: ffff9aad82b00330 R08: 0000000000000000 R09: ffff9aad87ee3d10 [ 770.948874] R10: 0000000000000200 R11: 0000000000000000 R12: ffff9aad82b00330 [ 770.948874] R13: 0000000000000001 R14: 0000000000000000 R15: 0000000000000001 [ 770.948875] FS: 00007ff1b2f6bb40(0000) GS:ffff9aaf37d00000(0000) knlGS:0000000000000000 [ 770.948878] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 770.948878] CR2: 0000555f345cb666 CR3: 00000001462dc005 CR4: 0000000000370ee0 [ 770.948879] Call Trace: [ 770.948880] [ 770.948881] ? show_trace_log_lvl+0x1c4/0x2df [ 770.948884] ? show_trace_log_lvl+0x1c4/0x2df [ 770.948886] ? __cancel_work_timer+0x103/0x190 [ 770.948887] ? __flush_work.isra.0+0x212/0x230 [ 770.948889] ? __warn+0x81/0x110 [ 770.948891] ? __flush_work.isra.0+0x212/0x230 [ 770.948892] ? report_bug+0x10a/0x140 [ 770.948895] ? handle_bug+0x3c/0x70 [ 770.948898] ? exc_invalid_op+0x14/0x70 [ 770.948899] ? asm_exc_invalid_op+0x16/0x20 [ 770.948903] ? __flush_work.isra.0+0x212/0x230 [ 770.948905] __cancel_work_timer+0x103/0x190 [ 770.948907] ? _raw_spin_unlock_irqrestore+0xa/0x30 [ 770.948910] drm_kms_helper_poll_disable+0x1e/0x40 [drm_kms_helper] [ 770.948923] drm_mode_config_helper_suspend+0x1c/0x80 [drm_kms_helper] [ 770.948933] ? __pfx_vmbus_suspend+0x10/0x10 [hv_vmbus] [ 770.948942] hyperv_vmbus_suspend+0x17/0x40 [hyperv_drm] [ 770.948944] ? __pfx_vmbus_suspend+0x10/0x10 [hv_vmbus] [ 770.948951] dpm_run_callback+0x4c/0x140 [ 770.948954] __device_suspend_noirq+0x74/0x220 [ 770.948956] dpm_noirq_suspend_devices+0x148/0x2a0 [ 770.948958] dpm_suspend_end+0x54/0xe0 [ 770.948960] create_image+0x14/0x290 [ 770.948963] hibernation_snapshot+0xd6/0x200 [ 770.948964] hibernate.cold+0x8b/0x1fb [ 770.948967] state_store+0xcd/0xd0 [ 770.948969] kernfs_fop_write_iter+0x124/0x1b0 [ 770.948973] new_sync_write+0xff/0x190 [ 770.948976] vfs_write+0x1ef/0x280 [ 770.948978] ksys_write+0x5f/0xe0 [ 770.948979] do_syscall_64+0x5c/0x90 [ 770.948981] ? syscall_exit_work+0x103/0x130 [ 770.948983] ? syscall_exit_to_user_mode+0x12/0x30 [ 770.948985] ? do_syscall_64+0x69/0x90 [ 770.948986] ? do_syscall_64+0x69/0x90 [ 770.948987] ? do_user_addr_fault+0x1d6/0x6a0 [ 770.948989] ? do_syscall_64+0x69/0x90 [ 770.948990] ? exc_page_fault+0x62/0x150 [ 770.948992] entry_SYSCALL_64_after_hwframe+0x72/0xdc [ 770.948995] RIP: 0033:0x7ff1b293eba7 [ 770.949010] Code: 0b 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b7 0f 1f 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 28 48 89 54 24 18 48 89 74 24 [ 770.949011] RSP: 002b:00007ffde3912128 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 [ 770.949012] RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 00007ff1b293eba7 [ 770.949013] RDX: 0000000000000005 RSI: 00007ffde3912210 RDI: 0000000000000004 [ 770.949014] RBP: 00007ffde3912210 R08: 000055d7dd4c9510 R09: 00007ff1b29b14e0 [ 770.949014] R10: 00007ff1b29b13e0 R11: 0000000000000246 R12: 0000000000000005 [ 770.949015] R13: 000055d7dd4c53e0 R14: 0000000000000005 R15: 00007ff1b29f69e0 [ 770.949016] [ 770.949017] ---[ end trace e6fa0618bfa2f31d ]--- Built-on: Rhel9, Ubuntu22 Signed-off-by: Shradha Gupta --- Changes in v4 * clubbed similar patches together and added a cover letter Changes in v3 * Also added checks in the _suspend and _resume calls to avoid driver bugs * Added WARN_ON around the checks in _enable and _disable calls * Fixed the patch description to reflect new changes Changes in v2 * Moved the poll_enabled check in drm_kms_helper_poll_disable() * Reworded the patch description based on new changes --- drivers/gpu/drm/drm_modeset_helper.c | 19 ++++++++++++++++--- drivers/gpu/drm/drm_probe_helper.c | 13 +++++++++++-- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_modeset_helper.c b/drivers/gpu/drm/drm_modeset_helper.c index f858dfedf2cf..2c582020cb42 100644 --- a/drivers/gpu/drm/drm_modeset_helper.c +++ b/drivers/gpu/drm/drm_modeset_helper.c @@ -193,13 +193,22 @@ int drm_mode_config_helper_suspend(struct drm_device *dev) if (!dev) return 0; + /* + * Don't disable polling if it was never initialized + */ + if (dev->mode_config.poll_enabled) + drm_kms_helper_poll_disable(dev); - drm_kms_helper_poll_disable(dev); drm_fb_helper_set_suspend_unlocked(dev->fb_helper, 1); state = drm_atomic_helper_suspend(dev); if (IS_ERR(state)) { drm_fb_helper_set_suspend_unlocked(dev->fb_helper, 0); - drm_kms_helper_poll_enable(dev); + /* + * Don't enable polling if it was never initialized + */ + if (dev->mode_config.poll_enabled) + drm_kms_helper_poll_enable(dev); + return PTR_ERR(state); } @@ -239,7 +248,11 @@ int drm_mode_config_helper_resume(struct drm_device *dev) dev->mode_config.suspend_state = NULL; drm_fb_helper_set_suspend_unlocked(dev->fb_helper, 0); - drm_kms_helper_poll_enable(dev); + /* + * Don't enable polling if it is not initialized + */ + if (dev->mode_config.poll_enabled) + drm_kms_helper_poll_enable(dev); return ret; } diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c index 3f479483d7d8..bd76603dc387 100644 --- a/drivers/gpu/drm/drm_probe_helper.c +++ b/drivers/gpu/drm/drm_probe_helper.c @@ -293,14 +293,17 @@ static void reschedule_output_poll_work(struct drm_device *dev) * Drivers can call this helper from their device resume implementation. It is * not an error to call this even when output polling isn't enabled. * + * If device polling was never initialized before, this call will trigger a + * warning and return. + * * Note that calls to enable and disable polling must be strictly ordered, which * is automatically the case when they're only call from suspend/resume * callbacks. */ void drm_kms_helper_poll_enable(struct drm_device *dev) { - if (!dev->mode_config.poll_enabled || !drm_kms_helper_poll || - dev->mode_config.poll_running) + if (drm_WARN_ON_ONCE(dev, !dev->mode_config.poll_enabled) || + !drm_kms_helper_poll || dev->mode_config.poll_running) return; if (drm_kms_helper_enable_hpd(dev) || @@ -871,12 +874,18 @@ EXPORT_SYMBOL(drm_kms_helper_is_poll_worker); * not an error to call this even when output polling isn't enabled or already * disabled. Polling is re-enabled by calling drm_kms_helper_poll_enable(). * + * If however, the polling was never initialized, this call will trigger a + * warning and return + * * Note that calls to enable and disable polling must be strictly ordered, which * is automatically the case when they're only call from suspend/resume * callbacks. */ void drm_kms_helper_poll_disable(struct drm_device *dev) { + if (drm_WARN_ON(dev, !dev->mode_config.poll_enabled)) + return; + if (dev->mode_config.poll_running) drm_kms_helper_disable_hpd(dev); From patchwork Fri Feb 2 06:43:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shradha Gupta X-Patchwork-Id: 195630 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp248249dyc; Thu, 1 Feb 2024 22:49:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IFyDfeTY+rcWQx2R8ODotMHtznXUOTT4Ssr9KGqW87uMww6uoSRqWkSnSjL34YlNwKh+cHw X-Received: by 2002:a05:6a20:c123:b0:19c:b4f1:596f with SMTP id bh35-20020a056a20c12300b0019cb4f1596fmr6616078pzb.22.1706856553753; Thu, 01 Feb 2024 22:49:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706856553; cv=pass; d=google.com; s=arc-20160816; b=cxSQhfNcGohxnZTS7eO39+BRrGVKazXH3T+JXAToT4jWgccCUF89Mlyr+LcqTCxqb0 A5sP5uQplmmbu8ynVLTQe8ptin7LmK9Uy6k7t7HD8x0uC6ApaKquiRn5A7FC8f0V8FyS nIBTaZdIuSf/I6HP2aMsN9Ed1e9oxyXjH0dOuX6Uey7PgCm8QVP6SZe9vZTNaBsmNyAo vvgRMFupdKkm+F/9d+WveNgUuKXD7xtelzO199gEhcS95U8ltgtsKM+doacMSWKI6pFd CTpQ6djw2wLB7Yua8UFTN+f7/QbNveNbeno2Wdc6XJhPcHUAeEknSmKRRALrH3jUG5Fc TDgw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :dkim-filter; bh=yJ2N3/HVGxJA0MGmEiSpJS8Lev4/X5f6v9PbC3nQxsU=; fh=TtpEG5SttAXRlxsKyOx/r0FNxInA3Ypld7IESrgiUac=; b=yorbyVEfXrYDPyo/kp5zPTTE9U6Ms9w97lRyOGYxKOTGD0FCR4tZcUJ0UESxe2Ugun mAgBj8qeAPvi6+ODXLMMQ+RGH32wJQ5XXOConMHR0h28WI7hMIzEpgBA6KUVH8g9VtPL BQ1Cv/Bgu7k4/DhO+qOywtPo+otqGnii0roFdNyzjKw7u2wgnPvnEACQg5LfcM/7YvXV 6QWlmUU5ezXvps5BxofaR28VGV+AvCObjxrgt6hiSrvDM2U5q6sipgFHfzl7LTXJu42e naLaY+oPli9AjvRHSwp4Z5oEkyRZgbhfz7iJbFFsW1FwiuzyEy/SOeCps3u/5qDfEfr1 kXTg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=JDQge6j0; arc=pass (i=1 spf=pass spfdomain=linux.microsoft.com dkim=pass dkdomain=linux.microsoft.com dmarc=pass fromdomain=linux.microsoft.com); spf=pass (google.com: domain of linux-kernel+bounces-49303-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49303-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com X-Forwarded-Encrypted: i=1; AJvYcCX9sNtCXOwBjxhoSUJh5qwiJ7Ry1iQv5Mu00cN2ivkio1Z6Ubyx47P0u0qTv0sTth+07LZw85CKW1dg8wrwP6nciLiCiQ== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id ix3-20020a170902f80300b001d9586d5d78si1168136plb.233.2024.02.01.22.49.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 22:49:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-49303-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=JDQge6j0; arc=pass (i=1 spf=pass spfdomain=linux.microsoft.com dkim=pass dkdomain=linux.microsoft.com dmarc=pass fromdomain=linux.microsoft.com); spf=pass (google.com: domain of linux-kernel+bounces-49303-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49303-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A850128331D for ; Fri, 2 Feb 2024 06:48:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 804E54879F; Fri, 2 Feb 2024 06:43:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="JDQge6j0" Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A0178481B4 for ; Fri, 2 Feb 2024 06:43:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706856228; cv=none; b=INNlsXaCiBfepO0avJgRNA9l9rhNrzFRcjPSxejcpStP25b1Id/9oERNnjXJIl9+zZogJsCYgi2qidbl318TkZub86J1THDVOLfjntq7IwvgTfDhFv4KhPSHpGg7UqluX3uCx7Mz20Yz0jU/4fiCv0szbfvbpMswY5q+hxDR+0c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706856228; c=relaxed/simple; bh=AT0D06dEnCX3xAFZpn1FFCz1gETYrTU97dZV26IIREo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=G5pbIkPWpi0a7jQMBl+f4vi4GPU73cYuZLs4sj8FZbAZCIMrxTISbIP3X0xlxDKZD+evvCDTiuBEw3ifrgAIyyRHAwWI9z9TRj1seHV6o3vFIA3Sv+m4ioIBNYbdBNZRDuAGMiNpMooUJyQAP048GEwdwccs9Jqn43u24h7ef70= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b=JDQge6j0; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Received: by linux.microsoft.com (Postfix, from userid 1134) id 4597320B2000; Thu, 1 Feb 2024 22:43:47 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 4597320B2000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1706856227; bh=yJ2N3/HVGxJA0MGmEiSpJS8Lev4/X5f6v9PbC3nQxsU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JDQge6j0N748zAX3m40uBjCAofdEIZ3yaeynY2aCazTw07uwLOJStak9RvU57N2nB xoyU8AZgWNF+KwYqVPJcCO3VOiAA3OGEzS2cgwoBZQ+GTMxR6EHoPlkGqkcOsWfgsQ DN0ZpUT6L7+m8E6ocHeGZSEiIkaw6wQKXDKzYCEo= From: Shradha Gupta To: linux-kernel@vger.kernel.org, Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, Saurabh Singh Sengar Cc: Shradha Gupta , Shradha Gupta Subject: [PATCH v4, 2/2] drm: Check polling initialized before enabling in drm_helper_probe_single_connector_modes Date: Thu, 1 Feb 2024 22:43:44 -0800 Message-Id: <1706856224-9725-1-git-send-email-shradhagupta@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1706856176-9483-1-git-send-email-shradhagupta@linux.microsoft.com> References: <1706856176-9483-1-git-send-email-shradhagupta@linux.microsoft.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789768817594532822 X-GMAIL-MSGID: 1789768817594532822 In function drm_helper_probe_single_connector_modes() when we enable polling again, if it is already uninitialized, a warning is reported. This patch fixes the warning message by checking if poll is initialized before enabling it. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-lkp/202401191128.db8423f1-oliver.sang@intel.com Signed-off-by: Shradha Gupta --- Changes in v4 * Clubbed this patch with similar patches and added a cover letter --- drivers/gpu/drm/drm_probe_helper.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c index bd76603dc387..30e6063535cd 100644 --- a/drivers/gpu/drm/drm_probe_helper.c +++ b/drivers/gpu/drm/drm_probe_helper.c @@ -622,8 +622,12 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector, 0); } - /* Re-enable polling in case the global poll config changed. */ - drm_kms_helper_poll_enable(dev); + /* + * Re-enable polling in case the global poll config changed but polling + * is still initialized. + */ + if (dev->mode_config.poll_enabled) + drm_kms_helper_poll_enable(dev); if (connector->status == connector_status_disconnected) { DRM_DEBUG_KMS("[CONNECTOR:%d:%s] disconnected\n",