Commit Graph

43077 Commits

Author SHA1 Message Date
Avi Kivity
1cd888c4a9 posix: move posix_thread implementation to new source file 2014-10-05 18:49:36 +03:00
Avi Kivity
10ea65cc0b posix: support std::move()ing a posix_thread
Useful for storing in containers.
2014-10-05 18:45:51 +03:00
Avi Kivity
96c83e1bdd posix: add pthread wrapper
std::thread allocates memory, while we want a non allocating version
for the worker threads.
2014-10-05 18:09:09 +03:00
Avi Kivity
1dbab3504c posix: add missing includes 2014-10-05 18:09:09 +03:00
Avi Kivity
5bc6f8911b build: define DEBUG for the debug build 2014-10-05 18:09:09 +03:00
Avi Kivity
7a16599f70 core: add bit operations library 2014-10-05 18:09:09 +03:00
Avi Kivity
a597379db8 core: add align_down() 2014-10-05 18:09:09 +03:00
Avi Kivity
0bbd42bc63 core: extract align_up() into an include file 2014-10-05 18:09:09 +03:00
Avi Kivity
ef96af29f2 future: avoid generalized lambda in forward_to()
Crashes gdb with -O0.
2014-10-05 15:44:49 +03:00
Avi Kivity
4cc5ce93de Merge branch 'tgrabiec/virtio-back-pressure' of github.com:cloudius-systems/seastar-dev
Back pressure from virtio into the rest of the stack, plus removal os the
virtio tx queue, from Tomek.

Conflicts:
	net/virtio.cc
2014-10-05 09:59:43 +03:00
Nadav Har'El
d08b1dcacd README: say you need to run ./configure.py once
Add to the README the instruction to run "./configure.py" once.
If you don't, ninja-build will not work because the build.ninja
file will be missing.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2014-10-05 09:48:56 +03:00
Tomasz Grabiec
05aece51dc virtio: remove intermediate queue
Currently the send path buffers packets in (unbounded) _tx_queue and
in virtio ring. On queue would suffice though.

This change also prpagates the back pressure resulting from queue-full
condition up the send path. This is needed, becasue otherwise if
senders are faster than the network we will eventually run out of
memory. This would also cause a "buffer bloat" effect, which hurts
latency-sensitive workloads.
2014-10-04 11:27:23 +02:00
Tomasz Grabiec
076d3b2682 ip: connect send() action with L3's send() action
So that back-pressure or failure from the lower layers are tranferred.
2014-10-04 11:27:23 +02:00
Tomasz Grabiec
6fa9cd7ac9 core: introduce do_until() and keep_doing() 2014-10-04 11:27:23 +02:00
Avi Kivity
24aafbf8f9 virtio: reduce allocations in transmit path
Reserve enough entries in the buffer chain to store all fragments.
2014-10-04 10:16:44 +03:00
Gleb Natapov
0a3df514cb smp: fix completion handling in inter_thread_work_queue
Currently completion processing start during object creation, but since
all object are created by main thread they all run on the same cpu which
is incorrect. This patch starts completion processing on correct cpu.
2014-10-02 15:49:53 +03:00
Raphael S. Carvalho
89147b2532 fileiotest: verify read size
add assert to dma_read return

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2014-10-02 15:45:06 +03:00
Gleb Natapov
534ce9b0db packet: use delegating constructor instead of duplicating code 2014-10-02 15:43:09 +03:00
Avi Kivity
1f44e71cb2 virtio: switch to circular_buffer 2014-10-02 14:32:34 +03:00
Avi Kivity
98665bf944 reactor: switch _pending_tasks to circular_buffer
This lets us get rid of the double buffering, since we can pop tasks off
one end while inserting them on the other.
2014-10-02 14:32:34 +03:00
Avi Kivity
2d012e1df8 queue: switch to circular_buffer 2014-10-02 14:32:34 +03:00
Avi Kivity
c8b602e713 httpd: switch to circular_buffer 2014-10-02 14:32:34 +03:00
Avi Kivity
df32573bf2 tcp: mark connection as noexcept move constructible 2014-10-02 14:32:34 +03:00
Avi Kivity
bc8a940dfa packet: mark as noexcept move constructible 2014-10-02 14:32:34 +03:00
Avi Kivity
dacf81745e core: add circular_buffer
Since we have lots of queues, we need an efficient queue structure,
esp. for moveable types.  libstdc++'s std::deque is quite hairy,
and boost's circular_buffer_space_optimized uses assignments instead of
constructors, which are both slower and less available than constructors.

This patch implements a growable circular buffer for these needs.
2014-10-02 14:32:32 +03:00
Avi Kivity
42db87a8c2 core: add helper functions for "transferring" objects
Here, transferring is defined as moving an object to a new location
(either via a move or copy constructor) and destroying the source.  This
is useful when implementing containers.
2014-10-02 14:28:14 +03:00
Avi Kivity
26f78f97f4 Merge branch 'tgrabiec/arp' of github.com:cloudius-systems/seastar-dev
ARP related fixes, including many core updates.
2014-10-01 16:34:21 +03:00
Tomasz Grabiec
73413748a7 arp: limit the number of waiting requests
Currently the waiters queue can grow to infinity pretty quickly.
2014-10-01 13:45:29 +02:00
Tomasz Grabiec
a435a0561d arp: fail requests on timeout 2014-10-01 13:45:29 +02:00
Tomasz Grabiec
281d986c34 arp: retry lookup requests every second
Bridges with forwarding delay ignore requests for some time. We should
retry the request so that we eventually get the response.
2014-10-01 13:45:29 +02:00
Tomasz Grabiec
04b53b7498 ip: make send() composable
This allows the caller to compose it with other actions when send() is
done or when it fails.
2014-10-01 13:45:28 +02:00
Tomasz Grabiec
86246a4c0e tests: add test for bug in error propagation by future::then() 2014-10-01 13:45:28 +02:00
Tomasz Grabiec
6fa3212888 core: fix missing error propagation when intermediate future is involved
Test case (added in the next patch):

    promise<> p1;
    promise<> p2;

    auto f = p1.get_future().then([f = std::move(p2.get_future())] () mutable {
        return std::move(f); // this future will fail
    }).then([] {
        // never reached, that's ok
    });

    p1.set_value();
    p2.set_exception(std::runtime_error("boom"));

    // f should get resolved eventually with error, but was not
2014-10-01 13:45:28 +02:00
Tomasz Grabiec
6f1d1d6627 tests: add tests for future::rescue() 2014-10-01 13:45:28 +02:00
Tomasz Grabiec
0269fd6f15 tests: add tests for future::finally() 2014-10-01 13:45:28 +02:00
Tomasz Grabiec
d9bf08c1b3 core: introduce future::finally()
The callback passed to it will be executed when future gets resolved,
successfully or not. The returned future will mimic the state of the
target future.
2014-10-01 13:45:28 +02:00
Tomasz Grabiec
fcb55c1f04 core: introduce future::forward_to()
It causes that when future is resolved, the target promise will be
resolved too with the same state.
2014-10-01 13:45:28 +02:00
Tomasz Grabiec
07d6df11a8 core: introduce make_exception_future() which works with exception objects 2014-10-01 13:45:25 +02:00
Tomasz Grabiec
125a696d6c core: introduce promise::set_exception() which works with exception objects 2014-10-01 13:45:22 +02:00
Tomasz Grabiec
061bccd084 core: timer: add support for periodicy
Simplifies the client side which uses periodic timers.
2014-10-01 13:21:10 +02:00
Tomasz Grabiec
48a86b7073 core: make timer callbacks synchronous with state changes
It allows for simpler client code because the client can assume that
when cancel() returns the callback will not run and thus there's no
need to handle the race between timer teardown and execution of the
callback.
2014-10-01 13:21:10 +02:00
Tomasz Grabiec
9a0ab2f1a4 tests: introduce some basic utilities used by tests 2014-10-01 13:21:09 +02:00
Tomasz Grabiec
eeea3640f2 core: make future::rescue() return a future<>
This will allow to compose rescue() just like then().
2014-10-01 13:21:09 +02:00
Tomasz Grabiec
5f2e06beda core: make future's result obtainable via future::rescue()
This will allow the user to have one handler for both success and
failure. This simplifies client code a bit when both paths need to
work on the same object. Having to split the function into two
callbacks, one of which is passed to then() and the other to rescue()
on a resulting promise, would make it necessary to wrap the object in
a shared_ptr, which is suboptimal.
2014-10-01 13:21:02 +02:00
Avi Kivity
4f5059fa75 app template: support configuration files
~/.config/seastar/seastar.conf
2014-09-30 21:29:53 +03:00
Avi Kivity
475c9a39dc tcp: fix FIN handling
Advance sequence number after our FIN is acknowledged, and don't sent it
out again after that.

Fixes FIN storm after the connection is closed.
2014-09-30 20:11:44 +03:00
Asias He
ca9019cdfe virtio: Rename std::vector<vring::buffer_chain> ret to vbc
Make the naming more consistent.
2014-09-30 11:28:26 +03:00
Asias He
4db98d5159 virtio: Fix ring size
Fix error with tcp_test:
terminate called after throwing an instance of
'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::bad_any_cast> >'
  what():  boost::bad_any_cast: failed conversion using boost::any_cast
2014-09-30 10:47:11 +03:00
Avi Kivity
3daee77c9e build: support configuring the compiler 2014-09-30 10:43:46 +03:00
Avi Kivity
404cabc645 build: list required libraries explicitly
clang doesn't add those libraries itself, add them explicitly.
2014-09-30 10:43:16 +03:00