Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1284383 > unrolled thread
| Started by | "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> |
|---|---|
| First post | 2015-12-05 01:30 +0100 |
| Last post | 2015-12-06 02:50 +0100 |
| Articles | 3 — 2 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.
[PATCH tip/core/rcu 5/8] rcutorture: Print symbolic name for rcu_torture_writer_state "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-12-05 01:30 +0100
Re: [PATCH tip/core/rcu 5/8] rcutorture: Print symbolic name for rcu_torture_writer_state Josh Triplett <josh@joshtriplett.org> - 2015-12-05 02:10 +0100
Re: [PATCH tip/core/rcu 5/8] rcutorture: Print symbolic name for rcu_torture_writer_state "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-12-06 02:50 +0100
| From | "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> |
|---|---|
| Date | 2015-12-05 01:30 +0100 |
| Subject | [PATCH tip/core/rcu 5/8] rcutorture: Print symbolic name for rcu_torture_writer_state |
| Message-ID | <qC8TE-1qz-5@gated-at.bofh.it> |
Currently, rcu_torture_writer_state is printed as an integer, which slows
debugging. This commit therefore prints a symbolic name in addition to
the integer.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
kernel/rcu/rcutorture.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index d89328e260df..adbb194e2b5d 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -162,6 +162,27 @@ static int rcu_torture_writer_state;
#define RTWS_SYNC 7
#define RTWS_STUTTER 8
#define RTWS_STOPPING 9
+static char * const rcu_torture_writer_state_names[] = {
+ "RTWS_FIXED_DELAY",
+ "RTWS_DELAY",
+ "RTWS_REPLACE",
+ "RTWS_DEF_FREE",
+ "RTWS_EXP_SYNC",
+ "RTWS_COND_GET",
+ "RTWS_COND_SYNC",
+ "RTWS_SYNC",
+ "RTWS_STUTTER",
+ "RTWS_STOPPING",
+};
+
+char *rcu_torture_writer_state_getname(void)
+{
+ unsigned int i = READ_ONCE(rcu_torture_writer_state);
+
+ if (i >= ARRAY_SIZE(rcu_torture_writer_state_names))
+ return "???";
+ return rcu_torture_writer_state_names[i];
+}
#if defined(MODULE) || defined(CONFIG_RCU_TORTURE_TEST_RUNNABLE)
#define RCUTORTURE_RUNNABLE_INIT 1
@@ -1307,7 +1328,8 @@ rcu_torture_stats_print(void)
rcutorture_get_gp_data(cur_ops->ttype,
&flags, &gpnum, &completed);
- pr_alert("??? Writer stall state %d g%lu c%lu f%#x\n",
+ pr_alert("??? Writer stall state %s(%d) g%lu c%lu f%#x\n",
+ rcu_torture_writer_state_getname(),
rcu_torture_writer_state,
gpnum, completed, flags);
show_rcu_gp_kthreads();
--
2.5.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Josh Triplett <josh@joshtriplett.org> |
|---|---|
| Date | 2015-12-05 02:10 +0100 |
| Subject | Re: [PATCH tip/core/rcu 5/8] rcutorture: Print symbolic name for rcu_torture_writer_state |
| Message-ID | <qC9wl-1TA-1@gated-at.bofh.it> |
| In reply to | #1284383 |
On Fri, Dec 04, 2015 at 04:23:49PM -0800, Paul E. McKenney wrote:
> Currently, rcu_torture_writer_state is printed as an integer, which slows
> debugging. This commit therefore prints a symbolic name in addition to
> the integer.
>
> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> ---
> kernel/rcu/rcutorture.c | 24 +++++++++++++++++++++++-
> 1 file changed, 23 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
> index d89328e260df..adbb194e2b5d 100644
> --- a/kernel/rcu/rcutorture.c
> +++ b/kernel/rcu/rcutorture.c
> @@ -162,6 +162,27 @@ static int rcu_torture_writer_state;
> #define RTWS_SYNC 7
> #define RTWS_STUTTER 8
> #define RTWS_STOPPING 9
> +static char * const rcu_torture_writer_state_names[] = {
Shouldn't this use "static const char * const"? Also, see below.
> + "RTWS_FIXED_DELAY",
> + "RTWS_DELAY",
> + "RTWS_REPLACE",
> + "RTWS_DEF_FREE",
> + "RTWS_EXP_SYNC",
> + "RTWS_COND_GET",
> + "RTWS_COND_SYNC",
> + "RTWS_SYNC",
> + "RTWS_STUTTER",
> + "RTWS_STOPPING",
> +};
> +
> +char *rcu_torture_writer_state_getname(void)
This should return "const char *", I think.
> +{
> + unsigned int i = READ_ONCE(rcu_torture_writer_state);
> +
> + if (i >= ARRAY_SIZE(rcu_torture_writer_state_names))
> + return "???";
> + return rcu_torture_writer_state_names[i];
> +}
>
> #if defined(MODULE) || defined(CONFIG_RCU_TORTURE_TEST_RUNNABLE)
> #define RCUTORTURE_RUNNABLE_INIT 1
> @@ -1307,7 +1328,8 @@ rcu_torture_stats_print(void)
>
> rcutorture_get_gp_data(cur_ops->ttype,
> &flags, &gpnum, &completed);
> - pr_alert("??? Writer stall state %d g%lu c%lu f%#x\n",
> + pr_alert("??? Writer stall state %s(%d) g%lu c%lu f%#x\n",
> + rcu_torture_writer_state_getname(),
> rcu_torture_writer_state,
> gpnum, completed, flags);
> show_rcu_gp_kthreads();
> --
> 2.5.2
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> |
|---|---|
| Date | 2015-12-06 02:50 +0100 |
| Subject | Re: [PATCH tip/core/rcu 5/8] rcutorture: Print symbolic name for rcu_torture_writer_state |
| Message-ID | <qCwCC-kd-5@gated-at.bofh.it> |
| In reply to | #1284416 |
On Fri, Dec 04, 2015 at 05:02:21PM -0800, Josh Triplett wrote:
> On Fri, Dec 04, 2015 at 04:23:49PM -0800, Paul E. McKenney wrote:
> > Currently, rcu_torture_writer_state is printed as an integer, which slows
> > debugging. This commit therefore prints a symbolic name in addition to
> > the integer.
> >
> > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > ---
> > kernel/rcu/rcutorture.c | 24 +++++++++++++++++++++++-
> > 1 file changed, 23 insertions(+), 1 deletion(-)
> >
> > diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
> > index d89328e260df..adbb194e2b5d 100644
> > --- a/kernel/rcu/rcutorture.c
> > +++ b/kernel/rcu/rcutorture.c
> > @@ -162,6 +162,27 @@ static int rcu_torture_writer_state;
> > #define RTWS_SYNC 7
> > #define RTWS_STUTTER 8
> > #define RTWS_STOPPING 9
> > +static char * const rcu_torture_writer_state_names[] = {
>
> Shouldn't this use "static const char * const"? Also, see below.
Can't hurt...
> > + "RTWS_FIXED_DELAY",
> > + "RTWS_DELAY",
> > + "RTWS_REPLACE",
> > + "RTWS_DEF_FREE",
> > + "RTWS_EXP_SYNC",
> > + "RTWS_COND_GET",
> > + "RTWS_COND_SYNC",
> > + "RTWS_SYNC",
> > + "RTWS_STUTTER",
> > + "RTWS_STOPPING",
> > +};
> > +
> > +char *rcu_torture_writer_state_getname(void)
>
> This should return "const char *", I think.
Yes, especially once I had made the earlier change. Also made this
function be static while I was at it.
Thanx, Paul
> > +{
> > + unsigned int i = READ_ONCE(rcu_torture_writer_state);
> > +
> > + if (i >= ARRAY_SIZE(rcu_torture_writer_state_names))
> > + return "???";
> > + return rcu_torture_writer_state_names[i];
> > +}
> >
> > #if defined(MODULE) || defined(CONFIG_RCU_TORTURE_TEST_RUNNABLE)
> > #define RCUTORTURE_RUNNABLE_INIT 1
> > @@ -1307,7 +1328,8 @@ rcu_torture_stats_print(void)
> >
> > rcutorture_get_gp_data(cur_ops->ttype,
> > &flags, &gpnum, &completed);
> > - pr_alert("??? Writer stall state %d g%lu c%lu f%#x\n",
> > + pr_alert("??? Writer stall state %s(%d) g%lu c%lu f%#x\n",
> > + rcu_torture_writer_state_getname(),
> > rcu_torture_writer_state,
> > gpnum, completed, flags);
> > show_rcu_gp_kthreads();
> > --
> > 2.5.2
> >
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web