All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crypto: testmgr - add some more preemption points
@ 2019-06-03  5:42 Eric Biggers
  2019-06-03  6:52 ` Ard Biesheuvel
  2019-06-13  6:54 ` Herbert Xu
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Biggers @ 2019-06-03  5:42 UTC (permalink / raw)
  To: linux-crypto

From: Eric Biggers <ebiggers@google.com>

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.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 crypto/testmgr.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 2ba0c487ea281..f7fdd7fe89a9e 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] crypto: testmgr - add some more preemption points
  2019-06-03  5:42 [PATCH] crypto: testmgr - add some more preemption points Eric Biggers
@ 2019-06-03  6:52 ` Ard Biesheuvel
  2019-06-13  6:54 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2019-06-03  6:52 UTC (permalink / raw)
  To: Eric Biggers; +Cc: open list:HARDWARE RANDOM NUMBER GENERATOR CORE

On Mon, 3 Jun 2019 at 07:42, Eric Biggers <ebiggers@kernel.org> wrote:
>
> From: Eric Biggers <ebiggers@google.com>
>
> 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.
>
> Signed-off-by: Eric Biggers <ebiggers@google.com>

Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> ---
>  crypto/testmgr.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/crypto/testmgr.c b/crypto/testmgr.c
> index 2ba0c487ea281..f7fdd7fe89a9e 100644
> --- a/crypto/testmgr.c
> +++ b/crypto/testmgr.c
> @@ -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
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] crypto: testmgr - add some more preemption points
  2019-06-03  5:42 [PATCH] crypto: testmgr - add some more preemption points Eric Biggers
  2019-06-03  6:52 ` Ard Biesheuvel
@ 2019-06-13  6:54 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2019-06-13  6:54 UTC (permalink / raw)
  To: Eric Biggers; +Cc: linux-crypto

Eric Biggers <ebiggers@kernel.org> wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> 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.
> 
> Signed-off-by: Eric Biggers <ebiggers@google.com>
> ---
> crypto/testmgr.c | 6 ++++++
> 1 file changed, 6 insertions(+)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-06-13 16:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-03  5:42 [PATCH] crypto: testmgr - add some more preemption points Eric Biggers
2019-06-03  6:52 ` Ard Biesheuvel
2019-06-13  6:54 ` Herbert Xu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.