Commit Graph

53948 Commits

Author SHA1 Message Date
Vlad Zolotarov
59403f0774 dpdk: First version that supports both 1.7.x and 1.8.x (current git master) DPDK versions.
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2014-12-22 17:37:05 +02:00
Vlad Zolotarov
11c54bd1d5 dpdk: Change the default behavior when --dpdk-pmd is set
1) Make --dpdk-pmd parameter to be a flag instead of a (key, value).
 2) Default to a default hugetlbfs DPDK settings when --hugepages is not
    given and --dpdk-pmd is set.

This will allow a more friendly user experience in general and when one doesn't
want to provide a --hugepages parameter in particular.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2014-12-22 17:36:58 +02:00
Vlad Zolotarov
ddf239a943 dpdk: Move the scattered DPDK EAL initialization into the dpdk::eal.
- Move the smp::dpdk_eal_init() code into the dpdk::eal::init() where it belongs.
 - Removed the unused "opts" parameter of dpdk::dpdk_device constructor - all its usage
   has been moved to dpdk::eal::init().
 - Cleanup in reactor.cc: #if HAVE_DPDK -> #ifdef HAVE_DPDK; since we give a -DHAVE_DPDK
   option to a compiler.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2014-12-22 17:36:49 +02:00
Vlad Zolotarov
7ec062e222 dpdk: Move dpdk_eal class into a separate file
- Make it's methods static.
 - Rename dpdk::dpdk_eal -> dpdk::eal

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2014-12-22 17:36:42 +02:00
Avi Kivity
094329a95e Move apps/seastar/* to top level 2014-12-22 16:15:37 +02:00
Avi Kivity
5e9c815ee5 Merge branch 'thrift' into db
This patchset adds support for an asynchronous thrift service serving the
Cassandra interface.

The implementation uses the "continuation object style" thrift code generation
option, which can be readily adapted to the promise/future interface.

With this, one can connect with a client and see this:

$ ./cassandra-stress  insert -node localhost
Exception in thread "main" java.lang.RuntimeException: org.apache.thrift.TApplicationException: sorry, not implemented
	at org.apache.cassandra.stress.settings.StressSettings.getRawThriftClient(StressSettings.java:139)
	at org.apache.cassandra.stress.settings.StressSettings.getRawThriftClient(StressSettings.java:109)
	at org.apache.cassandra.stress.settings.SettingsSchema.createKeySpacesThrift(SettingsSchema.java:112)
	at org.apache.cassandra.stress.settings.SettingsSchema.createKeySpaces(SettingsSchema.java:60)
	at org.apache.cassandra.stress.settings.StressSettings.maybeCreateKeyspaces(StressSettings.java:200)
	at org.apache.cassandra.stress.StressAction.run(StressAction.java:57)
	at org.apache.cassandra.stress.Stress.main(Stress.java:109)
Caused by: org.apache.thrift.TApplicationException: sorry, not implemented
	at org.apache.thrift.TApplicationException.read(TApplicationException.java:111)
	at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:71)
	at org.apache.cassandra.thrift.Cassandra$Client.recv_set_cql_version(Cassandra.java:1896)
	at org.apache.cassandra.thrift.Cassandra$Client.set_cql_version(Cassandra.java:1883)
	at org.apache.cassandra.stress.settings.StressSettings.getRawThriftClient(StressSettings.java:128)
	... 6 more
2014-12-22 15:02:42 +02:00
Avi Kivity
619da6da1d thrift: wire up thrift connection handler and thrift server
With this, a Cassandra client can connect (only to receive an
unimplemented exception immediately).
2014-12-22 13:38:42 +02:00
Avi Kivity
47a4084b81 thrift: basic server
As thrift does not support pipelining, the server is very simple.  It
implements the thrift framed transport, where each message is preceded
by a four-byte message size header.
2014-12-22 10:33:45 +02:00
Avi Kivity
fc3188913f thrift: throw exceptions in unimplemented services
Where possible, throw an exception instead of returning an uninitialized
value.

Where not possible (if the method does not throw), return a "dummy" string.
2014-12-22 10:33:45 +02:00
Avi Kivity
52c8866db1 thrift: add skeleton handler
Generated by thrift and massaged to compile.
2014-12-22 10:33:45 +02:00
Avi Kivity
9fc0082229 build: generate, build, and link Cassandra thrift support 2014-12-21 17:32:53 +02:00
Avi Kivity
e17b67ea93 build: thrift support
Support adding a thrift file as a source.  Since thrift generates multiple
output files, whose names cannot be trivially derived from the source file
name, we have to specify it as an object containing the source file name
and any additional information needed to derive the generated file names
(in this case, the generated thrift services).
2014-12-21 17:30:50 +02:00
Avi Kivity
183a40e757 thrift: fix name conflict with VERSION
The generic thrift headers bring in a #define (yuch) named VERSION, while the
Cassandra interface also defines a symbol with the same name.

Rename the symbol to avoid a compile conflict.
2014-12-21 17:29:02 +02:00
Avi Kivity
648ea3b469 thrift: add cassandra.thrift
Taken from cassandra.git bf599fb5b062cbcc652da78b7d699e7a01b949ad.
2014-12-21 15:51:53 +02:00
Gleb Natapov
b958a44304 smp: create seastar threads using DPDK when compiled with DPDK support
DPDK initialization creates its own threads and assumes that application
uses them, otherwise things do not work correctly (rte_lcore_id()
returns incorrect value for instance). This patch uses DPDK threads to
run seastar main loop making DPDK APIs work as expected.
2014-12-18 14:43:37 +02:00
Avi Kivity
10079c758a Merge branch 'poller-race'
Fix corruption when a function called from a poller context (usually
an smp request) tries to install a poller itself.
2014-12-18 10:57:26 +02:00
Avi Kivity
c09694d76c reactor: fix corruption in _pollers
register_poller() (and unregister_poller()) adjusts _pollers, but it may be
called while iterating it, and since std::vector<> mutations invalidate
iterators, corruption occurs.

Fix by deferring manipulation of _pollers into a task, which is executed at
a time where _pollers is not touched.
2014-12-17 16:56:20 +02:00
Avi Kivity
481080feb8 reactor: refactor reactor::poller
Currently, reactor::_pollers holds reactor::poller pointers; since these
are movable types, it's hard to maintain _pollers, as the pointers can keep
changing.

Refactor poller so that _pollers points at an internal type, which does not
move when a reactor::poller moves.  This requires getting rid of
std::function, since it lacks a comparison operator.
2014-12-17 16:20:52 +02:00
Tomasz Grabiec
16f4b7dec7 tests: make test_response_spanning_many_datagrams immune to value order 2014-12-16 16:30:50 +02:00
Avi Kivity
a0daeae865 sstring: optimize release()
By switching to malloc/free, we can use make_free_deleter(), which
does not require extra memory.
2014-12-16 14:55:02 +02:00
Avi Kivity
ebf89ac560 virtio: use make_object_deleter 2014-12-16 14:55:02 +02:00
Avi Kivity
692ee47456 deleter: introduce make_object_deleter
When we have an object acting as resource guard for memory, we can convert
it into a deleter using

  make_deleter([obj = std::move(obj)] {})

introduce a simpler interface

  make_object_deleter(std::move(obj))

for doing the same thing.
2014-12-16 14:55:02 +02:00
Avi Kivity
3e4c53300d Merge branch 'mq' of ssh://github.com/cloudius-systems/seastar-dev
Multiqueue support for #cpu != #q, from Gleb.
2014-12-16 11:11:22 +02:00
Gleb Natapov
c8189157ed net: use RSS hash key calculated by HW if available
Some (all?) RSS capable HW provides us with a hash that was used to
select rx queue the packet was delivered to. If such hash is available
it is better to use it to forward packet instead of calculating hash
ourself and suffering cache missed.
2014-12-16 10:53:41 +02:00
Gleb Natapov
d796487976 net: use our RSS key instead of letting DPDK select one 2014-12-16 10:53:41 +02:00
Gleb Natapov
d8ddaeb104 net: forward reassembled ip packet to correct queue
To figure out a cpu that should handle reassembled TCP packet RSS
redirection table have to be consulted.
2014-12-16 10:53:41 +02:00
Gleb Natapov
64adef7def net: copy RSS redirection table from a device
We will need it in later patch.
2014-12-16 10:53:41 +02:00
Gleb Natapov
fbef83beb0 net: support for num of cpus > num of queues
This patch introduce a logic to divide cpus between available hw queue
pairs. Each cpu with hw qp gets a set of cpus to distribute traffic
to. The algorithm doesn't take any topology considerations into account yet.
2014-12-16 10:53:41 +02:00
Gleb Natapov
7ac3ba901c net: rework packet forwarding logic
Instead of forward() deciding packet destination make it collect input
for RSS hash function depending on packet type. After data is collected
use toeplitz hash function to calculate packet's destination.
2014-12-16 10:53:41 +02:00
Gleb Natapov
dd2f73401f net: add toeplitz hash function for rss 2014-12-16 10:53:41 +02:00
Gleb Natapov
bd9b0b8962 net: remove broadcast logic from forwarding path
No longer used.
2014-12-15 17:38:20 +02:00
Gleb Natapov
055fbb9430 net: broadcast arp reply on arp protocol level
Instead of returning special value from forward() to broadcast arm reply
call arp.learn() on all cpus at arp protocol lever. The ability of
forward() to return special value will be removed by later patches.
2014-12-15 17:36:14 +02:00
Gleb Natapov
c13adb9c12 net: rework how dhcp handles dhcp packet.
Currently dhcp assumes that cpu 0 gets all the packets and redistributes
them by itself. With multiqueue this is not necessary the case, so the
current trick to disable forwarding by installing special dhcp forward()
function will not work. Rework it by installing packet filter on all
cpus before running dhcp and forward all dhcp packets to cpu 0.
2014-12-15 17:31:25 +02:00
Gleb Natapov
ad29ccd3df net: start dhcp after the stack is created on all cpus 2014-12-15 17:30:13 +02:00
Avi Kivity
e83361010b Merge branch 'asias/lowres_clock' of github.com:cloudius-systems/seastar-dev
From Asias:

"Add a low resolution clock source in addition to what std::chrono provides.
With it we can reduce the expensive std::chrono::high_resolution_clock::now()
calls."
2014-12-15 13:45:05 +02:00
Asias He
c9553b7825 tcp: Switch to user lowres_clock 2014-12-15 19:39:33 +08:00
Asias He
0790266be0 ip: Switch to use lowres_clock 2014-12-15 19:39:33 +08:00
Asias He
42c4085f29 timer: Introduce lowres_clock 2014-12-15 19:39:33 +08:00
Asias He
1d48610f1b tests: Improve timertest
Test both high-res and low-res clock timer.
2014-12-15 19:39:33 +08:00
Asias He
f1e46791f5 timer: Drop unused ulong_bits 2014-12-15 19:39:33 +08:00
Asias He
db0124ef05 timer: Add now() for timer_set 2014-12-15 19:39:33 +08:00
Asias He
0242d402b7 timer: Drop Clock template parameter in time_set 2014-12-15 19:39:33 +08:00
Asias He
62fff15e54 timer: Make timer a template 2014-12-15 19:39:33 +08:00
Avi Kivity
a3f08c32de virtio: rename misleading _deleters field
It's just a set of buffers (albeit maintained as unique_ptrs for their
destructors).  Not the 'deleter' type.
2014-12-15 11:42:33 +02:00
Avi Kivity
38b1398750 virtio: remove outdated TODO re single-fragment packet
We already special case single fragment packets on the receive path.
2014-12-15 11:39:00 +02:00
Avi Kivity
c56dcaf17a smp: fix cross-cpu access in poll mode
We look at _poll mode in another cpu's cache accidentally, as pard of
the peer->idle() call.

Fix by looking at our own _poll variable first; they should all be the same.
2014-12-15 11:30:06 +02:00
Avi Kivity
52be2f2bf4 Merge branch 'virtio'
Futures are great for complicated asynchronous operations, but for a
synchronous operation like destroying a packet after transmit, or
converting a buffer to a packet during receive, they're overkill.

This patchset fixes those two cases in virtio, in which futures
are used as an abstraction layer between vring and the transmit/receive
queues, by converting vring into a template, so that the completion function
can be adjusted for the transmit or receive case during compile time instead
of at run time.

10% improvement on httpd with --smp 1, >20% with --smp 3.
2014-12-15 11:29:35 +02:00
Avi Kivity
508322c7da virtio: de-futurize receive
Move completion handling (destroy packet, adjust descriptors count) to
a completion function rather than a future.  Reduces allocations and task
executed.
2014-12-14 18:49:01 +02:00
Avi Kivity
1ee959d3e2 virtio: de-futurize transmit
Move completion handling (destroy packet, adjust descriptors count) to
a completion function rather than a future.  Reduces allocations and task
executed.
2014-12-14 18:49:01 +02:00
Avi Kivity
c7c0aebf07 virtio: abstract vring request completions
Currently vring request completions are handled by fulfilling a promise
contained in the request.  While promises are very flexible, this comes
at a cost (allocating and executing a task), and this flexibility is unneeded
when request handling is very regular (such as in virtio-net rx and tx
completion handling).

Make vring more flexible by allowing the completion function to be specified
as a template parameter.  No changes to the actual users - they now specify
the completion function as fulfilling the same promise as vring previously
did.
2014-12-14 18:49:01 +02:00