From: "Roger Pau Monné" <roger.pau@citrix.com>
To: dmkhn@proton.me
Cc: xen-devel@lists.xenproject.org, andrew.cooper3@citrix.com,
anthony.perard@vates.tech, jbeulich@suse.com, julien@xen.org,
michal.orzel@amd.com, sstabellini@kernel.org, dmukhin@ford.com
Subject: Re: [PATCH v1] xen/console: remove __printk_ratelimit()
Date: Wed, 6 Aug 2025 13:09:30 +0200 [thread overview]
Message-ID: <aJM36pEZpn5IHSBf@macbook.local> (raw)
In-Reply-To: <20250725212235.753363-1-dmukhin@ford.com>
On Fri, Jul 25, 2025 at 09:24:48PM +0000, dmkhn@proton.me wrote:
> From: Denis Mukhin <dmukhin@ford.com>
>
> __printk_ratelimit() is never used outside of the console driver.
> Remove it from the lib.h and merge with the public printk_ratelimit().
>
> Not a functional change.
>
> Signed-off-by: Denis Mukhin <dmukhin@ford.com>
> ---
> xen/drivers/char/console.c | 29 ++++++++++++-----------------
> xen/include/xen/lib.h | 1 -
> 2 files changed, 12 insertions(+), 18 deletions(-)
>
> diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
> index 75fa033ce74d..80f8f2ed1bae 100644
> --- a/xen/drivers/char/console.c
> +++ b/xen/drivers/char/console.c
> @@ -979,7 +979,7 @@ static void vprintk_common(const char *fmt, va_list args, const char *prefix)
> char *p, *q;
> unsigned long flags;
>
> - /* console_lock can be acquired recursively from __printk_ratelimit(). */
> + /* console_lock can be acquired recursively from printk_ratelimit(). */
> local_irq_save(flags);
> rspin_lock(&console_lock);
> state = &this_cpu(state);
> @@ -1266,13 +1266,19 @@ void console_end_sync(void)
> atomic_dec(&print_everything);
> }
>
> +/* minimum time in ms between messages */
> +static int __read_mostly printk_ratelimit_ms = 5 * 1000;
> +
> +/* number of messages we send before ratelimiting */
> +static int __read_mostly printk_ratelimit_burst = 10;
You possibly want to make them const for the time being?
It's unclear whether we would like to dynamically change those values
in the future. Given the current usage they would better be const.
> +
> /*
> * printk rate limiting, lifted from Linux.
> *
> * This enforces a rate limit: not more than one kernel message
> * every printk_ratelimit_ms (millisecs).
> */
> -int __printk_ratelimit(int ratelimit_ms, int ratelimit_burst)
> +int printk_ratelimit(void)
As suggested by Jan, I would just make this static and remove the
prototype from lib.h. That results in less changes, and allows to
more easily export the fine grained function in the future if we had a
need to.
Thanks, Roger.
prev parent reply other threads:[~2025-08-06 11:09 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-25 21:24 [PATCH v1] xen/console: remove __printk_ratelimit() dmkhn
2025-07-26 9:20 ` Julien Grall
2025-07-26 20:56 ` dmkhn
2025-07-28 9:32 ` Jan Beulich
2025-07-29 22:18 ` dmkhn
2025-07-30 5:35 ` Jan Beulich
2025-07-30 18:06 ` dmkhn
2025-07-31 6:23 ` Jan Beulich
2025-07-31 21:28 ` dmkhn
2025-08-01 7:32 ` Jan Beulich
2025-08-06 11:09 ` Roger Pau Monné [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aJM36pEZpn5IHSBf@macbook.local \
--to=roger.pau@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=anthony.perard@vates.tech \
--cc=dmkhn@proton.me \
--cc=dmukhin@ford.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.