Re: [PATCH 18/18] rcu: Use pr_fmt to prefix "rcu: " to logging output

From: Paul E. McKenney
Date: Tue May 15 2018 - 15:27:37 EST


On Mon, May 14, 2018 at 05:32:05PM -0700, Paul E. McKenney wrote:
> On Mon, May 14, 2018 at 05:23:59PM -0700, Joe Perches wrote:
> > On Mon, 2018-05-14 at 16:58 -0700, Paul E. McKenney wrote:
> > > OK, so if I define pr_fmt as follows, I get the old behavior?
> > >
> > > #define pr_fmt(fmt) fmt
> >
> > yes.
>
> OK, then I will queue patches with this for the near term for
> the various torture files.

And here is the patch. Thoughts?

Thanx, Paul

------------------------------------------------------------------------

commit de94f0b65dd4dcb7e651e2d85df9d9bc86b5bf23
Author: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>
Date: Tue May 15 12:25:05 2018 -0700

torture: Keep old-school dmesg format

This commit adds "#define pr_fmt(fmt) fmt" to the torture-test files
in order to keep the current dmesg format. Once Joe's commits have
hit mainline, these definitions will be changed in order to automatically
generate the dmesg line prefix that the scripts expect. This will have
the beneficial side-effect of allowing printk() formats to be used more
widely and of shortening some pr_*() lines.

Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>
Cc: Joe Perches <joe@xxxxxxxxxxx>

diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c
index 6d42670a1c70..5f00e5a2ef3b 100644
--- a/kernel/locking/locktorture.c
+++ b/kernel/locking/locktorture.c
@@ -21,6 +21,9 @@
* Davidlohr Bueso <dave@xxxxxxxxxxxx>
* Based on kernel/rcu/torture.c.
*/
+
+#define pr_fmt(fmt) fmt
+
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/kthread.h>
diff --git a/kernel/rcu/rcuperf.c b/kernel/rcu/rcuperf.c
index 9047e5439e46..791f8ae7ce20 100644
--- a/kernel/rcu/rcuperf.c
+++ b/kernel/rcu/rcuperf.c
@@ -19,6 +19,9 @@
*
* Authors: Paul E. McKenney <paulmck@xxxxxxxxxx>
*/
+
+#define pr_fmt(fmt) fmt
+
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/init.h>
diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index 9d80245b2a1c..ca08e6733fa2 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -22,6 +22,9 @@
*
* See also: Documentation/RCU/torture.txt
*/
+
+#define pr_fmt(fmt) fmt
+
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/init.h>
diff --git a/kernel/torture.c b/kernel/torture.c
index 840fd33c1cda..1ac24a826589 100644
--- a/kernel/torture.c
+++ b/kernel/torture.c
@@ -20,6 +20,9 @@
* Author: Paul E. McKenney <paulmck@xxxxxxxxxx>
* Based on kernel/rcu/torture.c.
*/
+
+#define pr_fmt(fmt) fmt
+
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/init.h>