Improve speed and scalability of __tls_get_addr()

As explained in issue #555, applications which use thread-local variables
are noticably slowed down by our slow implementation of __tls_get_addr().

The compiler calls this function in shared-library code which uses thread
local variables. Our implementation used a mutex, which is slow (relative
to an ordinary variable access), and non-scalable (two threads cannot
concurrently access their own thread-local variable!). In this patch we
switch to RCU, which is significantly faster and does not prevent
concurrent use.

This patch improves the tests/misc-tls.so benchmark from 27ns to 8ns.
__tls_get_addr() is still significantly slower than without it (2ns),
so there is still room for improvement - but it's a good start.

I also measured this patch to improve by 17% the performance of an actual
application which makes heavy use of a thread-local variable. The same
application also had abysmal performance when run on two threads
(2-thread performance was 10 times slower than one thread), and this
problem was improved as well.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Further improve __tls_get_addr() speed

After a previous sped up __tls_get_addr() (measured with tst/misc-tls.so)
from 27ns to 8ns, this patch further speeds it up to 4ns. Subtracting the
test iteration time for a non-tls variable (2ns), we are left with a 2ns
overhead for accessing a TLS variable, which is probably small enough to
tolerate.

In this patch, we reorganize the code called in __tls_get_addr() to make
sure the fast path is indeed as fast as possible. We notice that in the
fast path, we just use the module number and don't even need to find
the elf::object pointer - and the previous code organization, which always
found the elf::object, was wasting time doing this. Furthermore, we can
use more inline code (the previous code had 3 layers of out-of-line
functions calling each other). As mentioned above, these changes together
reduce the __tls_get_addr() overhead from 6ns to 2ns.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Http Server Testing: update get file status test to reflect /etc/hosts permissions

/etc/hosts permission was changed from 666 to 664, which break the tests
that relay on those permission to check the file status API.

This update the test to compare to the updated permissions.

Suggested-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Http Server: Modify the image in the testing

The testing require an image that contains java application to it can test the
java API. Now that the java based CLI is no longer supported the image that
will be used is jetty.

In addition, to simplify specific testing with and without ssl, make check was
broken in to two task check-ssl and check-http.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Http Server Test: switch from shutdown to power off

When running the tests, it is better to use power off to the running image, to
make sure that the tests would end.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>