lkml.org 
[lkml]   [2020]   [Mar]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
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@gmail.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
\
 
 \ /
  Last update: 2020-03-02 05:29    [W:0.049 / U:8.480 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site