Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4270040pxf; Tue, 30 Mar 2021 03:44:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyywUqhpLgT2EI2y5Ce8X+W54zZnmFnLaE+lAorzkqR9aC+cWVg+YsiKPrtGsZxGHnxdYk7 X-Received: by 2002:a17:907:2062:: with SMTP id qp2mr32656788ejb.397.1617101097316; Tue, 30 Mar 2021 03:44:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617101097; cv=none; d=google.com; s=arc-20160816; b=StyHNSqHIkabPiT2HCNKh7xaL0vNdZgVV7hOng9Qofi+oSsOs7eqdqNUFoKouPgLyK ZFtaZzrHdrJ0kbZlIiTgtHoIh+FxmLdnGla5ng0nMd+o1HxlxBhM1xo7Ll3NaQEB+JAG sFhbvrYl+IBKPcCEV3hDpwr4c0goeX5k6Ur4/qRXYbDoN3eATmiznO8/YVbFtWTe9I4v evuB0Otph1QHWR9bPy8seK5gxKQU4EPsGb70ZcAn0BcE4LpTEvHzYc0zYpklHdGFZbm1 wZXQYUXIA4hTPfAJeX2kf8m9cg/xDLkfEqqWCLogIHJDefbK4CUwttzpNYGhknQhipNz juwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=inEEvxoI2d27PWTByb00t7709zab101mRTK+HEEURs0=; b=w9C6bJhiOauj++eUGKDZ93i1MHBSavy84XRGzJUQ5yO6+bqDZ/OnB2jw5GY2gmqeV5 O9xpWP3iyUPLQWsetmExGXVfVeeY4n9SFzXii1qHqOOWIPqpLOB5kYS5NHhoke6gDLLN AvmxzpJ+b9Q2GQ4tkXRmNsje4BC3fP2SEGyDzVBqJMFozlP/+FtoZpphNt/nFi7Ho5s6 qCjnMZwWH3/Kko75wrhSYSiOobEMd9z8yJFauixCq6gVwA+dnAAFdevUScByxCEZqcCS G/UMqdk3FgBs05m/7gnIjiAXKMAF/rX9+BvMrDS6mv/sRC3rY4ChL3nFNMFSJfqKLcnT 6DBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=C9+RPFkW; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l1si15021756ejh.597.2021.03.30.03.44.34; Tue, 30 Mar 2021 03:44:57 -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=@linaro.org header.s=google header.b=C9+RPFkW; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231768AbhC3Knf (ORCPT + 99 others); Tue, 30 Mar 2021 06:43:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231154AbhC3Kn0 (ORCPT ); Tue, 30 Mar 2021 06:43:26 -0400 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F21EC061574 for ; Tue, 30 Mar 2021 03:43:26 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id l1so5941574plg.12 for ; Tue, 30 Mar 2021 03:43:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=inEEvxoI2d27PWTByb00t7709zab101mRTK+HEEURs0=; b=C9+RPFkWx1dnLku0VJzXhT4WCqoHsMPAfkkwl/4KohDQakhhONCUx+woSyEwYjrpXR t1d16MDlzS32+twkwF9bbNrzqgVVnTIfoI0AZogYL4G1S7OgpeJg0emu3T5/HWp5kcJG ++epmYQmqILHMzY2hL2QmPVz7uTVYnSW6ybUpM4NE/4ka6AX9/8CrsJwa6V5+njYVIo+ XgbVwDjQ2vtltDtglB4fNijvaQUZc0s53NH8e1EYls6/XbWYbhbOWqh0zjfmI0VBaOGj vhK9ArLDxUL+ZjLu/rXXyDanwAeMXX50oJ08dRer+OEiWgpVZHK0JFYQd9TBlKlb28DY jk6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=inEEvxoI2d27PWTByb00t7709zab101mRTK+HEEURs0=; b=odv5PvlFbWkxWXy2teS8U/2KzWu9H4xXvqEx6whdir4tetH2zrK2fC/eQWDYLC97sR 5czjhPMq47PPjoW0ufj4qqbEouwjRy3kFxyZdJfunppaVOUCnSnKboinjXRdxDjbVwuO WMVXE/c1069hqUdWsNETaguusVpRvwVpZAizCBq2EW6Pn/i+ReFkcEWX/ODBGOrJFPdk SUL3SwYcjGgWa0kpPFpg4F50LaMvcbeodL+oH2VdpqHiO9nEzF5HUbI4lhWbSqUhRRti F61u7HuhKNP6P4pC62gsMgu9Xl5Qh1V7IozOepKycr1B5w9ygEZRP8+vK2srVKEE6XS7 wp/g== X-Gm-Message-State: AOAM533ZiSmQWziu2I1kmW8Od00xLpQ99s0xPu3cWBFqYDMbpjKjiJJF 33A0XnU9XP0xf6aBCKuDOJ8waAg8J8HBnK1COmOlJQ== X-Received: by 2002:a17:902:e752:b029:e6:822c:355c with SMTP id p18-20020a170902e752b02900e6822c355cmr32807495plf.69.1617101006157; Tue, 30 Mar 2021 03:43:26 -0700 (PDT) MIME-Version: 1.0 References: <20210326203807.105754-1-lyude@redhat.com> <20210326203807.105754-8-lyude@redhat.com> In-Reply-To: <20210326203807.105754-8-lyude@redhat.com> From: Robert Foss Date: Tue, 30 Mar 2021 12:43:15 +0200 Message-ID: Subject: Re: [PATCH v2 07/20] drm/print: Fixup DRM_DEBUG_KMS_RATELIMITED() To: Lyude Paul Cc: nouveau@lists.freedesktop.org, dri-devel , amd-gfx@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , open list Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hey Lyude, I'm seeing no issues with this patch and the reasoning behind the patch is sound to me. Reviewed-by: Robert Foss On Fri, 26 Mar 2021 at 21:39, Lyude Paul wrote: > > Since we're about to move drm_dp_helper.c over to drm_dbg_*(), we'll want > to make sure that we can also add ratelimited versions of these macros in > order to retain some of the previous debugging output behavior we had. > > However, as I was preparing to do this I noticed that the current > rate limited macros we have are kind of bogus. It looks like when I wrote > these, I didn't notice that we'd always be calling __ratelimit() even if > the debugging message we'd be printing would normally be filtered out due > to the relevant DRM debugging category being disabled. > > So, let's fix this by making sure to check drm_debug_enabled() in our > ratelimited macros before calling __ratelimit(), and start using > drm_dev_printk() in order to print debugging messages since that will save > us from doing a redundant drm_debug_enabled() check. And while we're at it, > let's move the code for this into another macro that we can reuse for > defining new ratelimited DRM debug macros more easily. > > v2: > * Make sure to use tabs where possible in __DRM_DEFINE_DBG_RATELIMITED() > > Signed-off-by: Lyude Paul > Cc: Robert Foss > --- > include/drm/drm_print.h | 20 ++++++++++++-------- > 1 file changed, 12 insertions(+), 8 deletions(-) > > diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h > index f32d179e139d..a3c58c941bdc 100644 > --- a/include/drm/drm_print.h > +++ b/include/drm/drm_print.h > @@ -524,16 +524,20 @@ void __drm_err(const char *format, ...); > #define DRM_DEBUG_DP(fmt, ...) \ > __drm_dbg(DRM_UT_DP, fmt, ## __VA_ARGS__) > > - > -#define DRM_DEBUG_KMS_RATELIMITED(fmt, ...) \ > -({ \ > - static DEFINE_RATELIMIT_STATE(_rs, \ > - DEFAULT_RATELIMIT_INTERVAL, \ > - DEFAULT_RATELIMIT_BURST); \ > - if (__ratelimit(&_rs)) \ > - drm_dev_dbg(NULL, DRM_UT_KMS, fmt, ##__VA_ARGS__); \ > +#define __DRM_DEFINE_DBG_RATELIMITED(category, drm, fmt, ...) \ > +({ \ > + static DEFINE_RATELIMIT_STATE(rs_, DEFAULT_RATELIMIT_INTERVAL, DEFAULT_RATELIMIT_BURST);\ > + const struct drm_device *drm_ = (drm); \ > + \ > + if (drm_debug_enabled(DRM_UT_ ## category) && __ratelimit(&rs_)) \ > + drm_dev_printk(drm_ ? drm_->dev : NULL, KERN_DEBUG, fmt, ## __VA_ARGS__); \ > }) > > +#define drm_dbg_kms_ratelimited(drm, fmt, ...) \ > + __DRM_DEFINE_DBG_RATELIMITED(KMS, drm, fmt, ## __VA_ARGS__) > + > +#define DRM_DEBUG_KMS_RATELIMITED(fmt, ...) drm_dbg_kms_ratelimited(NULL, fmt, ## __VA_ARGS__) > + > /* > * struct drm_device based WARNs > * > -- > 2.30.2 >