[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a309f09e07374e62a77bb84c70e6715efd288448.1583122776.git.planteen@gmail.com>
Date: Sun, 1 Mar 2020 21:27:59 -0700
From: Cody Planteen <planteen@...il.com>
To: linux-kernel@...r.kernel.org
Cc: tglx@...utronix.de
Subject: [PATCH 2/2] rslib: test: Yield to prevent RCU stall messages and fix
comment typos
Without this patch, running the test leads to lots of annoying
"rcu: INFO: rcu_sched self-detected stall on CPU" messages with stack
trace.
Signed-off-by: Cody Planteen <planteen@...il.com>
---
lib/reed_solomon/test_rslib.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/lib/reed_solomon/test_rslib.c b/lib/reed_solomon/test_rslib.c
index 4eb29f365ece..aa61ac7715de 100644
--- a/lib/reed_solomon/test_rslib.c
+++ b/lib/reed_solomon/test_rslib.c
@@ -10,6 +10,7 @@
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/random.h>
+#include <linux/sched.h>
#include <linux/slab.h>
enum verbosity {
@@ -169,7 +170,7 @@ static int get_rcw_we(struct rs_control *rs, struct wspace *ws,
memset(c + dlen, 0, nroots * sizeof(*c));
encode_rs16(rs, c, dlen, c + dlen, 0);
- /* Make copyand add errors and erasures */
+ /* Make copy and add errors and erasures */
memcpy(r, c, len * sizeof(*r));
memset(errlocs, 0, len * sizeof(*errlocs));
memset(derrlocs, 0, nroots * sizeof(*derrlocs));
@@ -327,8 +328,11 @@ static int ex_rs_helper(struct rs_control *rs, struct wspace *ws,
pr_info(" %s\n", desc[method]);
for (errs = 0; errs <= nroots / 2; errs++)
- for (eras = 0; eras <= nroots - 2 * errs; eras++)
+ for (eras = 0; eras <= nroots - 2 * errs; eras++) {
+ /* yield to prevent rcu stall messages */
+ cond_resched_rcu();
test_uc(rs, len, errs, eras, trials, &stat, ws, method);
+ }
if (v >= V_CSUMMARY) {
pr_info(" Decodes wrong: %d / %d\n",
@@ -385,7 +389,7 @@ static void test_bc(struct rs_control *rs, int len, int errs,
/*
* We check that the returned word is actually a
- * codeword. The obious way to do this would be to
+ * codeword. The obvious way to do this would be to
* compute the syndrome, but we don't want to replicate
* that code here. However, all the codes are in
* systematic form, and therefore we can encode the
@@ -420,8 +424,11 @@ static int exercise_rs_bc(struct rs_control *rs, struct wspace *ws,
eras = 0;
cutoff = nroots <= len - errs ? nroots : len - errs;
- for (; eras <= cutoff; eras++)
+ for (; eras <= cutoff; eras++) {
+ /* yield to prevent rcu stall messages */
+ cond_resched_rcu();
test_bc(rs, len, errs, eras, trials, &stat, ws);
+ }
}
if (v >= V_CSUMMARY) {
--
2.20.1
Powered by blists - more mailing lists