From: Cody Planteen <planteen@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: tglx@linutronix.de
Subject: [PATCH 2/2] rslib: test: Yield to prevent RCU stall messages and fix comment typos
Date: Sun, 1 Mar 2020 21:27:59 -0700 [thread overview]
Message-ID: <a309f09e07374e62a77bb84c70e6715efd288448.1583122776.git.planteen@gmail.com> (raw)
In-Reply-To: <cover.1583122776.git.planteen@gmail.com>
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
next prev parent reply other threads:[~2020-03-02 4:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-02 4:27 [PATCH 0/2] Reed-Solomon lib parameter fix and test fix Cody Planteen
2020-03-02 4:27 ` [PATCH 1/2] rslib: Minimum symbol size for a Reed-Solomon code is 2 bits not 1 bit Cody Planteen
2020-03-02 4:27 ` Cody Planteen [this message]
2020-03-05 1:35 ` [rslib] 0a4de944dc: WARNING:bad_unlock_balance_detected kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a309f09e07374e62a77bb84c70e6715efd288448.1583122776.git.planteen@gmail.com \
--to=planteen@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®