lkml.org 
[lkml]   [2014]   [May]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH tip/core/rcu 20/45] torture: Include "Stopping" string to torture_kthread_stopping()
On Fri, May 09, 2014 at 08:46:16PM -0700, Josh Triplett wrote:
> On Fri, May 09, 2014 at 05:42:59PM -0700, Paul E. McKenney wrote:
> > On Fri, May 09, 2014 at 05:16:57PM -0700, Josh Triplett wrote:
> > > On Fri, May 09, 2014 at 05:13:46PM -0700, Paul E. McKenney wrote:
> > > > On Wed, May 07, 2014 at 02:37:36PM -0700, josh@joshtriplett.org wrote:
> > > > > On Mon, Apr 28, 2014 at 05:25:08PM -0700, Paul E. McKenney wrote:
> > > > > > From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
> > > > > >
> > > > > > Currently, torture_kthread_stopping() prints only the name of the
> > > > > > kthread that is stopping, which can be unedifying. This commit therefore
> > > > > > adds "Stopping" to make things more evident.
> > > > > >
> > > > > > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > > > >
> > > > > Feedback below.
> > > > >
> > > > > > kernel/torture.c | 5 ++++-
> > > > > > 1 file changed, 4 insertions(+), 1 deletion(-)
> > > > > >
> > > > > > diff --git a/kernel/torture.c b/kernel/torture.c
> > > > > > index acc9afc2f26e..f329848c3eee 100644
> > > > > > --- a/kernel/torture.c
> > > > > > +++ b/kernel/torture.c
> > > > > > @@ -674,8 +674,11 @@ EXPORT_SYMBOL_GPL(torture_must_stop_irq);
> > > > > > */
> > > > > > void torture_kthread_stopping(char *title)
> > > > > > {
> > > > > > + char buf[128];
> > > > > > +
> > > > > > + snprintf(buf, sizeof(buf), "Stopping %s", title);
> > > > > > if (verbose)
> > > > > > - VERBOSE_TOROUT_STRING(title);
> > > > > > + VERBOSE_TOROUT_STRING(buf);
> > > > >
> > > > > This seems like a case where the macro has led to poorer code; rather
> > > > > than using sprintf into a temporary buffer, this should just print.
> > > > > Please consider fixing the output macros to allow formats, as the pr_*
> > > > > macros do.
> > > > >
> > > > > Also, why do you need "if (verbose)" if the name of the macro has
> > > > > VERBOSE_ in it; shouldn't that mean it checks verbosity itself?
> > > > > (Another good reason not to create a unique verbosity level mechanism,
> > > > > and to use the kernel mechanisms instead.)
> > > >
> > > > Good catch, removed the redundant "if (verbose)".
> > > >
> > > > My attempts in the past to leverage existing in-kernel verbosity controls
> > > > has caused problems such as the output appearing or not depending on
> > > > the distro in question.
> > >
> > > That aside, though, what do you think about making the macros accept
> > > format strings and arguments, in the style of pr_* and pr_fmt?
> >
> > If I end up needing this in a few more cases, then it would indeed be
> > worth it.
>
> I'd argue that it's worth it already: doing snprintf into a temporary
> buffer seems ridiculous here, when without these macros you'd just call
> pr_foo("Stopping %s\n", title);

Sold, I will make this change for 3.17. Or if you would like to send along
a patch, that would be quite welcome as well. ;-)

Thanx, Paul



\
 
 \ /
  Last update: 2014-05-14 01:41    [W:0.174 / U:0.448 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site