Skip to contentSkip to conversation

crypto: testmgr - add some more preemption points

PATCH In review Eric Biggers 3 participants 3 messages Jun 3, 2019 – Jun 13, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: testmgr - add some more preemption points

From: Eric Biggers <[email protected]>

Call cond_resched() after each fuzz test iteration. This avoids stall warnings if fuzz_iterations is set very high for testing purposes.

While we're at it, also call cond_resched() after finishing testing each test vector.

---
 crypto/testmgr.c | 6 ++++++
 1 file changed, 6 insertions(+)
crypto/testmgr.c +6 -0
index 2ba0c487ea281..f7fdd7fe89a9e 100644
@@ -1496,6 +1496,7 @@ static int test_hash_vec(const char *driver, const struct hash_testvec *vec,
 						req, desc, tsgl, hashstate);
 			if (err)
 				return err;
+			cond_resched();
 		}
 	}
 #endif
@@ -1764,6 +1765,7 @@ static int __alg_test_hash(const struct hash_testvec *vecs,
 				    hashstate);
 		if (err)
 			goto out;
+		cond_resched();
 	}
 	err = test_hash_vs_generic_impl(driver, generic_driver, maxkeysize, req,
 					desc, tsgl, hashstate);
@@ -2028,6 +2030,7 @@ static int test_aead_vec(const char *driver, int enc,
 						&cfg, req, tsgls);
 			if (err)
 				return err;
+			cond_resched();
 		}
 	}
 #endif
@@ -2267,6 +2270,7 @@ static int test_aead(const char *driver, int enc,
 				    tsgls);
 		if (err)
 			return err;
+		cond_resched();
 	}
 	return 0;
 }
@@ -2609,6 +2613,7 @@ static int test_skcipher_vec(const char *driver, int enc,
 						    &cfg, req, tsgls);
 			if (err)
 				return err;
+			cond_resched();
 		}
 	}
 #endif
@@ -2808,6 +2813,7 @@ static int test_skcipher(const char *driver, int enc,
 					tsgls);
 		if (err)
 			return err;
+		cond_resched();
 	}
 	return 0;
 }
Signature · 1 line
2.21.0
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Eric Biggers

From: Eric Biggers <[email protected]>

Call cond_resched() after each fuzz test iteration. This avoids stall warnings if fuzz_iterations is set very high for testing purposes.

While we're at it, also call cond_resched() after finishing testing each test vector.

Quoted 59 lines
---
 crypto/testmgr.c | 6 ++++++
 1 file changed, 6 insertions(+)
crypto/testmgr.c +6 -1
index 2ba0c487ea281..f7fdd7fe89a9e 100644
@@ -1496,6 +1496,7 @@ static int test_hash_vec(const char *driver, const struct hash_testvec *vec,
                                                req, desc, tsgl, hashstate);
                        if (err)
                                return err;
+                       cond_resched();
                }
        }
 #endif
@@ -1764,6 +1765,7 @@ static int __alg_test_hash(const struct hash_testvec *vecs,
                                    hashstate);
                if (err)
                        goto out;
+               cond_resched();
        }
        err = test_hash_vs_generic_impl(driver, generic_driver, maxkeysize, req,
                                        desc, tsgl, hashstate);
@@ -2028,6 +2030,7 @@ static int test_aead_vec(const char *driver, int enc,
                                                &cfg, req, tsgls);
                        if (err)
                                return err;
+                       cond_resched();
                }
        }
 #endif
@@ -2267,6 +2270,7 @@ static int test_aead(const char *driver, int enc,
                                    tsgls);
                if (err)
                        return err;
+               cond_resched();
        }
        return 0;
 }
@@ -2609,6 +2613,7 @@ static int test_skcipher_vec(const char *driver, int enc,
                                                    &cfg, req, tsgls);
                        if (err)
                                return err;
+                       cond_resched();
                }
        }
 #endif
@@ -2808,6 +2813,7 @@ static int test_skcipher(const char *driver, int enc,
                                        tsgls);
                if (err)
                        return err;
+               cond_resched();
        }
        return 0;
 }
--

2.21.0

maintainer
#2 lore raw
In reply to Eric Biggers
Quoted 5 lines · Eric Biggers

From: Eric Biggers <[email protected]>

Call cond_resched() after each fuzz test iteration. This avoids stall warnings if fuzz_iterations is set very high for testing purposes.

Quoted 7 lines

While we're at it, also call cond_resched() after finishing testing each test vector.

---
crypto/testmgr.c | 6 ++++++

1 file changed, 6 insertions(+)

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt