The branch stable/12 has been updated by mjg:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=16ffd822c8236b2b0dae3fb43ffe55043985d0c8

commit 16ffd822c8236b2b0dae3fb43ffe55043985d0c8
Author:     Mark Johnston <[email protected]>
AuthorDate: 2020-06-30 15:56:54 +0000
Commit:     Mateusz Guzik <[email protected]>
CommitDate: 2021-09-16 11:20:44 +0000

    Remove CRYPTO_TIMING.
    
    It was added a very long time ago.  It is single-threaded, so only
    really useful for basic measurements, and in the meantime we've gotten
    some more sophisticated profiling tools.
    
    Reviewed by:    cem, delphij, jhb
    Sponsored by:   Rubicon Communications, LLC (Netgate)
    Differential Revision:  https://reviews.freebsd.org/D25464
    
    (cherry picked from commit a5c053f5a78ca68f9dcace37186142266787eaa0)
---
 sys/opencrypto/crypto.c    | 81 +++-------------------------------------------
 sys/opencrypto/cryptodev.h | 17 ----------
 2 files changed, 4 insertions(+), 94 deletions(-)

diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c
index 348bcfbbed17..01283807a670 100644
--- a/sys/opencrypto/crypto.c
+++ b/sys/opencrypto/crypto.c
@@ -54,8 +54,6 @@ __FBSDID("$FreeBSD$");
  * PURPOSE.
  */
 
-#define        CRYPTO_TIMING                           /* enable timing 
support */
-
 #include "opt_ddb.h"
 
 #include <sys/param.h>
@@ -223,12 +221,6 @@ static     struct cryptostats cryptostats;
 SYSCTL_STRUCT(_kern, OID_AUTO, crypto_stats, CTLFLAG_RW, &cryptostats,
            cryptostats, "Crypto system statistics");
 
-#ifdef CRYPTO_TIMING
-static int crypto_timing = 0;
-SYSCTL_INT(_debug, OID_AUTO, crypto_timing, CTLFLAG_RW,
-          &crypto_timing, 0, "Enable/disable crypto timing support");
-#endif
-
 /* Try to avoid directly exposing the key buffer as a symbol */
 static struct keybuf *keybuf;
 
@@ -1014,11 +1006,6 @@ crypto_dispatch(struct cryptop *crp)
 
        cryptostats.cs_ops++;
 
-#ifdef CRYPTO_TIMING
-       if (crypto_timing)
-               binuptime(&crp->crp_tstamp);
-#endif
-
        crp->crp_retw_id = ((uintptr_t)crp->crp_session) % crypto_workers_num;
 
        if (CRYPTOP_ASYNC(crp)) {
@@ -1224,32 +1211,6 @@ crypto_kinvoke(struct cryptkop *krp, int crid)
        return 0;
 }
 
-#ifdef CRYPTO_TIMING
-static void
-crypto_tstat(struct cryptotstat *ts, struct bintime *bt)
-{
-       struct bintime now, delta;
-       struct timespec t;
-       uint64_t u;
-
-       binuptime(&now);
-       u = now.frac;
-       delta.frac = now.frac - bt->frac;
-       delta.sec = now.sec - bt->sec;
-       if (u < delta.frac)
-               delta.sec--;
-       bintime2timespec(&delta, &t);
-       timespecadd(&ts->acc, &t, &ts->acc);
-       if (timespeccmp(&t, &ts->min, <))
-               ts->min = t;
-       if (timespeccmp(&t, &ts->max, >))
-               ts->max = t;
-       ts->count++;
-
-       *bt = now;
-}
-#endif
-
 static void
 crypto_task_invoke(void *ctx, int pending)
 {
@@ -1279,10 +1240,6 @@ crypto_invoke(struct cryptocap *cap, struct cryptop 
*crp, int hint)
            ("%s: crp->crp_callback == NULL", __func__));
        KASSERT(crp->crp_desc != NULL, ("%s: crp->crp_desc == NULL", __func__));
 
-#ifdef CRYPTO_TIMING
-       if (crypto_timing)
-               crypto_tstat(&cryptostats.cs_invoke, &crp->crp_tstamp);
-#endif
        if (cap->cc_flags & CRYPTOCAP_F_CLEANUP) {
                struct cryptodesc *crd;
                crypto_session_t nses;
@@ -1394,10 +1351,7 @@ crypto_done(struct cryptop *crp)
        crp->crp_flags |= CRYPTO_F_DONE;
        if (crp->crp_etype != 0)
                cryptostats.cs_errs++;
-#ifdef CRYPTO_TIMING
-       if (crypto_timing)
-               crypto_tstat(&cryptostats.cs_done, &crp->crp_tstamp);
-#endif
+
        /*
         * CBIMM means unconditionally do the callback immediately;
         * CBIFSYNC means do the callback immediately only if the
@@ -1414,20 +1368,7 @@ crypto_done(struct cryptop *crp)
                 * callback routine does very little (e.g. the
                 * /dev/crypto callback method just does a wakeup).
                 */
-#ifdef CRYPTO_TIMING
-               if (crypto_timing) {
-                       /*
-                        * NB: We must copy the timestamp before
-                        * doing the callback as the cryptop is
-                        * likely to be reclaimed.
-                        */
-                       struct bintime t = crp->crp_tstamp;
-                       crypto_tstat(&cryptostats.cs_cb, &t);
-                       crp->crp_callback(crp);
-                       crypto_tstat(&cryptostats.cs_finis, &t);
-               } else
-#endif
-                       crp->crp_callback(crp);
+               crp->crp_callback(crp);
        } else {
                struct crypto_ret_worker *ret_worker;
                bool wake;
@@ -1732,22 +1673,8 @@ crypto_ret_proc(struct crypto_ret_worker *ret_worker)
                        /*
                         * Run callbacks unlocked.
                         */
-                       if (crpt != NULL) {
-#ifdef CRYPTO_TIMING
-                               if (crypto_timing) {
-                                       /*
-                                        * NB: We must copy the timestamp before
-                                        * doing the callback as the cryptop is
-                                        * likely to be reclaimed.
-                                        */
-                                       struct bintime t = crpt->crp_tstamp;
-                                       crypto_tstat(&cryptostats.cs_cb, &t);
-                                       crpt->crp_callback(crpt);
-                                       crypto_tstat(&cryptostats.cs_finis, &t);
-                               } else
-#endif
-                                       crpt->crp_callback(crpt);
-                       }
+                       if (crpt != NULL)
+                               crpt->crp_callback(crpt);
                        if (krpt != NULL)
                                krpt->krp_callback(krpt);
                        CRYPTO_RETW_LOCK(ret_worker);
diff --git a/sys/opencrypto/cryptodev.h b/sys/opencrypto/cryptodev.h
index 31e7a312d4dc..64020be843bc 100644
--- a/sys/opencrypto/cryptodev.h
+++ b/sys/opencrypto/cryptodev.h
@@ -348,13 +348,6 @@ struct crypt_kop {
 #define        CIOCFINDDEV     _IOWR('c', 108, struct crypt_find_op)
 #define        CIOCCRYPTAEAD   _IOWR('c', 109, struct crypt_aead)
 
-struct cryptotstat {
-       struct timespec acc;            /* total accumulated time */
-       struct timespec min;            /* min time */
-       struct timespec max;            /* max time */
-       u_int32_t       count;          /* number of observations */
-};
-
 struct cryptostats {
        u_int32_t       cs_ops;         /* symmetric crypto ops submitted */
        u_int32_t       cs_errs;        /* symmetric crypto ops that failed */
@@ -364,16 +357,6 @@ struct cryptostats {
        u_int32_t       cs_rets;        /* crypto return thread activations */
        u_int32_t       cs_blocks;      /* symmetric op driver block */
        u_int32_t       cs_kblocks;     /* symmetric op driver block */
-       /*
-        * When CRYPTO_TIMING is defined at compile time and the
-        * sysctl debug.crypto is set to 1, the crypto system will
-        * accumulate statistics about how long it takes to process
-        * crypto requests at various points during processing.
-        */
-       struct cryptotstat cs_invoke;   /* crypto_dipsatch -> crypto_invoke */
-       struct cryptotstat cs_done;     /* crypto_invoke -> crypto_done */
-       struct cryptotstat cs_cb;       /* crypto_done -> callback */
-       struct cryptotstat cs_finis;    /* callback -> callback return */
 };
 
 #ifdef _KERNEL
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to