From nobody Thu Apr 2 20:28:16 2026 Received: from mail-oa1-f46.google.com (mail-oa1-f46.google.com [209.85.160.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 93D073A7F47 for ; Thu, 26 Mar 2026 18:55:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774551336; cv=none; b=sFDcX4x04ZU8tc/dEBhW5/lUp/Ky9PaNwOWZCxmui5UXuFCGGZOkc2IoRybd4aLCLWvorNnxKYH0M5p3+8NCsKmiSAtQ+FCn+oIREYeaL8BEWX2YRMkRzIPayUaNlJ0spGvxjt8fatLIic0JNKGbcL4H7R+ODnnjtzwnJZvRNf8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774551336; c=relaxed/simple; bh=R2Y7naG7/G7m4Sj5amN9w2j8cpntcn6acGk+uQXvJBI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GJradbyVKGkm+DnazxISGfisqPZDZYpkva2rU5V2uVwV7P//yigl83fWXQvzwCRkd7B188XZ+SLoL0acY/2Pvvq7sY1SUNkqKoXud4vtJzNC4/qxqW9r5O3Hn6gTbzG+k5K+8C2GqgiGqFiGiednm/pzLHmDjxbgb2rT31LgwAE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=N0CbO/Je; arc=none smtp.client-ip=209.85.160.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="N0CbO/Je" Received: by mail-oa1-f46.google.com with SMTP id 586e51a60fabf-41708f6c3feso861443fac.3 for ; Thu, 26 Mar 2026 11:55:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774551334; x=1775156134; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bX4ilSonYi7XSfI6S+RBBXv+cAYgjTID5jxcrBPOaxA=; b=N0CbO/Jed1yUDbF3FeVWt/IrYx4DIVXzT44fnAD7Lj8CZpNYRnj4R3Eezg/kc2+EW7 /aVL6Q6FqtsXPXYm/zN1eYmx/SM365+OM/SRSz2RMbAHdRED4euZogNJajQdy4zzbumq kI7GNG3slIAqbND3nJiVlpIggyYgcSh6Athg8f6FMKQeEA4pBy88IFIXE+Iu0mFEDGwy sNg4YblC38Vx4kQLmJBcsJMU2aE0lfcfnco288uO8DAQ4W1DcfUGnk4MZEuzYQYknSjH REYN3ey6qg+gbJnPJYLloIpu4Lo9uqdZ52ptkBPJIJn4mN4tFMSRC28CNXCSsDJiUymT 5LHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774551334; x=1775156134; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=bX4ilSonYi7XSfI6S+RBBXv+cAYgjTID5jxcrBPOaxA=; b=AYeH82KYKWdZ/ty8JwwvIrX8ra/L8auFoX4ymmKj1kWq0B5Xr1J6IUoRQ89GE1e1um 8OQlScpBPehbfgs9f1eJKFS4C7znmCpfVJdnjr8G9lKqhJX83/k+aDWBgdnvFN8dRPI0 Q8dSakAo1J6I+Jgvs1czAoJ/J6mjYuhNBTLXOkuhoZVp0ezXMFL+t0lHcR9Nt9BKw3dV HCOObOOtX/3PK8Piy7leNBxKuL3QXAlC6DcL9RrmM3Kb7+7aZniCURyMw16PUBmFMq+a T7GiRDgL2rAl015UxVm7hdphzTdXcwM04xf0qkx6ZaYzoyegaItWYATLXzTVMTr8fS+n Y5Ow== X-Gm-Message-State: AOJu0YxTqDto/86lh5n2aHyLz5PVhh8qYyA3jmdPjRtEF7WVV6jzM7id DTK9pAGLJjBBEsGJitFz7/SZHiN3utpsWFzH5AD8kq+xFIVqhFNFOLqEv0NvlQ== X-Gm-Gg: ATEYQzzOUaC0s7q0JpohysqA6sfCFCE4ySINx64szLEPpzGBrQn0icj1/fXcGKwRH89 cWmTXyCkx3/y4mO2dKZqFcJOJIL1vEgOyEY4UDw2+5k8uWBEMUQMA3ezx7gV1qltiVKEkg7GYsV Q58DHYuNatpuu92yfNJEuPpykd817M1Ycv1JNQb4BvrM3xAo6gtmR9t9G3d0Sn9LKK4PyO66a2L VsvF8QBV0nXaLEx/oZAA8rgaHatB14zCbV843u7TGneYjLP2mm2GLNX2VL9pWCWidMthiOsSWd9 qt6BusEvgChAKYAylhxIlvQDkP2iouVuJ4R1LcDl28PKkRftZ9EHGFBg3e741KD8CutgtllHd2c xi1g9wAdAutC85L3uLX0sGC9fDskk192Qq/Jw2dgtTkzFv79FJrWR8AWtw1pVV4CI/WKTClGAg/ Wu/xUQh2vq1tFd7T9jiNlFM36RQn2qFXeFAYIG1mYoho2EMerI X-Received: by 2002:a05:6870:9502:b0:409:5ef5:be0c with SMTP id 586e51a60fabf-41ca6de6bcbmr4583508fac.12.1774551334408; Thu, 26 Mar 2026 11:55:34 -0700 (PDT) Received: from frodo (c-98-38-17-99.hsd1.co.comcast.net. [98.38.17.99]) by smtp.googlemail.com with ESMTPSA id 586e51a60fabf-41cc7760c08sm3075171fac.4.2026.03.26.11.55.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Mar 2026 11:55:34 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, airlied@gmail.com, simona@ffwll.ch, jbaron@akamai.com, gregkh@linuxfoundation.org Cc: jim.cromie@gmail.com, mripard@kernel.org, tzimmermann@suse.de, maarten.lankhorst@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, christian.koenig@amd.com, matthew.auld@intel.com, arunpravin.paneerselvam@amd.com, louis.chauvet@bootlin.com, skhan@linuxfoundation.org, pmladek@suse.com, ukaszb@chromium.org, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, amd-gfx@lists.freedesktop.org Subject: [PATCH v12 40/69] drm_print: fix drm_printer dynamic debug bypass Date: Thu, 26 Mar 2026 12:53:44 -0600 Message-ID: <20260326185413.1205870-41-jim.cromie@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260326185413.1205870-1-jim.cromie@gmail.com> References: <20260326185413.1205870-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" drm_debug_enabled() is the canonical bit-test for drm.debug. Commit 6ce6fae84536 ("drm_print: optimize drm_debug_enabled for jump-label") renamed the original bit-test to drm_debug_enabled_raw() and introduced an internal bypass for dyndbg. When [1]=3Dy, it defined __drm_debug_enabled() to evaluate to 'true', allowing dyndbg's static-key to handle the filtering at the callsite. It also provided drm_debug_enabled() for cases where an explicit bit-mask check is still required. Later, commit 9fd6f61a297e ("drm/print: add drm_dbg_printer() for drm device specific printer") added __drm_printfn_dbg(), but mistakenly used the internal bypass __drm_debug_enabled() instead of the canonical drm_debug_enabled(). This went unnoticed because at the time, [1]=3Dy was marked BROKEN. Because __drm_printfn_dbg() is a shared helper where the callsite is not directly guarded by dyndbg's static-key, this caused it to hit the 'true' bypass and always print, ignoring the drm.debug bit-mask. This results in a flood of messages in environments with slow serial consoles, as seen in DRM-CI on i915 CML devices. When IGT causes a mismatch in intel_pipe_config_compare(), the resulting UART storm causes a hard timeout after 20 minutes. To fix this, change __drm_printfn_dbg() to use drm_debug_enabled_instrumented() instead. This ensures the bit-test is performed at runtime even when dyndbg is enabled. It also adds a pr_debug(), allowing us to enable it and count the frequency of this bit-test. Note that using drm_debug_enabled() here would also instrument the callsite but only when [1]=3Dn. Since _instrumented() is basically free when its off, theres no reason to not have it available where it might provide some insight into the performance benefits of [1]=3Dy. Additionally, update __drm_dev_dbg() to use the canonical drm_debug_enabled() instead of the internal __drm_debug_enabled(). - when [1]=3Dy the call to __drm_dev_dbg() is guarded by a static-key, so the bit-test is redundant. - when [1]=3Dn, we need the bit-test, since drm_dev_dbg() calls __drm_dev_dbg() directly. Here the pr_debug() can tell us the possible value of further optimization. [1] CONFIG_DRM_USE_DYNAMIC_DEBUG Fixes: 9fd6f61a297e ("drm/print: add drm_dbg_printer() for drm device speci= fic printer") Signed-off-by: Jim Cromie --- -v12- improve commit-msg explanation of choices re (__)?drm_debug_enabled --- drivers/gpu/drm/drm_print.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c index ded9461df5f2..9b622345e2eb 100644 --- a/drivers/gpu/drm/drm_print.c +++ b/drivers/gpu/drm/drm_print.c @@ -218,7 +218,7 @@ void __drm_printfn_dbg(struct drm_printer *p, struct va= _format *vaf) const struct device *dev =3D drm ? drm->dev : NULL; enum drm_debug_category category =3D p->category; =20 - if (!__drm_debug_enabled(category)) + if (!drm_debug_enabled_instrumented(category)) return; =20 __drm_dev_vprintk(dev, KERN_DEBUG, p->origin, p->prefix, vaf); @@ -335,7 +335,7 @@ void __drm_dev_dbg(struct _ddebug *desc, const struct d= evice *dev, struct va_format vaf; va_list args; =20 - if (!__drm_debug_enabled(category)) + if (!drm_debug_enabled(category)) return; =20 /* we know we are printing for either syslog, tracefs, or both */ --=20 2.53.0