diff --git a/repos/os/run/fs_packet.run b/repos/os/run/fs_packet.run index 96b9f3a496..60d907d13d 100644 --- a/repos/os/run/fs_packet.run +++ b/repos/os/run/fs_packet.run @@ -1,3 +1,14 @@ +# +# \brief Test of packet handling and signal scheduling +# \author Emery Hemingway +# \date 2018-07-03 +# + +if {[get_cmd_switch --autopilot] && [have_include "power_on/qemu"]} { + puts "Running fs_packet test in autopilot on Qemu is not recommended.\n" + exit +} + # # Build # @@ -53,7 +64,7 @@ append config { </start> <start name="short-test"> <binary name="sequence"/> - <resource name="RAM" quantum="2M"/> + <resource name="RAM" quantum="4M"/> <config> <start name="a"> <binary name="test-fs_packet"/> diff --git a/repos/os/src/server/vfs/main.cc b/repos/os/src/server/vfs/main.cc index 5e0ba32678..a979e15dec 100644 --- a/repos/os/src/server/vfs/main.cc +++ b/repos/os/src/server/vfs/main.cc @@ -301,6 +301,8 @@ class Vfs_server::Session_component : public File_system::Session_rpc_object, */ void _process_packets() { + using namespace Genode; + /* * XXX Process client backlog before looking at new requests. This * limits the number of simultaneously addressed handles (which @@ -311,7 +313,19 @@ class Vfs_server::Session_component : public File_system::Session_rpc_object, /* backlog not cleared - block for next condition change */ return; + /** + * Process packets in batches, otherwise a client that + * submits packets as fast as they are processed will + * starve the signal handler. + */ + int quantum = TX_QUEUE_SIZE; + while (tx_sink()->packet_avail()) { + if (--quantum == 0) { + /* come back to this later */ + Signal_transmitter(_process_packet_handler).submit(); + break; + } /* * Make sure that the '_process_packet' function does not