From patchwork Fri Jan 18 18:06:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Kristian_H=C3=B8gsberg?= X-Patchwork-Id: 10771409 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7518C13B5 for ; Fri, 18 Jan 2019 18:07:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 657572D029 for ; Fri, 18 Jan 2019 18:07:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 597702FBCC; Fri, 18 Jan 2019 18:07:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0B4542D029 for ; Fri, 18 Jan 2019 18:07:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 385CA6F89D; Fri, 18 Jan 2019 18:07:26 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8545B6F89D for ; Fri, 18 Jan 2019 18:07:24 +0000 (UTC) Received: by mail-io1-xd44.google.com with SMTP id x6so11433343ioa.9 for ; Fri, 18 Jan 2019 10:07:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=OsUrKUDg+Ds+XkJR7JqlIZ0fB3jay9mLmIhoLPw9A9Y=; b=tHaWtDq0NYo4TXsYLZ3j6P3RH0xjJSmWv0o163fvLRhhZmWKHvXPCyezculmoxsmQC h9qMmKdZE49Nnu1GuT23AJq1P3mYZgJ6Wr+HEmmd++Hvq0AetqzLMDOYuSpvAEOzLkBN JcRXq9B654jkvKZZZRZ93p/rWs3/Kh5ZV6i1RfgWCGpCdODYRldUVkgqy2G6bffu230a 5293EmE19YbMypR+rVN7RCxvkKY7bnsbth75TK+vNNR+mfu2U1ufc2SFBJVC+7MlzYHV l3YrpZbTN6lNpAMcPNoL3MM//tzhlHs+6KCJnkWUMeVp3IG9PGTgrvmDWJUXd2flfQW0 9vXA== X-Gm-Message-State: AJcUukdPQ+ulXfq1ozlbqRgM8vEFGLB4TCXa2vQWnhC29VvJYe/sP9gb KII0LZIB+a6W7uuc7TPtOnzmonaM X-Google-Smtp-Source: ALg8bN5/pMjIPPHdsnqxtGCR0AdDVmd+lpyOmSCOZZeABqtivvmtI4nPV5QoLaAhzpAwJJQ5sPeZfQ== X-Received: by 2002:a6b:9089:: with SMTP id s131mr12448972iod.242.1547834843458; Fri, 18 Jan 2019 10:07:23 -0800 (PST) Received: from hawkmoon.pdx.corp.google.com ([2620:15c:f:10:4644:10cd:b451:c544]) by smtp.gmail.com with ESMTPSA id h2sm2250072itk.0.2019.01.18.10.07.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Jan 2019 10:07:22 -0800 (PST) From: "Kristian H. Kristensen" X-Google-Original-From: "Kristian H. Kristensen" To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/2] drm: Add DRM_DEV_INFO_RATELIMITED Date: Fri, 18 Jan 2019 10:06:59 -0800 Message-Id: <20190118180717.163547-1-hoegsberg@chromium.org> X-Mailer: git-send-email 2.20.1.321.g9e740568ce-goog MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Kristian H. Kristensen" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Refactor the ratelimit printk to a helper macro and implement DRM_DEV_INFO_RATELIMITED and DRM_DEV_ERROR_RATELIMITED using the helper. Signed-off-by: Kristian H. Kristensen --- include/drm/drm_print.h | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index afbc3beef089a..6a592f8e1ebd6 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -285,6 +285,22 @@ void drm_err(const char *format, ...); #define _DRM_PRINTK(once, level, fmt, ...) \ printk##once(KERN_##level "[" DRM_NAME "] " fmt, ##__VA_ARGS__) +/** + * Rate limited output. Like _DRM_PRINTK() but won't flood the log. + * + * @dev: device pointer + * @fmt: printf() like format string. + */ +#define _DRM_DEV_PRINTK_RATELIMITED(dev, level, fmt, ...) \ +({ \ + static DEFINE_RATELIMIT_STATE(_rs, \ + DEFAULT_RATELIMIT_INTERVAL, \ + DEFAULT_RATELIMIT_BURST); \ + \ + if (__ratelimit(&_rs)) \ + drm_dev_printk(dev, level, fmt, ##__VA_ARGS__); \ +}) + #define DRM_INFO(fmt, ...) \ _DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__) #define DRM_NOTE(fmt, ...) \ @@ -317,20 +333,17 @@ void drm_err(const char *format, ...); * @fmt: printf() like format string. */ #define DRM_DEV_ERROR_RATELIMITED(dev, fmt, ...) \ -({ \ - static DEFINE_RATELIMIT_STATE(_rs, \ - DEFAULT_RATELIMIT_INTERVAL, \ - DEFAULT_RATELIMIT_BURST); \ - \ - if (__ratelimit(&_rs)) \ - DRM_DEV_ERROR(dev, fmt, ##__VA_ARGS__); \ -}) + _DRM_DEV_PRINTK_RATELIMITED(dev, KERN_ERR, "*ERROR*" fmt, ##__VA_ARGS__) + #define DRM_ERROR_RATELIMITED(fmt, ...) \ DRM_DEV_ERROR_RATELIMITED(NULL, fmt, ##__VA_ARGS__) #define DRM_DEV_INFO(dev, fmt, ...) \ drm_dev_printk(dev, KERN_INFO, fmt, ##__VA_ARGS__) +#define DRM_DEV_INFO_RATELIMITED(dev, fmt, ...) \ + _DRM_DEV_PRINTK_RATELIMITED(dev, KERN_INFO, fmt, ##__VA_ARGS__) + #define DRM_DEV_INFO_ONCE(dev, fmt, ...) \ ({ \ static bool __print_once __read_mostly; \ From patchwork Fri Jan 18 18:07:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Kristian_H=C3=B8gsberg?= X-Patchwork-Id: 10771411 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6A6FE13B5 for ; Fri, 18 Jan 2019 18:07:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 59AE52A93C for ; Fri, 18 Jan 2019 18:07:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D3A72F86A; Fri, 18 Jan 2019 18:07:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0D2B22A93C for ; Fri, 18 Jan 2019 18:07:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 00A8F6F89F; Fri, 18 Jan 2019 18:07:45 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-it1-x143.google.com (mail-it1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) by gabe.freedesktop.org (Postfix) with ESMTPS id 73F0C6F89E; Fri, 18 Jan 2019 18:07:43 +0000 (UTC) Received: by mail-it1-x143.google.com with SMTP id c9so6969285itj.1; Fri, 18 Jan 2019 10:07:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CaqkIsxCKKjRMfkYjxvwE758sGZdy1v6z0dJbtwinzA=; b=GvCIym8VsZ070HoQsWt9rd78uxtkQ7Kj1CwNw7iUy3FoXWHMhfgHeN2ej8zZj8rvRk 7y5ctDn8H0v2X6o2mJL/O5YSOY5dpXuJE9QCjYaWBhzpiWu7dW8poI31JTQFNsO7FWzP AV4+f2XXIZYW2j3eCXZ8vbYdZdakQ9Y03Yrj6s87M4BAgeFb02tRUvPjn5dU1LGDx0R0 0F3NfWi9fqExgrbsz9TpvA6FQR8mOPvW4DDnqmwtQJJ01MfwXzhMw3HUaNkw7z2plodH 1lgJ0vcnT8uYFTPf0oVAIHyYn05wVixhJzppkxq4FY4VIpJbAC7cqvwdx3YCybmXJU8e 5rtA== X-Gm-Message-State: AJcUukdFdKfAfA3PAnXQ7YRBBa6iYa6+nmkI2mlRiYoaZIsAuyqK1bZQ G+IblgbWjKeGcFnRG5T20LA= X-Google-Smtp-Source: ALg8bN7l1epjbHzXwomtdAS09P1YxysW2W5ulrJcgprdSS6+QP5/60ZKzUja7buI/dlEZ8tNQmAWnQ== X-Received: by 2002:a02:4c9:: with SMTP id 192mr11221031jab.2.1547834862588; Fri, 18 Jan 2019 10:07:42 -0800 (PST) Received: from hawkmoon.pdx.corp.google.com ([2620:15c:f:10:4644:10cd:b451:c544]) by smtp.gmail.com with ESMTPSA id h2sm2250072itk.0.2019.01.18.10.07.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Jan 2019 10:07:42 -0800 (PST) From: "Kristian H. Kristensen" X-Google-Original-From: "Kristian H. Kristensen" To: Rob Clark , dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH 2/2] drm/msm: Use DRM_DEV_INFO_RATELIMITED for shrinker messages Date: Fri, 18 Jan 2019 10:07:00 -0800 Message-Id: <20190118180717.163547-2-hoegsberg@chromium.org> X-Mailer: git-send-email 2.20.1.321.g9e740568ce-goog In-Reply-To: <20190118180717.163547-1-hoegsberg@chromium.org> References: <20190118180717.163547-1-hoegsberg@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Kristian H. Kristensen" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Otherwise we get hard to track down "Purging: 123123 bytes" messages in the log. Signed-off-by: Kristian H. Kristensen --- drivers/gpu/drm/msm/msm_gem_shrinker.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_gem_shrinker.c b/drivers/gpu/drm/msm/msm_gem_shrinker.c index b72d8e6cd51d7..8161923892f55 100644 --- a/drivers/gpu/drm/msm/msm_gem_shrinker.c +++ b/drivers/gpu/drm/msm/msm_gem_shrinker.c @@ -98,7 +98,7 @@ msm_gem_shrinker_scan(struct shrinker *shrinker, struct shrink_control *sc) mutex_unlock(&dev->struct_mutex); if (freed > 0) - pr_info_ratelimited("Purging %lu bytes\n", freed << PAGE_SHIFT); + DRM_DEV_INFO_RATELIMITED(dev->dev, "Purging %lu bytes\n", freed << PAGE_SHIFT); return freed; } @@ -134,7 +134,7 @@ msm_gem_shrinker_vmap(struct notifier_block *nb, unsigned long event, void *ptr) *(unsigned long *)ptr += unmapped; if (unmapped > 0) - pr_info_ratelimited("Purging %u vmaps\n", unmapped); + DRM_DEV_INFO_RATELIMITED(dev->dev, "Purging %u vmaps\n", unmapped); return NOTIFY_DONE; }