File_system packet processing test

Test of File_system I/O scheduling. It appears that a client not
submitting I/O packets slower than the VFS server can process will
starve other clients.

Ref #2900
This commit is contained in:
Emery Hemingway 2018-07-03 13:51:52 +02:00 committed by Christian Helmuth
parent d2923253f3
commit f3abee631a
4 changed files with 183 additions and 0 deletions

View File

@ -0,0 +1,90 @@
#
# Build
#
set build_components {
app/sequence
lib/vfs/jitterentropy
server/vfs
test/fs_packet
}
build $build_components
create_boot_directory
import_from_depot \
genodelabs/src/[base_src] \
genodelabs/src/init \
#
# Generate config
#
append config {
<config>
<parent-provides>
<service name="IRQ"/>
<service name="IO_MEM"/>
<service name="IO_PORT"/>
<service name="CPU"/>
<service name="LOG"/>
<service name="PD"/>
<service name="ROM"/>
</parent-provides>
<default-route>
<any-service> <parent/> <any-child/> </any-service>
</default-route>
<default caps="100"/>
<start name="timer">
<resource name="RAM" quantum="1M"/>
<provides> <service name="Timer"/> </provides>
</start>
<start name="vfs">
<resource name="RAM" quantum="4M"/>
<provides> <service name="File_system"/> </provides>
<config>
<vfs> <jitterentropy name="test"/> </vfs>
<default-policy root="/" writeable="yes"/>
</config>
</start>
<start name="long-test">
<binary name="test-fs_packet"/>
<resource name="RAM" quantum="2M"/>
<config count="1024"/>
</start>
<start name="short-test">
<binary name="sequence"/>
<resource name="RAM" quantum="2M"/>
<config>
<start name="a">
<binary name="test-fs_packet"/>
<resource name="RAM" quantum="2M"/>
<config count="64"/>
</start>
<start name="b">
<binary name="test-fs_packet"/>
<resource name="RAM" quantum="2M"/>
<config count="64"/>
</start>
</config>
</start>
</config>
}
install_config $config
#
# Boot modules
#
set boot_modules {
sequence
test-fs_packet
vfs
vfs.lib.so
vfs_jitterentropy.lib.so
}
build_boot_image $boot_modules
append qemu_args " -nographic"
run_genode_until {child "short-test" exited with exit value 0} 60

View File

@ -0,0 +1,87 @@
/*
* \brief File_system packet processing test
* \author Emery Hemingway
* \date 2018-07-03
*/
/*
* Copyright (C) 2018 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#include <file_system_session/connection.h>
#include <base/attached_rom_dataspace.h>
#include <base/heap.h>
#include <base/allocator_avl.h>
#include <base/component.h>
#include <base/sleep.h>
namespace Fs_packet {
using namespace Genode;
using namespace File_system;
struct Main;
};
struct Fs_packet::Main
{
Genode::Env &env;
Attached_rom_dataspace config_rom { env, "config" };
Heap heap { env.pd(), env.rm() };
Allocator_avl avl_alloc { &heap };
File_system::Connection fs { env, avl_alloc, "", "/", false, 4<<10 };
File_system::Session::Tx::Source &pkt_tx { *fs.tx() };
Dir_handle dir_handle { fs.dir("/", false) };
File_handle file_handle { fs.file(dir_handle, "test", READ_ONLY, false) };
Signal_handler<Main> ack_handler { env.ep(), *this, &Main::handle_ack };
int pkt_count = config_rom.xml().attribute_value("count", 1U << 10);
void handle_ack()
{
while (pkt_tx.ack_avail()) {
auto pkt = pkt_tx.get_acked_packet();
--pkt_count;
if (pkt_count < 0) {
log("--- test complete ---");
env.parent().exit(0);
sleep_forever();
}
if (!(pkt_count % 10))
Genode::log(pkt_count, " packets remain");
pkt_tx.submit_packet(pkt);
}
}
Main(Genode::Env &env) : env(env)
{
fs.sigh_ack_avail(ack_handler);
/**********************
** Stuff the buffer **
**********************/
size_t const pkt_size =
pkt_tx.bulk_buffer_size() / File_system::Session::TX_QUEUE_SIZE;
for (size_t i = 0; i < pkt_tx.bulk_buffer_size(); i += pkt_size) {
File_system::Packet_descriptor pkt(
pkt_tx.alloc_packet(pkt_size), file_handle,
File_system::Packet_descriptor::READ, pkt_size, 0);
pkt_tx.submit_packet(pkt);
}
}
};
void Component::construct(Genode::Env &env)
{
static Fs_packet::Main test(env);
Genode::log("--- submiting ", test.pkt_count, " packets ---");
}

View File

@ -0,0 +1,5 @@
TARGET = test-fs_packet
LIBS = base
SRC_CC = component.cc
CC_CXX_WARN_STRICT =

View File

@ -16,6 +16,7 @@ fb_bench
fetchurl
fpu
fs_log
fs_packet
fs_report
gdb_monitor
init