Commit Graph

43077 Commits

Author SHA1 Message Date
Tomasz Grabiec
9816422a67 core: fix SIGSEGV in future::then()
This fixes SIGSEGV which happens when a promise gets resolved and
dies before the callback is registerred via then(). The latter assumes
that _promise must not be nullptr if the state is not resolved
yet. The dying promise should move the resolved state into the
future's local state.
2014-09-22 23:11:13 +03:00
Tomasz Grabiec
ef03d2957f core: make complete_epoll_event() cancel out the right event.
Led to hangs if the client interleaved readable() with writable()
2014-09-22 23:11:12 +03:00
Avi Kivity
d131b4cce3 packet: optimize appending to an empty packet
The tcp does this quite often, so optimize this trivial append by
moving the packet in.
2014-09-22 17:57:18 +03:00
Avi Kivity
f131492695 tcp: fix harmless struct/class mismatch 2014-09-22 17:19:44 +03:00
Avi Kivity
907792fe26 net: ipv4: remove unused field to please clang 2014-09-22 17:19:15 +03:00
Avi Kivity
195ee5c82f bitset: make functions inline to please compiler 2014-09-22 17:18:46 +03:00
Avi Kivity
46402831ae httpd: remove unused fields to make clang happy 2014-09-22 17:18:06 +03:00
Pekka Enberg
0dfdd3e548 Use braces around subobject initialization
There seems to be some issue with std::array initialization brace elision with Clang:

  http://stackoverflow.com/questions/16985687/brace-elision-in-stdarray-initialization

Sprinkle enough braces to make Clang happy.
2014-09-22 16:37:00 +03:00
Pekka Enberg
4550632738 Make count_leading_zeros() an inline function
Mark the function as inline to avoid Clang complaining about unused function.
2014-09-22 16:36:56 +03:00
Avi Kivity
6dc0e9ba79 packet: fix allocation failure path
Since we allocate impl with a custom allocator, we must provide a
custom deallocator in case the constructor throws.

Found by Pekka and clang.
2014-09-22 15:53:04 +03:00
Avi Kivity
9501601727 tcp: checksum incoming packets
Will be obsoleted by checksum offload, but good for completeness.
2014-09-22 15:46:43 +03:00
Avi Kivity
abbc62588b net: checksum incoming ipv4 packets 2014-09-22 15:46:35 +03:00
Avi Kivity
969892d66e tcp: fix ntoh/hton mixup
No effect on code, but clears a mental wtf.
2014-09-22 15:46:16 +03:00
Avi Kivity
7f7a550f98 net: extend packet by doubling fragment vector size
Avoid quadratic behavior
2014-09-22 14:26:34 +03:00
Avi Kivity
4ca2d67406 tcp_test: terminate on connection closed 2014-09-22 14:22:17 +03:00
Avi Kivity
280bf1a5c8 tcp: wait_for_data() should return immediately if data is available 2014-09-22 14:21:43 +03:00
Avi Kivity
4c10d9c270 packet: fix early free when extending packet
If the fragment vector runs out of space, we extend it, but we forgot
to move the deleter, resulting in an early free.  Flagged by address
sanitizer.
2014-09-22 14:14:37 +03:00
Avi Kivity
dd88f66825 tcp: fix sequence number when we have unacknowledged data
We kept sending _send.unacknowledged, so we sent the sequence number for
the previous packet.

Use _send.next instead.
2014-09-22 12:57:07 +03:00
Avi Kivity
4ce192c3e0 net: drop 'dropping packet' message
No longer useful.
2014-09-22 11:55:37 +03:00
Avi Kivity
313768654a net: remove queuing from l2->l3 rx path
Use a subscription instead.  Queueing should be implemented at the highest
possible level (e.g. tcp), to avoid double-queueing.
2014-09-22 11:28:35 +03:00
Avi Kivity
bc8df09984 virtio-net: remove internal rx queue 2014-09-22 11:28:35 +03:00
Avi Kivity
4738f3f05c net: switch device rx to stream<packet>
Still have that internal rx queue.
2014-09-22 11:27:47 +03:00
Avi Kivity
af1c015526 core: add stream/subscription abstraction
The future/promise pair is for single-shot use only, which makes it
less useful for repetitive processing.

Add a stream/subscription abstraction, where a stream can produce data
which is repetitively consumed by the subscription.  End-or-stream (or
error condition) is provided by a future.

Inspired by Dart's Stream class.
2014-09-22 11:25:54 +03:00
Avi Kivity
3b1d37ff2f future: implement available()
As the whole point of future/promise is to decouple the producer from the
consumer, available() is not generally useful.  However it can still be
useful in special cases when we want to know who got there first.

One of them is deciding when to drop packets -- if the consumer is not
ready, and no queue space is available, we should just drop the packet
instead of waiting for the consumer.
2014-09-22 11:25:54 +03:00
Avi Kivity
1d11ecfbcd future: implement move assignment 2014-09-22 11:25:54 +03:00
Avi Kivity
64ce457053 future: fix move constructor
If we're no longer tracking the promise (either gone, or never existed),
we shouldn't update it.
2014-09-22 11:25:54 +03:00
Asias He
4dc70e95c7 virtio: Add --event-index option
Virtio net options:
  --event-index arg (=on) Enable event_index feature (on / off)

By default, --event-index is enable. To disable, e.g.:

   $ ./httpd --network-stack native --event-index off
2014-09-22 11:22:59 +03:00
Asias He
1472e8f282 virtio: Add event-index support 2014-09-22 11:22:58 +03:00
Gleb Natapov
588fe22a8b README: add libasan to prerequisites 2014-09-21 13:39:48 +03:00
Avi Kivity
b14e2069eb build: store build.ninja outside build directory
This preserves configuration options after a make clean (and
also allows you to call ninja-build directly).
2014-09-19 12:58:16 +03:00
Avi Kivity
eadac1f2a6 build: support using static libstdc++
This is useful for building on one host and running on another.
2014-09-19 12:50:11 +03:00
Pekka Enberg
698d35da2b Dockerize development environment
Add a Dockerfile that can be used to build a development environment for
Seastar. This is useful for people such as myself who don't want to
install packages from Rawhide on my main development machine.

Steps to use it on Fedora:

1. Install Docker: http://docs.docker.com/installation/fedora/

  $ sudo yum install docker-io

  $ sudo systemctl start docker

  $ sudo systemctl enable docker

  [ Note: I had to edit /etc/sysconfig/docker to disable SELinux support
    because I use BTRFS. ]

2. Build a Docker image:

  $ docker build -t seastar-dev .

3. Launch a Docker instance:

  [ Seastar git repository is located in $HOME/seastar on the host. ]

  $ docker run -v $HOME/seastar/:/seastar -i -t seastar-dev /bin/bash

4. Build Seastar:

  $ cd /seastar
  $ make

5. Run an application:

  $ ./build/release/apps/httpd/httpd

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2014-09-19 12:10:10 +03:00
Avi Kivity
a1bbe48570 README: document libubsan requirement 2014-09-19 10:02:59 +03:00
Avi Kivity
18ca5e6047 build: fix typo 2014-09-18 21:13:01 +03:00
Avi Kivity
5be3fa082d build: make configure.py more readable 2014-09-18 21:10:02 +03:00
Avi Kivity
f98c99b210 build: build everything by default
So people don't break the debug build randomly.
2014-09-18 20:57:07 +03:00
Avi Kivity
e56c54c55b build: switch to ninja
This makes it saner to integrate code generators, plus it's cool.
2014-09-18 17:22:58 +03:00
Avi Kivity
e7c470c5c7 readme: fix loop example
The termination condition must not chain the
tail call, or we go into an infinite loop.

Noted by Gleb.
2014-09-18 15:32:08 +03:00
Avi Kivity
bf59db0ef0 tcp: don't use pseudo headers for checksum
Calculate it directly instead.
2014-09-18 12:46:25 +03:00
Avi Kivity
d04ebe833a net: allow direct checksum of fields without a structure
This allows removing usage of "pseudo headers"
2014-09-18 12:45:45 +03:00
Avi Kivity
4826970d25 net: use __int128 for partial value storage in ip checksum
This makes carry handling simpler for the compiler (though it should have
been able to do this without help).
2014-09-18 12:05:31 +03:00
Avi Kivity
f6cb06a3cb net: implement ip_checksum in terms of checksummer class
Easier to maintain partial checksum this way, for later changes.
2014-09-18 11:31:59 +03:00
Avi Kivity
4e76590ed6 net: allow configuring the IP address 2014-09-17 17:52:02 +03:00
Avi Kivity
3168a2fc7c Allow providing options to configure network stacks 2014-09-17 17:44:58 +03:00
Avi Kivity
f81760aba7 spit out temporary_buffer into its own file 2014-09-17 12:42:30 +03:00
Avi Kivity
2f103a8558 packet: reduce allocations for the fragment array
Instead of having an std::vector<> manage the fragment array,
allocate it at the end of the impl struct and manage it manually.

The result isn't pretty but it does remove an allocation.
2014-09-17 11:31:22 +03:00
Avi Kivity
804aec33fd packet: fix appending constructor
We did not actually append the fragment.
2014-09-17 09:49:39 +03:00
Avi Kivity
82922fb6ff README: cosmetics 2014-09-16 19:44:21 +03:00
Raphael S. Carvalho
efa0a124a1 Add building instructions section to README file
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2014-09-16 19:42:05 +03:00
Avi Kivity
32bfefa6b9 README: add section about exception handling 2014-09-16 19:26:53 +03:00