Commit Graph

482 Commits

Author SHA1 Message Date
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
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
Avi Kivity
60b4756a36 smp: allow tuning memory size 2014-10-13 13:03:48 +03:00
Avi Kivity
56598903f6 memory: add support for reconfiguring memory
- add memory to a cpu
- bind that memory to a NUMA node
2014-10-13 13:03:46 +03:00
Avi Kivity
e2ea9336cd sockaddr: declare operator==() in global namespace
Needed for argument-dependent lookup; pointed out by clang.
2014-10-13 11:57:53 +03:00
Avi Kivity
3397812551 build: disable debug information on clang do to missing support 2014-10-13 11:55:05 +03:00
Avi Kivity
51261a2ff1 build: disable mismatched tags warning 2014-10-13 11:18:06 +03:00
Avi Kivity
7f8d92ee3c posix-stack.cc: add missing copyright 2014-10-13 09:31:04 +03:00
Avi Kivity
4a66794331 Merge branch 'asias/net' of github.com:cloudius-systems/seastar-dev
Net queue from Asias.
2014-10-13 09:24:44 +03:00
Asias He
c2650971b9 virtio-net: Improve RX packet building
Use begin and end iterator to build a packet in one go.
2014-10-13 11:37:56 +08:00
Asias He
4d71913a5b virtio-net: Enable guest side TSO4 and UFO
With merge receive buffer support, we can handle large packet on the RX
path now.
2014-10-13 11:37:56 +08:00
Asias He
c5861476b9 net: Rename pseudo_header_checksum to tcp_pseudo_header_checksum
We already have udp_pseudo_header_checksum. Make the name more
consistent.
2014-10-13 11:37:56 +08:00
Asias He
2625dd5944 net: Introduce eth_protocol_num 2014-10-13 11:37:56 +08:00
Asias He
5cf3f200c5 net: Introduce ip_protocol_num
We use this in all the places where the ip protocol number is used.
2014-10-13 11:37:56 +08:00
Asias He
05c72b0808 net: UDP checksum offload and UPD fragmentation offload 2014-10-13 11:37:56 +08:00
Asias He
5c661b5034 tcp: Setup initial sequence numbers 2014-10-13 11:37:56 +08:00
Asias He
d5c8155e00 net: Split posix stack related code to net/posix-stack.cc
NOTE: This patch makes pollable_fd::get_file_desc public in order to
access it in posix_server_socket_impl::accept(). Maybe there is a better
solution. But, fow now, this avoids a lot of including game.
2014-10-13 11:33:57 +08:00
Asias He
0ffaa0cbdd net: Reorder net/stack.cc
Makes the file more readable. Now, The classes are defined in orders.
2014-10-13 11:33:47 +08:00