From 64af1d2d84043bad3a3d32efa19287eda7fa026b Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Tue, 25 Jan 2022 13:10:47 +0100 Subject: [PATCH] test/fs_packet: don't block This patch takes precautions against the use of blocking packet-stream operations like 'submit_packet'. With the change of issue #4388, the ready-to-submit signals are no longer implicitly handled. Hence, a call of submit_packet to a saturated submit queue blocks infinitely. Issue #4390 --- repos/os/src/test/fs_packet/component.cc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/repos/os/src/test/fs_packet/component.cc b/repos/os/src/test/fs_packet/component.cc index 3130f8dca6..7dea4fcc37 100644 --- a/repos/os/src/test/fs_packet/component.cc +++ b/repos/os/src/test/fs_packet/component.cc @@ -59,7 +59,8 @@ struct Fs_packet::Main if (!(_packet_count % 10)) log(_packet_count, " packets remain"); - _tx.submit_packet(packet); + if (_tx.ready_to_submit()) + _tx.submit_packet(packet); } } @@ -67,17 +68,23 @@ struct Fs_packet::Main { _fs.sigh(_signal_handler); - /********************** - ** Stuff the buffer ** - **********************/ + /* + * Stuff the packet stream until the submit queue or the bulk buffer is + * saturated. + */ size_t const packet_size = _tx.bulk_buffer_size() / File_system::Session::TX_QUEUE_SIZE; for (size_t i = 0; i < _tx.bulk_buffer_size(); i += packet_size) { + File_system::Packet_descriptor packet( _tx.alloc_packet(packet_size), _file_handle, File_system::Packet_descriptor::READ, packet_size, 0); + + if (!_tx.ready_to_submit()) + break; + _tx.submit_packet(packet); }