From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202608 header.b=LG0WbQZO; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 8834A5A0271 for ; Mon, 03 Aug 2026 08:41:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202608; t=1785739263; bh=KcGpjUT9YsbDukGtBfvBFDSdxN70P3XBmCHH3gTXPuU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LG0WbQZOkLdVeS1kU6EKMn8EzbXvzuzUI8cABhbAzL9r9Tt/9l3LGlbW6B+OXr7hJ vhbHr5fpG3nN0AJkMHOOsbT6AZiEd1XtYGAiwoRlWr7M0xCq5nETARnL4BurPDpeOG reGUUXtGM6oMyKxz0zO6Qwe4b9BLUUT9U9uo9m8NiJV0ZicrUVULOh6hb2x+hofPK7 RnEmBXVEckVtGTwvdrz1gGvQDu57as26cSfW8TXfhhCdwsmh0GJvHBoErl2eBl63+Q spv7OBK0QTbhU2OSLs119vKhwkozI3Fne0uoO/OvRmJ106La2orQRWYZg1HvGoa45B ZINP6emd3PK4g== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4hD6Wg2215z4wCB; Mon, 03 Aug 2026 16:41:03 +1000 (AEST) Date: Mon, 3 Aug 2026 16:35:04 +1000 From: David Gibson To: Laurent Vivier Subject: Re: [PATCH v2 05/10] flow: Make flow timer per-caller for thread safety Message-ID: References: <20260731162329.3552800-1-lvivier@redhat.com> <20260731162329.3552800-6-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="fg15VZEuVI/hX60y" Content-Disposition: inline In-Reply-To: Message-ID-Hash: USOV7IP6U3ZAVGUMT2KZL2PI5PCGRLEN X-Message-ID-Hash: USOV7IP6U3ZAVGUMT2KZL2PI5PCGRLEN X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --fg15VZEuVI/hX60y Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Aug 03, 2026 at 04:11:24PM +1000, David Gibson wrote: > On Fri, Jul 31, 2026 at 06:23:24PM +0200, Laurent Vivier wrote: > > Move the static flow_timer_run variable out of flow.c and pass it as a > > parameter to flow_defer_handler(). This allows each caller to maintain > > its own timer state: each vhost-user queue pair worker uses the per-qpa= ir > > context. > >=20 > > Signed-off-by: Laurent Vivier >=20 > One small misgiving about this, although I doubt it can cause a real > problem. Becayse this timer processing now doesn't happen all at > once, at each queue is on a separate timer cycle, it's theoretically > possible for a flow to change qpair every FLOW_TIMER_INTERVAL and > thereby indefinitely avoid having the timer running on it. >=20 > It's pretty tricky to do (depending on how close in real time each > queue's timers end up running), and I don't *think* that can do > anything terribly bad (maybe delay cleanup). But since the guest > could in principle control the qpair placements to specifically > trigger this, it just makes me think it warrants a good close look to > make sure that something bad can't be triggered that way. Looking at the next patch, I realised there's a much easier to hit concern here. Kind of the opposite of the one above, if there's a migration at the wrong moment, we might run the timer twice on a flow in a much smaller interval than usual. AFAICT, the worst that can do - at least with our current flow_defer() and flow_timer() functions is a little bit of unnecessary work, so I think it's ok. That's because none of them unconditionally do anything damaging - they always check an independent timestamp. However, it does add another wrinkle to what is and isn't safe in the defer and timer functions: they cannot rely on being called at most every INTERVAL seconds. We should probably document that... somewhere. --=20 David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson --fg15VZEuVI/hX60y Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmpwNowACgkQzQJF27ox 2GcPWA//YggbDhoGtl8AxdHemH3V4xFRV+V6tXHH/ZVkUjcW+NRm4NtKL8F7w572 nrBWA86L8YNcs4Hyb66zxTub4MY/Zhsww1Bf4QGcJM6Osk/WVlkurjc4QNz4DlTW NqTXQne59QujmPklCzOq96Tvoibv3Lz1N0FBC1BH+vHBQyrEktbPYhKa6rqYAi20 1+W0+MtvDXqzSZ7hrHkI9zhBtxjLlNfrZXMNU8crANnDQA2SPqNAeZ/KfE6yrHfJ sXUGToBp81ft77szxmjlIzoGDJkXJtPljcdDsiAslqTRH4sdrSy3+TyQzofQ1CF5 PMMoEqCEVQF9Z6cda0aZOJGiQGrQgkk/ids+KzU0pYVsPfDk5z0uo45km2tXDI5R HQfyFe0R98eDbT9z64EJdgUN78nxyVSDzFjoDe6j7gLGV991ircNwQhUa9HYyE4U xNVLnJJnQjVSrokev3Qh/1ime2XGMSmXO3qa/G8f6TjzPBX4XL8byVWZvCfSTaKy WAZJ7bPNdsqYQlCaO2a4Q96SITDIq5C5FUnoF14Ep428ZJmUlq4w0pGmTa8gVuCI Y6I1cyfMNbs373PbWa29Yvpf5mVVc5FYcyDxH5Jwc6Ww+BmyfkUQQR3xa/dNlsY8 LS/u1rkGhHaELrncpf5C2xlTJn70aHIeFEP4EJZMuT0qJxirw2o= =87yi -----END PGP SIGNATURE----- --fg15VZEuVI/hX60y--