libc: separate x64-specific code and provide aarch64 stubs

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
net: always use SOMAXCONN for backlog size

The TCP stack in current form is causing a lot of connection resets
when server running inside OSv is swarmed with connection attempts.
This does not happen on Linux for the same kind of workload.

The scenario is as follows. Client sends SYN to the server which runs
inside OSv. A SYN cache entry is created and SYN+ACK is sent back. The
client sends ACK in response and connect() call exits on its
side. Form now on the client may already start to write() into the
socket. When server receives client's ACK, it looks up the entry in
SYN cache, finds it, removes it, and tries to create a full-blown
connection socket. When it attempts to append it to the listening
socket's backlog it fails to do so because the backlog is full. As a
result the ACK is dropped and there is no longer SYN cache entry for
that connection. The client doesn't know about that. Then the next
client's packet arrives with data. The server cannot find a SYN cache
entry for that and tries to do SYN-cookie check, which fails because
client sequence does not match. As a result the server sends RST to
the client.

We could get more Linux-alike behavior in such situation by applying
the following modifications to our stack:

  * Drop SYN requests when the backlog is full _and_ SYN cache has
    more than one entry. Client will try to resend SYN packet.

  * When backlog is full upon receiving ACK, keep the entry in SYN
    cache. The client will eventually retransmit unacknowledged data
    and the connection state promotion will be retried at later time.

As an interim workaround let's set the socket backlog to SOMAXCONN
(128) regardless of the desired backlog size. Apparently some
benchmarking tools (iperf) set it to a really low value (5). Since OSv
is designated to run only one process, which will typically listen on
only a handful of ports, this should not be a big threat to memory
footprint.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
tests: add test for overflowing listen backlog

This test passes on Linux but failed on OSv before the patch which
changed solisten_proto() to always use SOMAXCONN.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
mgmt: update to latest

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
aarch64: mmu: distinguish between device and normal memory

we need to do that because load/store instructions
behave differently with Device-nGnRnE memory.

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
aarch64: gic: implement GICv2

implement simple GIC class for interacting with
the GIC distributor and CPU interface.

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
aarch64: exceptions: implement interrupt table

implement a simple interrupt table to register interrupt IDs
and handlers. Map the GIC so it can be initialized by the
table constructor.

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
aarch64: smp: prepare GIC initialization per cpu

arch::init_on_cpu should initialize the gic cpu interface,
but not for the boot CPU, for which this has already been
done.

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
aarch64: implement basic General Timers infrastructure

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
aarch64: implement exception entry and exit

generate exception frame

Signed-off-by: Jani Kokkonen <jani.kokkonen@huawei.com>
Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
XXX bits forward

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>