[openssl-commits] [openssl] master update

Rich Salz rsalz at openssl.org
Wed Mar 9 02:04:20 UTC 2016


The branch master has been updated
       via  2ea92604969fb9e5e53e135393e04ebc512f808b (commit)
       via  363a1fc60273095702269b083cd948cc655551e3 (commit)
       via  564e10294a4abe9743c7d8a9ccba30eb8e1c54d0 (commit)
      from  2f781956779d64e32f3cfb0016a532de2bb6dc89 (commit)


- Log -----------------------------------------------------------------
commit 2ea92604969fb9e5e53e135393e04ebc512f808b
Author: Andrea Grandi <andrea.grandi at intel.com>
Date:   Tue Mar 8 04:51:04 2016 +0000

    Fix names of the #define used for platform specific code
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 363a1fc60273095702269b083cd948cc655551e3
Author: Andrea Grandi <andrea.grandi at intel.com>
Date:   Mon Mar 7 11:20:01 2016 +0000

    Add empty line after local variables
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 564e10294a4abe9743c7d8a9ccba30eb8e1c54d0
Author: Andrea Grandi <andrea.grandi at intel.com>
Date:   Thu Mar 3 07:09:00 2016 +0000

    Fix error with wait set of fds for the select()
    
    It also makes the call to select blocking to reduce CPU usage
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    Reviewed-by: Rich Salz <rsalz at openssl.org>

-----------------------------------------------------------------------

Summary of changes:
 apps/speed.c | 98 +++++++++++++++---------------------------------------------
 1 file changed, 24 insertions(+), 74 deletions(-)

diff --git a/apps/speed.c b/apps/speed.c
index 4d3a938..b6843ec 100644
--- a/apps/speed.c
+++ b/apps/speed.c
@@ -1118,10 +1118,6 @@ static int run_benchmark(int async_jobs, int (*loop_function)(void *), loopargs_
     int i = 0;
     OSSL_ASYNC_FD job_fd = 0;
     size_t num_job_fds = 0;
-#if defined(OPENSSL_SYS_UNIX)
-    fd_set waitfdset;
-    OSSL_ASYNC_FD max_fd = 0;
-#endif
 
     run = 1;
 
@@ -1153,89 +1149,46 @@ static int run_benchmark(int async_jobs, int (*loop_function)(void *), loopargs_
         }
     }
 
-#if defined(OPENSSL_SYS_UNIX)
-    FD_ZERO(&waitfdset);
-
-    /* Add to the wait set all the fds that are already in the WAIT_CTX
-     * This is required when the same ctx is used multiple times
-     * For the purpose of speed, each job can be associated to at most one fd
-     */
-    for (i = 0; i < async_jobs && num_inprogress > 0; i++) {
-        if (loopargs[i].inprogress_job == NULL)
-            continue;
-
-        if (!ASYNC_WAIT_CTX_get_all_fds(loopargs[i].wait_ctx, NULL, &num_job_fds)
-                || num_job_fds > 1) {
-            BIO_printf(bio_err, "Too many fds in ASYNC_WAIT_CTX\n");
-            ERR_print_errors(bio_err);
-            error = 1;
-            break;
-        }
-        ASYNC_WAIT_CTX_get_all_fds(loopargs[i].wait_ctx, &job_fd, &num_job_fds);
-        FD_SET(job_fd, &waitfdset);
-        if (job_fd > max_fd)
-            max_fd = job_fd;
-    }
-#endif
-
     while (num_inprogress > 0) {
-#if defined(OPENSSL_SYS_UNIX)
+#if defined(OPENSSL_SYS_WINDOWS)
+        DWORD avail = 0;
+#elif defined(OPENSSL_SYS_UNIX)
         int select_result = 0;
-        struct timeval select_timeout;
-        select_timeout.tv_sec = 0;
-        select_timeout.tv_usec = 0;
+        OSSL_ASYNC_FD max_fd = 0;
+        fd_set waitfdset;
 
-        for (i = 0; i < async_jobs; i++) {
-            if (loopargs[i].inprogress_job != NULL) {
-                /* Consider only changed fds to minimize the operations on waitfdset */
-                OSSL_ASYNC_FD add_fd, del_fd;
-                size_t num_add_fds, num_del_fds;
-                if (!ASYNC_WAIT_CTX_get_changed_fds(loopargs[i].wait_ctx, NULL,
-                                                    &num_add_fds, NULL, &num_del_fds)) {
-                    BIO_printf(bio_err, "Failure in ASYNC_WAIT_CTX\n");
-                    ERR_print_errors(bio_err);
-                    error = 1;
-                    break;
-                }
-                if (num_add_fds > 1 || num_del_fds > 1) {
-                    BIO_printf(bio_err, "Too many fds have changed in ASYNC_WAIT_CTX\n");
-                    ERR_print_errors(bio_err);
-                    error = 1;
-                    break;
-                }
-                if (num_add_fds == 0 && num_del_fds == 0)
-                    continue;
-
-                ASYNC_WAIT_CTX_get_changed_fds(loopargs[i].wait_ctx, &add_fd, &num_add_fds,
-                                               &del_fd, &num_del_fds);
+        FD_ZERO(&waitfdset);
 
-                if (num_del_fds == 1)
-                    FD_CLR(del_fd, &waitfdset);
+        for (i = 0; i < async_jobs && num_inprogress > 0; i++) {
+            if (loopargs[i].inprogress_job == NULL)
+                continue;
 
-                if (num_add_fds == 1) {
-                    FD_SET(add_fd, &waitfdset);
-                    if (add_fd > max_fd)
-                        max_fd = add_fd;
-                }
+            if (!ASYNC_WAIT_CTX_get_all_fds(loopargs[i].wait_ctx, NULL, &num_job_fds)
+                    || num_job_fds > 1) {
+                BIO_printf(bio_err, "Too many fds in ASYNC_WAIT_CTX\n");
+                ERR_print_errors(bio_err);
+                error = 1;
+                break;
             }
+            ASYNC_WAIT_CTX_get_all_fds(loopargs[i].wait_ctx, &job_fd, &num_job_fds);
+            FD_SET(job_fd, &waitfdset);
+            if (job_fd > max_fd)
+                max_fd = job_fd;
         }
-        select_result = select(max_fd + 1, &waitfdset, NULL, NULL, &select_timeout);
 
+        select_result = select(max_fd + 1, &waitfdset, NULL, NULL, NULL);
         if (select_result == -1 && errno == EINTR)
             continue;
 
         if (select_result == -1) {
-                BIO_printf(bio_err, "Failure in the select\n");
-                ERR_print_errors(bio_err);
-                error = 1;
-                break;
+            BIO_printf(bio_err, "Failure in the select\n");
+            ERR_print_errors(bio_err);
+            error = 1;
+            break;
         }
 
         if (select_result == 0)
             continue;
-
-#elif defined(OPENSSL_SYS_WINDOWS)
-        DWORD avail = 0;
 #endif
 
         for (i = 0; i < async_jobs; i++) {
@@ -1272,9 +1225,6 @@ static int run_benchmark(int async_jobs, int (*loop_function)(void *), loopargs_
                         total_op_count += job_op_count;
                     }
                     --num_inprogress;
-#if defined(OPENSSL_SYS_UNIX)
-                    FD_CLR(job_fd, &waitfdset);
-#endif
                     loopargs[i].inprogress_job = NULL;
                     break;
                 case ASYNC_NO_JOBS:


More information about the openssl-commits mailing list