Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1542028 > unrolled thread

Re: [RFC 07/10] kmod: use simplified rate limit printk

Started byPetr Mladek <pmladek@suse.com>
First post2016-12-14 17:30 +0100
Last post2016-12-16 09:50 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [RFC 07/10] kmod: use simplified rate limit printk Petr Mladek <pmladek@suse.com> - 2016-12-14 17:30 +0100
    Re: [RFC 07/10] kmod: use simplified rate limit printk Joe Perches <joe@perches.com> - 2016-12-14 17:50 +0100
    Re: [RFC 07/10] kmod: use simplified rate limit printk "Luis R. Rodriguez" <mcgrof@kernel.org> - 2016-12-16 09:50 +0100

#1542028 — Re: [RFC 07/10] kmod: use simplified rate limit printk

FromPetr Mladek <pmladek@suse.com>
Date2016-12-14 17:30 +0100
SubjectRe: [RFC 07/10] kmod: use simplified rate limit printk
Message-ID<sOkBk-cI-13@gated-at.bofh.it>
On Thu 2016-12-08 11:49:01, Luis R. Rodriguez wrote:
> Just use the simplified rate limit printk when the max modprobe
> limit is reached, while at it throw out a bone should the error
> be triggered.
> 
> Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
> ---
>  kernel/kmod.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/kernel/kmod.c b/kernel/kmod.c
> index 09cf35a2075a..ef65f4c3578a 100644
> --- a/kernel/kmod.c
> +++ b/kernel/kmod.c
> @@ -158,7 +158,6 @@ int __request_module(bool wait, const char *fmt, ...)
>  	va_list args;
>  	char module_name[MODULE_NAME_LEN];
>  	int ret;
> -	static int kmod_loop_msg;
>  
>  	/*
>  	 * We don't allow synchronous module loading from async.  Module
> @@ -183,13 +182,8 @@ int __request_module(bool wait, const char *fmt, ...)
>  
>  	ret = kmod_umh_threads_get();
>  	if (ret) {
> -		/* We may be blaming an innocent here, but unlikely */
> -		if (kmod_loop_msg < 5) {
> -			printk(KERN_ERR
> -			       "request_module: runaway loop modprobe %s\n",
> -			       module_name);
> -			kmod_loop_msg++;
> -		}
> +		pr_err_ratelimited("request_module: modprobe limit (%u) reached with module %s\n",
> +				   max_modprobes, module_name);

I like this change. I would only be even more descriptive in which
limit is reached. Something like

		pr_err_ratelimited("request_module: module \"%s\" reached limit (%u) of concurrent modprobe calls\n",
				   module_name, max_modprobes);

Either way, feel free to add:

Reviewed-by: Petr Mladek <pmladek@suse.com>

Best Regards,
Petr

[toc] | [next] | [standalone]


#1542039

FromJoe Perches <joe@perches.com>
Date2016-12-14 17:50 +0100
Message-ID<sOkUG-ju-15@gated-at.bofh.it>
In reply to#1542028
On Wed, 2016-12-14 at 17:23 +0100, Petr Mladek wrote:
> On Thu 2016-12-08 11:49:01, Luis R. Rodriguez wrote:
> > Just use the simplified rate limit printk when the max modprobe
> > limit is reached, while at it throw out a bone should the error
> > be triggered.
[]
> > diff --git a/kernel/kmod.c b/kernel/kmod.c
[]
> > @@ -183,13 +182,8 @@ int __request_module(bool wait, const char *fmt, ...)
> >  
> >  	ret = kmod_umh_threads_get();
> >  	if (ret) {
> > -		/* We may be blaming an innocent here, but unlikely */
> > -		if (kmod_loop_msg < 5) {
> > -			printk(KERN_ERR
> > -			       "request_module: runaway loop modprobe %s\n",
> > -			       module_name);
> > -			kmod_loop_msg++;
> > -		}
> > +		pr_err_ratelimited("request_module: modprobe limit (%u) reached with module %s\n",
> > +				   max_modprobes, module_name);
> 
> I like this change. I would only be even more descriptive in which
> limit is reached. Something like
> 
> 		pr_err_ratelimited("request_module: module \"%s\" reached limit (%u) of concurrent modprobe calls\n",
> 				   module_name, max_modprobes);
> 
> Either way, feel free to add:
> 
> Reviewed-by: Petr Mladek <pmladek@suse.com>

Seems sensible.

I suggest using "%s: ", __func__ instead of embedding
the function name.

[toc] | [prev] | [next] | [standalone]


#1543250

From"Luis R. Rodriguez" <mcgrof@kernel.org>
Date2016-12-16 09:50 +0100
Message-ID<sOWnf-16h-5@gated-at.bofh.it>
In reply to#1542028
On Wed, Dec 14, 2016 at 05:23:50PM +0100, Petr Mladek wrote:
> On Thu 2016-12-08 11:49:01, Luis R. Rodriguez wrote:
> > Just use the simplified rate limit printk when the max modprobe
> > limit is reached, while at it throw out a bone should the error
> > be triggered.
> > 
> > Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
> > ---
> >  kernel/kmod.c | 10 ++--------
> >  1 file changed, 2 insertions(+), 8 deletions(-)
> > 
> > diff --git a/kernel/kmod.c b/kernel/kmod.c
> > index 09cf35a2075a..ef65f4c3578a 100644
> > --- a/kernel/kmod.c
> > +++ b/kernel/kmod.c
> > @@ -158,7 +158,6 @@ int __request_module(bool wait, const char *fmt, ...)
> >  	va_list args;
> >  	char module_name[MODULE_NAME_LEN];
> >  	int ret;
> > -	static int kmod_loop_msg;
> >  
> >  	/*
> >  	 * We don't allow synchronous module loading from async.  Module
> > @@ -183,13 +182,8 @@ int __request_module(bool wait, const char *fmt, ...)
> >  
> >  	ret = kmod_umh_threads_get();
> >  	if (ret) {
> > -		/* We may be blaming an innocent here, but unlikely */
> > -		if (kmod_loop_msg < 5) {
> > -			printk(KERN_ERR
> > -			       "request_module: runaway loop modprobe %s\n",
> > -			       module_name);
> > -			kmod_loop_msg++;
> > -		}
> > +		pr_err_ratelimited("request_module: modprobe limit (%u) reached with module %s\n",
> > +				   max_modprobes, module_name);
> 
> I like this change. I would only be even more descriptive in which
> limit is reached. Something like
> 
> 		pr_err_ratelimited("request_module: module \"%s\" reached limit (%u) of concurrent modprobe calls\n",
> 				   module_name, max_modprobes);

Sure, changed.

> Either way, feel free to add:
> 
> Reviewed-by: Petr Mladek <pmladek@suse.com>

Thanks!

  Luis

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web