From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ v1 06/27] iso-tester: Fix busy waiting in PAST tests
Date: Thu, 22 Oct 2026 11:46:39 -0400 [thread overview]
Message-ID: <20261022154701.3959500-7-luiz.dentz@gmail.com> (raw)
In-Reply-To: <20261022154701.3959500-1-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
iso_pollout() kept its watch while the connection to the PAST receiver
was missing, but the socket is writable all along, so the main loop was
woken up until the connection was established. Under User Mode Linux
time travel, where computing takes no simulated time, the PAST Info
tests took about 400 seconds each.
Drop the watch instead and send from iso_new_conn() once the connection
is there.
Assisted-by: Claude:claude-opus-5-5
---
tools/iso-tester.c | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/tools/iso-tester.c b/tools/iso-tester.c
index d610b3c32c51..7149232d17f4 100644
--- a/tools/iso-tester.c
+++ b/tools/iso-tester.c
@@ -471,6 +471,7 @@ struct test_data {
uint16_t handle;
uint16_t acl_handle;
struct queue *io_queue;
+ GIOChannel *past_io;
unsigned int io_id[4];
uint8_t client_num;
int step;
@@ -712,6 +713,11 @@ static void test_post_teardown(const void *test_data)
if (data->io_queue)
queue_remove_all(data->io_queue, NULL, NULL, io_free);
+ if (data->past_io) {
+ g_io_channel_unref(data->past_io);
+ data->past_io = NULL;
+ }
+
/* Remove the watches with the test, as the sockets they keep open
* hang up once the controller is removed, which would wake up the
* main loop over and over for the following tests.
@@ -1716,6 +1722,8 @@ static void bthost_iso_disconnected(void *user_data)
data->handle = 0x0000;
}
+static void iso_send(struct test_data *data, GIOChannel *io);
+
static void iso_new_conn(uint16_t handle, void *user_data)
{
struct test_data *data = user_data;
@@ -1727,6 +1735,12 @@ static void iso_new_conn(uint16_t handle, void *user_data)
data->handle = handle;
+ if (data->past_io) {
+ iso_send(data, data->past_io);
+ g_io_channel_unref(data->past_io);
+ data->past_io = NULL;
+ }
+
host = hciemu_client_get_host(data->hciemu);
bthost_add_iso_hook(host, data->handle, bthost_recv_data, data,
bthost_iso_disconnected);
@@ -2703,11 +2717,16 @@ static gboolean iso_pollout(GIOChannel *io, GIOCondition cond,
const struct iso_client_data *isodata = data->test_data;
unsigned int count;
- if (isodata->past && !data->handle)
- return TRUE;
-
data->io_id[0] = 0;
+ /* Send once the connection to the PAST receiver is there, see
+ * iso_new_conn(), rather than waking up for good until then.
+ */
+ if (isodata->past && !data->handle) {
+ data->past_io = g_io_channel_ref(io);
+ return FALSE;
+ }
+
tester_print("POLLOUT event received");
for (count = 0; count < isodata->repeat_send_pre_ts; ++count)
--
2.56.0
next prev parent reply other threads:[~2026-10-22 15:47 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-22 15:46 [PATCH BlueZ v1 00/27] Run the testers under User Mode Linux with time travel Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 01/27] tools/test-runner: Do not report filesystems already mounted Luiz Augusto von Dentz
2026-10-22 20:02 ` Run the testers under User Mode Linux with time travel bluez.test.bot
2026-10-22 15:46 ` [PATCH BlueZ v1 02/27] shared/tester: Time out teardown Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 03/27] mgmt-tester: Wait for LL Privacy setup to complete Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 04/27] iso-tester: Fix leaking socket watches Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 05/27] l2cap-tester: Fix race in LE Client - Close socket 2 Luiz Augusto von Dentz
2026-10-22 15:46 ` Luiz Augusto von Dentz [this message]
2026-10-22 15:46 ` [PATCH BlueZ v1 07/27] doc: Enable IPv6 in tester.config Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 08/27] 6lowpan-tester: Find the interface of the controller Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 09/27] emulator: Remove -T option from btvirt Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 10/27] doc: Add btvirt documentation Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 11/27] emulator: Add vhost-user backend Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 12/27] emulator: Add vhost-user virtio server to btvirt Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 13/27] emulator: Add time travel calendar " Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 14/27] emulator: Add virtio console and time travel client " Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 15/27] tools/test-runner: Add User Mode Linux support Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 16/27] doc: Add virtio documentation Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 17/27] shared/mainloop: Add idle callbacks Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 18/27] shared/timeout: Run timeouts of 0 once idle Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 19/27] shared/tester: Remove GLib dependency Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 20/27] emulator/hciemu: " Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 21/27] tools: Build testers that do not need GLib with the mainloop Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 22/27] shared/mainloop: Add deferred callbacks Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 23/27] tools: Add socket watches for testers without GLib Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 24/27] tools: Run sco-tester, rfcomm-tester and 6lowpan-tester on the mainloop Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 25/27] tools: Run l2cap-tester and iso-tester " Luiz Augusto von Dentz
2026-10-22 15:46 ` [PATCH BlueZ v1 26/27] doc/virtio: Update measurements of the testers Luiz Augusto von Dentz
2026-10-22 15:47 ` [PATCH BlueZ v1 27/27] doc: Split tester.config for QEMU and User Mode Linux Luiz Augusto von Dentz
2026-10-29 18:40 ` [PATCH BlueZ v1 00/27] Run the testers under User Mode Linux with time travel patchwork-bot+bluetooth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261022154701.3959500-7-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox