Commit Graph

93 Commits

Author SHA1 Message Date
Gleb Natapov
73f6d943e1 net: separate device initialization from queues initialization
This patch adds new class distributed_device which is responsible for
initializing HW device and it is shared between all cpus. Old device
class responsibility becomes managing rx/tx queue pair and it is local
per cpu. Each cpu have to call distributed_device::init_local_queue() to
create its own device. The logic to distribute cpus between available
queues (in case there is no enough queues for each cpu) is in the
distributed_device currently and not really implemented yet, so only one
queue or queues == cpus scenarios are supported currently, but this can
be fixed later.

The plan is to rename "distributed_device" to "device" and "device"
to "queue_pair" in later patches.
2014-12-09 18:55:14 +02:00
Tomasz Grabiec
e831884c13 tests: add zero copy UDP test
It listens for requests on port 10000 and sends responses comprised of
three chunks of data in one packet. The chunk sizes are specified via
the --chunk-size argument.

The reqest can be anything, its content is ignored.

You can switch to equivalent copying version by passing --copy
argument.
2014-12-04 13:51:35 +01:00
Tomasz Grabiec
c4335c49f6 core: convert output APIs to work on packets
This way zero-copy supporting code can put data directly to packet
object and pass it through all layers efficiently.
2014-12-04 13:51:26 +01:00
Tomasz Grabiec
ba0ac1c2b8 core: simplify write_all()
The only case when write_all() does not write all the data is when the
fiber fails at some point, in which case the resulting future is
failed too.
2014-12-04 13:37:36 +01:00
Tomasz Grabiec
7fd878b1ed tests: memcached: fix test_mutliple_keys_in_get()
Values may be reported in different order than the order of keys in
the request.
2014-12-04 13:37:35 +01:00
Tomasz Grabiec
411e6c1b02 tests: memcached: add test checking splitting of large responses 2014-12-04 13:37:35 +01:00
Tomasz Grabiec
71556de0e6 tests: add more test cases to output_stream_test 2014-12-04 13:37:35 +01:00
Tomasz Grabiec
11a501d884 tests: fix assertion failure at test program exit
Seastar's allocator has an assertion which checks that the memory
block is freed on the same CPU on which it was allocated. This is
reasonable because all allocations in seastar need to be CPU-local.

The problem is that boost libraries (program_options,
unit_testing_framework) make heavy use of lazily-allocated static
variables, for instance:

    const variable_value&
    variables_map::get(const std::string& name) const
    {
        static variable_value empty;
        // ...
    }

Such variable will be allocated in in the current threads but freed in
the main thread when exit handlers are executed.

This results in:

output_stream_test: core/memory.cc:415: void memory::cpu_pages::free(void*):
Assertion `((reinterpret_cast<uintptr_t>(ptr) >> cpu_id_shift) & 0xff) == cpu_id' failed.

This change works around the problem by forcing initialization in the
main thread.

See issue #10.
2014-12-04 13:37:02 +01:00
Asias He
6c097fe2e9 tests: Make udp_server SMP aware 2014-12-03 11:03:00 +02:00
Avi Kivity
6b5973af70 app-template: don't alias boost::program_options as bpo in a header file
We only have one global namespace, let's work together to keep it free
of pollution.
2014-12-01 17:56:34 +02:00
Avi Kivity
1820c8eaf6 blkdiscard_test: add missing include
For keep_doing().
2014-12-01 17:47:57 +02:00
Gleb Natapov
bf46f9c948 net: Change how networking devices are created
Currently each cpu creates network device as part of native networking
stack creation and all cpus create native networking stack independently,
which makes it impossible to use data initialized by one cpu in another
cpu's networking device initialization. For multiqueue devices often some
parts of an initialization have to be handled by one cpu and all other
cpus should wait for the first one before creating their network devices.
Even without multiqueue proxy devices should be created after master
device is created so that proxy device may get a pointer to the master
at creation time (existing code uses global per cpu device pointer and
assume that master device is created on cpu 0 to compensate for the lack
of ordering).

This patch makes it possible to delay native networking stack creation
until network device is created. It allows one cpu to be responsible
for creation of network devices on multiple cpus. Single queue device
initialize master device on one cpu and call other cpus with a pointer
to master device and its cpu id which are used in proxy device creation.
This removes the need for per cpu device pointer and "master on cpu 0"
assumption from the code since now master device and slave devices know
about each other and can communicate directly.
2014-11-30 18:10:08 +02:00
Vlad Zolotarov
a0769ae189 echotest: Added support for DPDK PMD backend
- Fixed the IP addresses swapping.
 - Added cmdline parameters to choose between virtio and DPDK tests.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2014-11-30 12:14:58 +02:00
Vlad Zolotarov
93f7cc434d tests: rename virtiotest -> echotest
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2014-11-30 12:14:58 +02:00
Vlad Zolotarov
1238807d98 net: implement a few proper constructors for ethernet_address
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2014-11-23 23:26:54 +02:00
Avi Kivity
37bf4898e3 allocator_test: limit runtime to 5 seconds 2014-11-20 13:04:03 +02:00
Avi Kivity
cabdf1dcbc allocator_test: reindent 2014-11-20 12:37:18 +02:00
Tomasz Grabiec
9c9f3d21bf tests: make option defaults be effective in tests 2014-11-20 10:40:03 +02:00
Asias He
6e9521b86b tests: Increase bytes transfered in tx test
From 10MiB to 100MiB, stress more.
2014-11-18 10:16:38 +02:00
Tomasz Grabiec
05d89f1ab9 tests: add output_stream_test 2014-11-15 12:11:11 -08:00
Tomasz Grabiec
825b3608a4 tests: configure reactor for tests
Commit 405f3ea8c3 changed reactor so
that _network_stack is no longer default initialized to POSIX but to
nullptr. This caused tests to segfault, becayse they are not using
application template which takes care of configuration.

The fix is to call configure() so that netwrok stack will be set to
POSIX.
2014-11-15 11:58:07 -08:00
Avi Kivity
c52c56ce7b tests: add memory allocation test 2014-11-15 11:56:16 -08:00
Tomasz Grabiec
c262060d92 memcache: avoid vprintf()
Improves memaslap UDP posix throughput on my laptop by 40% (from 73k to 105k).

When item is created we cache flags and size part of the response so
that there's no need to call expensive string formatting in get(). The
down side is that this pollutes "item" object with protocol-specific
field, but since ASCII is the only protocol which is supported now and
it's not like we can't fix it later, I think it's fine.
2014-11-13 22:22:07 +02:00
Tomasz Grabiec
6913079927 tests: memcache: do not constrain tests to 1 CPU 2014-11-11 13:52:23 +02:00
Tomasz Grabiec
b0dd9e736c memcached: SMP support
There is a separate DB per core, each serving a subset of the key
space. From the outside in appears to behave as one DB.

item_key type was changed to include the hash so that we calculate the
hash only once. The same hash is used for sharding and hashing. No
need for store_hash<> option on unordered_set<> any more.

Some seastar-specific and hashtable-specific stats were moved from the
general "stats" command into "stats hash", which shows per-core
statistics.
2014-11-11 13:52:23 +02:00
Asias He
ead391491d net: Add rx test in tcp_server 2014-11-10 10:01:05 +02:00
Asias He
784bf7a7e2 tests: Rename class http_server to tcp_server 2014-11-06 17:06:10 +02:00
Tomasz Grabiec
26361873bc test_ascii_parser: fix potential use-after-free error 2014-11-06 15:48:31 +02:00
Asias He
2e9366ba24 tests: Add send test to tcp_server
$ printf "txtx" | nc 192.168.66.123 10000

Server will send a large mount of data to client for TCP tx testing.
Currently, it sends 10MB of char 'X'.
2014-11-06 14:49:53 +02:00
Gleb Natapov
d698811bdd fix smp broadcast packet handling
Some packets, like arp replies, are broadcast to all cpus for handling,
but only packet structure is copied for each cpu, the actual packet data
is the same for all of them. Currently networking stack mangles a
packet data during its travel up the stack while doing ntoh()
translations which cannot obviously work for broadcaster packets. This
patches fixes the code to not modify packet data while doing ntoh(), but
do it in a stack allocated copy of a data instead.
2014-11-06 10:30:30 +02:00
Asias He
52f2a2b35b tests: Add tcp_sever
Currently, it is a ping/pong sever. When the client sends a ping, the
server responds a pong. We can add more tests to extend.
This is useful for testing TCP_RR.
2014-11-03 09:53:32 +02:00
Avi Kivity
3d414111eb future: make .rescue() require an rvalue reference for its future
This makes it harder to misuse.
2014-10-30 14:07:42 +02:00
Tomasz Grabiec
ca85016556 tests: memcache: fix regex
Some versions of python do not tolerate this regex:

   r'(\w*)?'

ERROR: test_incr (__main__.TestCommands)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests/memcached/test_memcached.py", line 464, in test_incr
    self.assertRegexpMatches(call('incr key 1\r\n').decode(), r'0(\w*)?\r\n')
  File "/usr/lib64/python3.3/unittest/case.py", line 1178, in deprecated_func
    return original_func(*args, **kwargs)
  File "/usr/lib64/python3.3/unittest/case.py", line 1153, in assertRegex
    expected_regex = re.compile(expected_regex)
  File "/usr/lib64/python3.3/re.py", line 214, in compile
    return _compile(pattern, flags)
  File "/usr/lib64/python3.3/re.py", line 281, in _compile
    p = sre_compile.compile(pattern, flags)
  File "/usr/lib64/python3.3/sre_compile.py", line 498, in compile
    code = _code(p, flags)
  File "/usr/lib64/python3.3/sre_compile.py", line 483, in _code
    _compile(code, p.data, flags)
  File "/usr/lib64/python3.3/sre_compile.py", line 75, in _compile
    elif _simple(av) and op is not REPEAT:
  File "/usr/lib64/python3.3/sre_compile.py", line 362, in _simple
    raise error("nothing to repeat")
sre_constants.error: nothing to repeat
2014-10-30 10:17:52 +02:00
Avi Kivity
b1ec66900f memcached: reindent ascii parser test 2014-10-28 11:04:45 +02:00
Avi Kivity
90cb9376ab memcached: enhance test to check for differently scattered packets
Use funky indentation to reduce diff size; can be adjutsed later.
2014-10-28 11:01:37 +02:00
Avi Kivity
6dcf24f98d Move contents of async-action.hh into future-util.hh 2014-10-27 19:28:10 +02:00
Tomasz Grabiec
c6545bf2df tests: add another test case for future::forward_to() 2014-10-27 15:58:59 +02:00
Avi Kivity
332cd6424b ip: use indirection to access tcp
This reduces the number of files that include tcp.hh.
2014-10-24 22:18:46 +03:00
Tomasz Grabiec
0cf6564097 tests: add tests for future::forward_to() 2014-10-24 19:40:48 +03:00
Tomasz Grabiec
3eaac67a09 tests: memcache: make test_connection_statistics a bit more robust
It some times fails because the server records connection closure with
a delay.
2014-10-21 16:43:09 +02:00
Tomasz Grabiec
f921a9787b tests: make test_memcache.py return non-zero exit code on failure 2014-10-21 16:43:09 +02:00
Pekka Enberg
6723c0cbdd apps/memcache => apps/memcached
The protocol is called the "memcache protocol" but the server should
follow the same naming convention as httpd does.

It should not be a big deal but it annoys the hell out of simple people
like myself who have their brain hard-wired to type the final "d"...

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2014-10-21 17:30:14 +03:00
Tomasz Grabiec
7903acdeb8 tests: memcache: add incr/decr tests 2014-10-18 12:59:59 +02:00
Tomasz Grabiec
e3fa358075 test: memcache: flush all keys after each test 2014-10-18 12:59:59 +02:00
Tomasz Grabiec
6ed212e7c6 tests: memcache: add tests for 'stats' command 2014-10-18 12:59:59 +02:00
Tomasz Grabiec
51f52ed2b5 tests: memcache: make tests more robust
By automatically detecting when memcache is up and running.
2014-10-18 12:59:59 +02:00
Tomasz Grabiec
e07e6ccbef tests: memcache: add tests for 'cas' and 'gets' 2014-10-18 12:59:59 +02:00
Tomasz Grabiec
f134fe1a94 tests: memcache: add tests for 'add' and 'replace' 2014-10-18 12:59:59 +02:00
Tomasz Grabiec
d5a0e9654e tests: memcache: add tests for 'noreply' variant of 'set' and 'delete'
This also extracts some code to a common base class.
2014-10-18 12:59:59 +02:00
Tomasz Grabiec
a1848ca6a7 tests: memcache: add test for 'version' command 2014-10-18 12:59:58 +02:00