From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77B00C433C1 for ; Tue, 30 Mar 2021 10:44:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 30E19619B6 for ; Tue, 30 Mar 2021 10:44:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231777AbhC3Kng (ORCPT ); Tue, 30 Mar 2021 06:43:36 -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-Google-Smtp-Source: ABdhPJxPMfsifg57CMk+e08YOVt3TzMww6aMvw5ulnMzAx23GI1ES2FVCsm8qjLz2RBA6UgJxREJNfH8cDlZ1xM4T2Y= 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 > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2B1EC433E1 for ; Tue, 30 Mar 2021 17:25:24 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9BCBF619C0 for ; Tue, 30 Mar 2021 17:25:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9BCBF619C0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=nouveau-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2652F6E952; Tue, 30 Mar 2021 17:25:16 +0000 (UTC) Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by gabe.freedesktop.org (Postfix) with ESMTPS id A7CCD6E8AD for ; Tue, 30 Mar 2021 10:43:26 +0000 (UTC) Received: by mail-pj1-x102d.google.com with SMTP id lr1-20020a17090b4b81b02900ea0a3f38c1so1117892pjb.0 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=BafOUcvTzuve/PdM3QLLThWJ51BrIzSeOIod7AgC9mD2J+ZuidAUt2xlLreY0uladi h+9dRBYuPrDv8ngLl0A6BKrgC4UfQw3+Z2rbPCR/SIa+69DlOXgfBZ28zBpEylMPtvGd JGAGbNPnc2eX8CkBPZR1AkP1kwdjSjf2c7vJ1WgDPGI6W5HM73UCrNY1hvXJn0n7wmJ1 tJWG+M8SxltFpe6SnK/Zis9brs0ctayvukMN77Vnbl4yz9zaEwAZCsb8fARMr7DkjZiN 0s5jzu+VA+3zM31XJ5po2ZXAX79X97ENQZHhC2LvnIaU1/aBkT751/oIyrABzd2jrMFd 7rgQ== X-Gm-Message-State: AOAM53292vCFK07I2nWKcWRviIH6pLI3mcIC0sV2KLgNnFETmdV6qapc JlaHsJ+v3KSoVNwFnhIDRDcfzDgO7YEb6AyCI4Lheg== X-Google-Smtp-Source: ABdhPJxPMfsifg57CMk+e08YOVt3TzMww6aMvw5ulnMzAx23GI1ES2FVCsm8qjLz2RBA6UgJxREJNfH8cDlZ1xM4T2Y= 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: To: Lyude Paul X-Mailman-Approved-At: Tue, 30 Mar 2021 17:25:14 +0000 Subject: Re: [Nouveau] [PATCH v2 07/20] drm/print: Fixup DRM_DEBUG_KMS_RATELIMITED() X-BeenThere: nouveau@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Nouveau development list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel , David Airlie , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, Maarten Lankhorst , open list , Maxime Ripard , amd-gfx@lists.freedesktop.org, Daniel Vetter Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: nouveau-bounces@lists.freedesktop.org Sender: "Nouveau" 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 > _______________________________________________ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98A07C433DB for ; Tue, 30 Mar 2021 10:43:29 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 26EC46198A for ; Tue, 30 Mar 2021 10:43:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 26EC46198A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4D3746E8A7; Tue, 30 Mar 2021 10:43:28 +0000 (UTC) Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9596A6E8AB for ; Tue, 30 Mar 2021 10:43:26 +0000 (UTC) Received: by mail-pl1-x630.google.com with SMTP id f17so5944281plr.0 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=Hns8bQ6utpRnzSSwvyWeolImqGVLBNeLWQ+K4hxwjCSc9OLubtVYMuPFPIrgSa4Hvs fBkomVARHxfjpj+iB/IWC/m1NtHNy3VS/y71gIZtk23FSfU44OFJHuoh8mgRDPeQNmX3 z7tXidd/eemCAjj5Kq/14O+zrbWKibN53cQNJS66CPf6QA/IDg+sIf3eJn6QNkoCIW+m KVfGD1EQmXe7881zsjfauS7xXjCHXWGImFnFIazK1N/cSBAmZwdHpZjjV4zw97m0euXp 4K7uCxYgto7Ye8bmmHo5705ieaXwIzdvovLHSLn0C4D76lbzxurWWB2PD3aWdI/3XrbS FAFg== X-Gm-Message-State: AOAM531MeSam7onA363/+P2a6xk9rZWyMRXjo2DyqXQ5JmY6APCVIPiV BvBXnySIdezVAPhwup8XtXxHEljOMzgx98leDySKnQ== X-Google-Smtp-Source: ABdhPJxPMfsifg57CMk+e08YOVt3TzMww6aMvw5ulnMzAx23GI1ES2FVCsm8qjLz2RBA6UgJxREJNfH8cDlZ1xM4T2Y= 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 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel , David Airlie , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, open list , amd-gfx@lists.freedesktop.org, Thomas Zimmermann Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 > _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1323FC433E1 for ; Wed, 31 Mar 2021 09:18:21 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D3CE3619C1 for ; Wed, 31 Mar 2021 09:18:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D3CE3619C1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 346146EA24; Wed, 31 Mar 2021 09:18:19 +0000 (UTC) Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by gabe.freedesktop.org (Postfix) with ESMTPS id 949736E8A3 for ; Tue, 30 Mar 2021 10:43:26 +0000 (UTC) Received: by mail-pj1-x1029.google.com with SMTP id ot17-20020a17090b3b51b0290109c9ac3c34so9243147pjb.4 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=aiuFdQdGZ1mXzV3XiCgSJUtaXP0iVK4e7c3S8cc09mayDJsc/0PydUGZ5933UG2dsB xPJVsPpXVUmyOyM9kkbWActzyAWJ2wyJw5qLe8yIUVeY5sCrKMFWYUR3hq5U/tzwbby/ GH8bH3qWYHzIlA5Zux8WDh7OzWfp1WeYILk+D33kMnrNzXDqg9wA9gxEyFWpmBG7QP3m x1WSux2KIRUGddLM/DA1bHF7BKOax9ls84n9O9G4fMy1vJCAWPU7/ScgYJMIpdAkN4R6 Eml6UyHC2ZwzjLpPMwSOSq6pdetC7U3uR78t4FsNYGKML/+hATDS2DhvtzdMKGHvbm2U cwuA== X-Gm-Message-State: AOAM533NkgIS/AQWVMOnrT1uaxRg32e7oPhvxtC8dP1JKvXOA6/BFsdy wV/Tlv9mQRUTyR5UsliUv/8mWzy8+avdMfnQdWZIZg== X-Google-Smtp-Source: ABdhPJxPMfsifg57CMk+e08YOVt3TzMww6aMvw5ulnMzAx23GI1ES2FVCsm8qjLz2RBA6UgJxREJNfH8cDlZ1xM4T2Y= 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: To: Lyude Paul X-Mailman-Approved-At: Wed, 31 Mar 2021 09:18:15 +0000 Subject: Re: [Intel-gfx] [PATCH v2 07/20] drm/print: Fixup DRM_DEBUG_KMS_RATELIMITED() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel , David Airlie , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, open list , Maxime Ripard , amd-gfx@lists.freedesktop.org, Thomas Zimmermann Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" 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 > _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E597DC433E2 for ; Tue, 30 Mar 2021 13:24:52 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 91B5B619BD for ; Tue, 30 Mar 2021 13:24:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 91B5B619BD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=amd-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 43D516E8FB; Tue, 30 Mar 2021 13:24:49 +0000 (UTC) Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by gabe.freedesktop.org (Postfix) with ESMTPS id 94E276E8A7 for ; Tue, 30 Mar 2021 10:43:26 +0000 (UTC) Received: by mail-pl1-x630.google.com with SMTP id ay2so5941914plb.3 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=qCDRQQuyZizEXUb3/LQTv32WUZQuq1lzywIWYujmIxfjYMIOlRoI/GIlrrB8ezDQ4o RFR+95oa8uKyR2f09dOAjboShicjr7xf2Yo3++31eJACaQdN/LJLazQiz8Qa49nI6tJ9 zLMaieC7hbiDthPPuATcheonRpQeJhMic3UCGamgZ4EKlQ9sAxhIO1C6pa4Rq8d67IY6 5NxVh310hkvVKBSXnssVFlwYrEPDKuQSi/1x4BthIaVx9nwu7vQyHKaUs7hPPripf562 tXPUtndJhr5KHtQHqm4Df0YrKE9qBB+2dulBFBkq4qXNRpbn4WRtrB/d6lGfDB/SnElD BSaA== X-Gm-Message-State: AOAM533kuFLtozFsNLxw2kKVh5pY+KZVwVWRFf1kY4Uv6cecPhFFCVCj nQQA5X/WdosRArCk/qVXF0MSoyishGa727IOiHSxgw== X-Google-Smtp-Source: ABdhPJxPMfsifg57CMk+e08YOVt3TzMww6aMvw5ulnMzAx23GI1ES2FVCsm8qjLz2RBA6UgJxREJNfH8cDlZ1xM4T2Y= 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 X-Mailman-Approved-At: Tue, 30 Mar 2021 13:24:40 +0000 X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel , David Airlie , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, Maarten Lankhorst , open list , Maxime Ripard , amd-gfx@lists.freedesktop.org, Thomas Zimmermann , Daniel Vetter Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" 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 > _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx