From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 606015A0272 for ; Thu, 3 Aug 2023 04:27:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1691029621; bh=/FdcV91N/nlSR881TKBFFUeUsOMrtUFYlKTXdz1IwdI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=clMoX/ukIyBwieXSUM/a7jKoGAJC6Ae56pwHU6rYFxKOvONugnbj0C4yGslNzuddj KsihdjLfseSz+xVdsum6sLlitf5UXnic49ZZnZFeJwAdabHEykZ3HOaCW9OJlMEWIj F6F6BsXZWevLWNekDuilcGoeHuNx+ywOYfucE9rk= Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4RGXmP4td9z4wb5; Thu, 3 Aug 2023 12:27:01 +1000 (AEST) Date: Thu, 3 Aug 2023 12:22:45 +1000 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH 11/17] netlink: Clearer reasoning about the netlink response buffer size Message-ID: References: <20230724060936.952659-1-david@gibson.dropbear.id.au> <20230724060936.952659-12-david@gibson.dropbear.id.au> <20230803004814.3dc81c44@elisabeth> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Tkfq2YX6bf/D2UcN" Content-Disposition: inline In-Reply-To: <20230803004814.3dc81c44@elisabeth> Message-ID-Hash: SREDX5I23VZP2W2EEESQOOS5NSLAVYPR X-Message-ID-Hash: SREDX5I23VZP2W2EEESQOOS5NSLAVYPR 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: --Tkfq2YX6bf/D2UcN Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Aug 03, 2023 at 12:48:14AM +0200, Stefano Brivio wrote: > On Mon, 24 Jul 2023 16:09:30 +1000 > David Gibson wrote: >=20 > > Currently we set NLBUFSIZ large enough for 8192 netlink headers (128kiB= in > > total), and reference netlink(7). However netlink(7) says nothing about > > reponse buffer sizes, and the documents which do reference 8192 *bytes*= not > > 8192 headers. >=20 > Oops. >=20 > > Update NLBUFSIZ to 64kiB with a more detailed rationale. > >=20 > > Link: https://bugs.passt.top/show_bug.cgi?id=3D67 > >=20 > > Signed-off-by: David Gibson > > --- > > netlink.c | 9 ++++++++- > > 1 file changed, 8 insertions(+), 1 deletion(-) > >=20 > > diff --git a/netlink.c b/netlink.c > > index cdd65c0..d553ddd 100644 > > --- a/netlink.c > > +++ b/netlink.c > > @@ -35,7 +35,14 @@ > > #include "log.h" > > #include "netlink.h" > > =20 > > -#define NLBUFSIZ (8192 * sizeof(struct nlmsghdr)) /* See netlink(7) */ > > +/* Netlink expects a buffer of at least 8kiB or the system page size, > > + * whichever is larger. 32kiB is recommended for more efficient. > > + * Since the largest page size on any remotely common Linux setup is > > + * 64kiB (ppc64), that should cover it. > > + * > > + * https://www.kernel.org/doc/html/next/userspace-api/netlink/intro.ht= ml#buffer-sizing > > + */ > > +#define NLBUFSIZ 65536 >=20 > I'm fine with this, but we also have PAGE_SIZE and MAX() defined. Or > maybe it's more reasonable to keep this constant. I'm not sure. Well, my thought was that this approach also works for the rare case that the runtime page size doesn't equal the compile time page size (e.g. built on ppc64le with 4kiB pagesize, then run on ppc64le with 64kiB pagesize). --=20 David Gibson | 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 --Tkfq2YX6bf/D2UcN Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmTLD24ACgkQzQJF27ox 2GfFQQ/9HNE2p4EpOQ9KdwWNoAI4EClrvg6IP4yAG4cM6hNSjxoBaL+KfN/Xl/sN VqxJnhKO3BhBl1WqlonhH3ewv/wRCaKbmcyJJxrAeuOCp1YEac2hk4hARXoCeNFH 042i4usN6notgE4gNpnZPxFakmXalGNld3j+y36yIdHGszVJ5Vi4TkLyDKqo6ZLT 2d02Tqha27orXosZEJe43vQrkv92u0pSaB7U+jMLksDSeBhlQ8PItaBkl1Fnd288 kv2ggLKr5hiGDvTguNpx25Zzp5qWlG0zjMR8GaP5T8S33rECcRZw/OQZBg6dFgkj J6c2q01w6iBTmywgjF6XeUxq6ZB/EiHP4exdsw53Ts+agyR6mW98Z3K5SeYEp9Ap /gf0xnw1zhmCyiMwDWgut+NYMwcBwktpECaLx0eILebCyx9z/TB8fVtsxtpFr1B7 Bwy47dT+f7+ej7WBvhHZgvneA7CZJc/MxRYgo+jBHF4ziI2yDDiDXg1NkDCg012t sG0L9D1eKcC9XjezyKfgmFGtHDYvnDAnaOw8Ow4cSVZRU7vsKlPf9+48LLfZ2jsW G7ScgSFaEPugCS3gFTVX9B8M6SmedxwPs6o3jwghDx4X6YKIVmHL9Jf6jISpCDR4 2tiUI0klVxz2zqftPEQinkYj8nwA8T/0bYMKJDjortySelegciM= =l8KR -----END PGP SIGNATURE----- --Tkfq2YX6bf/D2UcN--