[openssl-dev] Multithreading performance patches

Andrey Kulikov amdeich at gmail.com
Wed Aug 17 22:17:04 UTC 2016


Hi!

> The reason is that so far it was
> reserved for occasion like this, i.e. when somebody requests it and puts
> effort into testing it in real-life application:-) Can we do that?

I did it.
Added to crypto/cryptlib.c:

#  ifndef OPENSSL_DISABLE_ATOMIC_ADD_INTERNAL
int OPENSSL_atomic_add(int *, int, int, const char *, int);
#  endif

and insert at the end of void OPENSSL_cpuid_setup(void)

#  ifndef OPENSSL_DISABLE_ATOMIC_ADD_INTERNAL
    CRYPTO_set_add_lock_callback(OPENSSL_atomic_add);
#  endif

So one could disable this feature by defining
OPENSSL_DISABLE_ATOMIC_ADD_INTERNAL macro at compile time.
Tested on Linux x86 and x64 during last 4 years on different high-load
SSL-servers.
Tested on Linux x86 and x64, Windows x86 and x64 in different SSL-client
applications.

No issues observed.

Cheers,
Andrey.

On 12 October 2012 at 18:19, Andy Polyakov <appro at openssl.org> wrote:

> > I'm working on fast multithreaded TLS server for node.js, and I've
> > encountered few problems with openssl threading support which I would
> > like to address with attached patches.
> >
> > Please ask me if you have any questions or comments.
>
> As for 1st patch. Note that the section in question is guarded by 'if
> (add_lock_callback)'. add_lock_callback can be set by application and
> perform operation to its liking. In addition, on platforms with
> OPENSSL_CPUID_OBJ defined there is OPENSSL_atomic_add that can be used
> as callback, so that all you need to do then is
> CRYPTO_set_add_lock_callback(OPENSSL_atomic_add) in application code.
> Well, you'll surely get into trouble compiling this line, because
> OPENSSL_atomic_add is not declared. The reason is that so far it was
> reserved for occasion like this, i.e. when somebody requests it and puts
> effort into testing it in real-life application:-) Can we do that?
> Original idea behind OPENSSL_atomic_add was even to enable it
> automatically. On related note one can also add pointer manipulation
> subroutines so that one can maintain linked lists in lock-free manner...
>
> I'll have closer look at second patch and comment later on.
>
> ______________________________________________________________________
> OpenSSL Project                                 http://www.openssl.org
> Development Mailing List                       openssl-dev at openssl.org
> Automated List Manager                           majordomo at openssl.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-dev/attachments/20160818/77ea843f/attachment.html>


More information about the openssl-dev mailing list