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=202408 header.b=hXxwXSFX; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id B5D115A004C for ; Wed, 04 Sep 2024 04:25:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202408; t=1725416717; bh=oM6PbKzyKU0AKoEonlvn/H6hWndRGUWdHWKMUT/thnM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hXxwXSFXF25kZqmVfF5LjA8L6tBaWJSBw8tKFwY5yhQznTzr5Rnl5M8ThgJ42/3kk LDbbxSzR6vwDJ1nAkbCBpVIEpCTQ35bwQ5oHuRbb1GLtEEypK2Q5KVG2zNhq02IndD PiQi1PmFA3pQlk8WqzAzCJF3iD8d8nBdJ/RMwjNR7aL/yFyKfcv6vAwMBcFR18J+wD 5QwzoqwZYH7hu9YO744n2xtSqi/HAGheaSs+gR+IDSyhd79el6XGOOUCe0YLqLpo13 BuVcyea3aVWRNw+84+ZLkS0rZenAFmdTIXo0EkNBN81EVjmNKKBrs8Iok+LK8hhDxs GwSdCnxLR/NlQ== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Wz5tj1xkyz4wxx; Wed, 4 Sep 2024 12:25:17 +1000 (AEST) Date: Wed, 4 Sep 2024 11:30:30 +1000 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH 2/6] tap: Improve handling of EINTR in tap_passt_input() Message-ID: References: <20240903120235.1688429-1-david@gibson.dropbear.id.au> <20240903120235.1688429-3-david@gibson.dropbear.id.au> <20240903212539.1cb1adb3@elisabeth> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="58mca64dVzMJh+jm" Content-Disposition: inline In-Reply-To: <20240903212539.1cb1adb3@elisabeth> Message-ID-Hash: UWQWZAKX4UKAYNNIDNJNBHBJYTMHK5CE X-Message-ID-Hash: UWQWZAKX4UKAYNNIDNJNBHBJYTMHK5CE 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: --58mca64dVzMJh+jm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 03, 2024 at 09:25:39PM +0200, Stefano Brivio wrote: > On Tue, 3 Sep 2024 22:02:31 +1000 > David Gibson wrote: >=20 > > When tap_passt_input() gets an error from recv() it (correctly) does not > > print any error message for EINTR, EAGAIN or EWOULDBLOCK. However in a= ll > > three cases it returns from the function. That makes sense for EAGAIN = and > > EWOULDBLOCK, since we then want to wait for the next EPOLLIN event befo= re > > trying again. For EINTR, however, it makes more sense to retry immedia= tely > > - as it stands we're likely to get a renewer EPOLLIN event immediately = in > > that case, since we're using level triggered signalling. > >=20 > > So, handle EINTR separately by immediately retrying until we succeed or > > get a different type of error. >=20 > I don't see an actual improvement: we don't know why we would get EINTR > (because of signals) so repeating the recv() right away isn't > necessarily a better choice. My understanding is that EINTR means the system call was aborted because a signal handler happened during it. It usually doesn't matter why we got the signal - we still need to redo the system call and we might as well do so immediately. > I'd say whatever way we have of carrying on on EINTR is fine. If this > patch helps with brevity for the next ones, it makes sense, but > otherwise I don't see a real advantage. Right. Specifically in order to use EPOLLET, I need to _not_ treat EINTR the same way as EAGAIN and EWOULDBLOCK. > Well, it's more consistent with the way we handle EINTR on other calls, > but that's about it. That too. --=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 --58mca64dVzMJh+jm Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmbXuDYACgkQzQJF27ox 2GdAhxAAgz/hGw/p9+8W/LlXF9Nb6quVSHi82Q8XBlYon+9yj6C8DxkAwdjUeVkZ a5jmPEmn5yvNdky+XmRegduA/y4nucrfhh9A1bxPQROpwvYcGuO8xO+lKGMCTAZF 2QLfjDAsRnEUE0H3CGKTKxXR10jJ9CdH+Iqg1vucDpDWj81F6USIDQXL0H+i1t+H msWrHbYOq3eVKA93m1WWtlDMejqtSQo3KE6xsOmwSy+CJdWoANP9UxVLaosRVgVc 6nUzrhAfUR3Vm7Zq0IDgKNlSF0rTvJ9cedJr/7SPx57E4b+6L0VQ0pAW0+g+SW9u Lno4LTg7cq0mwQPE3DoFkI0UINqJ77eL20syCEoU1ih9W42oqELZzpHQiFJCUiH+ b65kwQrbBWbW6jkbjYMbWuGBbacGCqzlDEFIY3EsDG9KVVQPZ9v5UdLcFx5Mh6y6 5SqaNVNKEMBG2GJLRK6IZbeQCfSFiZayrqB7TXiV2LCr4O2rtn3sLvuUvMQSm4eh lPZ410QTnjHP6K9uuHrLfE05vm8ilLe5mIiwLe6wnvlezxAEkKrN3DHJzt0C32Yk elhmBmqaFExTNchccF1h5iUcsrPWibugh9VG8LUa/x+3dN6JTK8hPsjKMJmpN9tX R8jMhhmffpRORCtrq0P8JISIwDHgchlbqsxEH7VuaE2lWu7JDHc= =rSRy -----END PGP SIGNATURE----- --58mca64dVzMJh+jm--