Commit Graph

53948 Commits

Author SHA1 Message Date
Avi Kivity
ba5447871b virtio: switch to allocating virtio decriptors front-to-back
Simplifies requirements on callers.
2014-10-15 17:17:01 +03:00
Avi Kivity
a331b5a129 virtio: move vring::buffer::completed to vring::buffer_chain
We aren't interested in completion of a buffer, just a buffer_chain (aka
request).  Move it there to simplify things.
2014-10-15 17:17:01 +03:00
Avi Kivity
6f1dab52fe virtio: reduce rx allocations when preparing buffers (part 2)
Instead of producing a range of buffer chains, produce a range
of buffer arrays (std::array<buffer>).  These do not require any
allocations.
2014-10-15 17:17:01 +03:00
Avi Kivity
7684f00ebe virtio: reduce rx allocations when preparing buffers (part 1)
Instead of returning a vector of buffer chains, return an iterator
range that will produce those vectors on the fly, removing the vector
allocation.
2014-10-15 17:17:01 +03:00
Avi Kivity
de4de65d46 virtio: convert vring::post() to accept an iterator to a range
Instead of an iterator to a vector of buffers, accept an iterator
to a container of buffers, increasing flexibility for callers.
2014-10-15 17:17:01 +03:00
Avi Kivity
d63489d6b8 util: add transform_iterator
Like boost's - an iterator that applies a function to the result
of an underlying iterator.  Unlike boost, it supports using lambdas
for the function.
2014-10-15 17:16:55 +03:00
Tomasz Grabiec
bb5d1164b1 tests: memcache: test both TCP and UDP 2014-10-15 15:59:42 +02:00
Tomasz Grabiec
ec42ca860a memcache: add TCP server 2014-10-15 15:59:42 +02:00
Tomasz Grabiec
319ae0b530 core: add shared_ptr::operator=(T&&)
Allows to move an item directly into existing shread_ptr.
2014-10-15 15:59:42 +02:00
Tomasz Grabiec
a4eba9b031 posix: suppress SIGPIPE
When socket was closed by the other side and we try to write into it
the process gets SIGPIPE. We should suppress it, so that failure is
handled locally. Now the failure will percolate up as an exception.
2014-10-15 15:59:42 +02:00
Tomasz Grabiec
d575ad2dfb memcache: introduce periodic stats printer 2014-10-15 15:59:42 +02:00
Tomasz Grabiec
50feeef580 tests: memcache: introduce end-to-end tests
These tests exercise memcache instance using a real client. The
test_memcache.py suite can be run against any memcache instance which
conforms to the ASCII protocol.
2014-10-15 15:59:42 +02:00
Tomasz Grabiec
6a31f3762c tests: memcache: add test for ASCII parser 2014-10-15 15:59:42 +02:00
Tomasz Grabiec
97a16c16fd core: add operator<< which can print any vector
Useful in tests.
2014-10-15 15:59:42 +02:00
Tomasz Grabiec
88537320f3 memcache: initial version
Supports UDP and subset of ASCII protocol with the following commands:
get, set and delete.
2014-10-15 15:59:42 +02:00
Tomasz Grabiec
454ee88bb6 core: make keep_doing() propagate failure 2014-10-15 15:59:42 +02:00
Tomasz Grabiec
ca077f33ef core: introduce or_terminate()
Calls std::terminate() when future fails. It can be used like this:

  do_something([] {}).or_terminate();
2014-10-15 15:59:41 +02:00
Tomasz Grabiec
277535ca75 core: introduce vector_data_sink 2014-10-15 15:59:41 +02:00
Tomasz Grabiec
dec042f9c2 core: introduce do_for_each()
Useful when composing iteration with async operations.
2014-10-15 15:59:41 +02:00
Tomasz Grabiec
ceeda85080 core: add more overloads of output_stream::write() 2014-10-15 15:59:41 +02:00
Avi Kivity
4c64750f76 util: add function_input_iterator
Like boost's template of the same name, but works with lambdas.
2014-10-15 16:57:18 +03:00
Tomasz Grabiec
6fabc8700f core: introduce timer::rearm() 2014-10-15 15:50:46 +02:00
Tomasz Grabiec
d97c8eb50c net: introduce packet as data_source adapter 2014-10-15 15:50:46 +02:00
Tomasz Grabiec
930181d361 net: fix packet constructors
Thy did not compile.
2014-10-15 15:50:46 +02:00
Tomasz Grabiec
c4d18b6ae6 tests: introduce test runner script
To run all unit tests:

  $ ./test.py
  [3/6] RUNNING build/release/tests/sstring_test
2014-10-15 15:50:46 +02:00
Tomasz Grabiec
da10ab6443 tests: add sstring tests 2014-10-15 15:50:46 +02:00
Tomasz Grabiec
5f3352b7e3 tests: integrate with BOOST UTF
Asynchronous test cases can be delared using SEASTAR_TEST_CASE macro,
which is equivalent to BOOST_AUTO_TEST_CASE, but the function body is
run inside a reactor and can returns a future<> which resolves when
the test is done.
2014-10-15 15:50:28 +02:00
Tomasz Grabiec
4e3317b072 core: fix formatting 2014-10-15 15:50:28 +02:00
Tomasz Grabiec
700325886d convert non-system includes to use quotes 2014-10-15 15:50:28 +02:00
Avi Kivity
b90670417b memory: fix off-by-one in to-resize
cpu_pages::initialize() established the one-past-the-end page as a sentinel
to avoid boundary conditions checks.  cpu_pages::do_resize() considers the
last page as the sentinel.  This discrepancy causes the last page to be
considered free by do_resize, which promptly ends up as a use-after-free
page.

Fix by aligning do_resize() with initialize().
2014-10-15 16:44:36 +03:00
Raphael S. Carvalho
d7fe901005 tests: add blkdiscard_test
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2014-10-15 12:45:55 +03:00
Raphael S. Carvalho
2a7efbd884 core: introduce TRIM support
ioctl and fallocate are being used for TRIMMING effect on block and regular
files, respectively.
This feature is useful for SSDs, where write amplification can be reduced,
and drive life increased. Unlike HDD, SSD has to be explicitly notified of
blocks no longer used.
The interface consists of passing the range to the function, through offset
and length parameters.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2014-10-15 12:45:54 +03:00
Raphael S. Carvalho
f3e429bc43 core: add support for file classes
Intended to allow different file classes to implement their own
file operations; currently supporting regular and block device
files. This support would also be required for a native file
system, for example.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2014-10-15 12:45:54 +03:00
Nadav Har'El
a85baa4e8f Instructions on how to run Seastar on OSv
Due to popular demand, this patch adds README-OSv, containing detailed
instructions on how to run Seastar inside OSv.

Because Seastar is moving at a fast pace, and uses new "exotic" Linux
features almost every day, please make sure that you use the latest
master of OSv, otherwise you are very likely to be missing features that
Seastar needs. At the time of this writing, you'll even need to apply a
few uncommited OSv patches (those which add thread pinning support), but
hopefully these patches will be committed today and the OSv master will
go back to enough for the Seastar master.

To clarify (though this is also mentioned in the README-OSv itself),
Seastar can only run in OSv with the "posix" network stack. The
"native" network stack does not work yet, because we haven't completed
a mechanism to assign virtio (or xen) from OSv directly to Seastar.
This is in the works.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2014-10-15 12:44:54 +03:00
Asias He
d450cba365 tcp: Send RST in response to un-listened port.
Before:
$ curl http://192.168.66.123:20000
The client will keep sending SYN packet and hangs.

After:
$ curl http://192.168.66.123:20000
curl: (7) Failed connect to 192.168.66.123:20000; Connection refused

Linux and OS X do the same.

[avi: drop connection_refused declaration]
2014-10-15 12:26:12 +03:00
Asias He
20349885e3 queue: Add missing including of future.hh 2014-10-15 12:21:22 +03:00
Tomasz Grabiec
3765bec155 net: speculate EPOLLIN and EPOLLOUT on sendmsg/sendto/recvmsg
It improves memaslap score of UDP memcache by 30%.

Note that for recvmsg we always speculate because in case of UDP we
don't know the exact sizeof the datagram and thus we always specify
larger size in msghdr.
2014-10-14 12:01:31 +03:00
Gleb Natapov
5b28d5455b build: add libm to the library list
Needed for static compilation with clang.
2014-10-14 10:21:09 +03:00
Avi Kivity
c85e269c99 build: move posix-stack to core
Otherwise, anything that's not linked with net/ has no network stack and
aborts.  net/ is meant for the native stack anyway.
2014-10-14 09:36:32 +03:00
Avi Kivity
7b4ea128fa build: fix default for tristate configs
Should be None, not False, so that notes are emitted if an optional package is
not installed.
2014-10-13 23:23:45 +03:00
Avi Kivity
8445f66d91 app-template: make command line options override config file options
Instead of vice versa.
2014-10-13 17:48:23 +03:00
Avi Kivity
f2ee7d09de docker: updates 2014-10-13 16:22:08 +03:00
Avi Kivity
07a3269809 build: fix warning detection on gcc
gcc ignores -Wno-mismatches-tags even though it is not supported.  Invert
the sense of the warning for the test.
2014-10-13 16:19:19 +03:00
Gleb Natapov
2982efbac0 virtio: remove unneeded allocation from virtio_net_device::txq::post
virtio_net_device::txq::post allocates temporary vector each time it
calls vring::post() since later expects to get vector as a parameter.
Change vring::post() to get two iterators instead and remove needless
vector allocation.
2014-10-13 15:51:50 +03:00
Glauber Costa
41c2fcb109 posix: provide mmap helper
For mmaps over a file descriptor, it makes sense to have the operation as a
method of file_desc.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2014-10-13 15:51:43 +03:00
Nadav Har'El
e4cd6cc786 New requirements for README.md
Unfortunately, we have two new non-obvious prerequisites: numactl and hwloc.
List them in README.md.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2014-10-13 15:51:37 +03:00
Avi Kivity
2d13f95a9f memory: support for non-hwloc builds 2014-10-13 15:41:18 +03:00
Avi Kivity
e8e9177def build: configurable hwloc support
Allow requiring, disabling, or autodetecting hwloc support.
2014-10-13 15:40:17 +03:00
Avi Kivity
e1bdbbf2e8 docker: update 2014-10-13 07:48:21 -04:00
Avi Kivity
c630bd8171 Merge branch 'numa'
Add -m option for tuning memory size; and use mbind() and pinning so that
a cpu engine accesses local memory, if possible.
2014-10-13 13:07:46 +03:00