From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTP id F04B15A026D for ; Thu, 3 Aug 2023 00:48:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691016499; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JvhCph+j5Cbc37EsJEM/Qdb/DIh0cDZQT0g6TKu/3Rg=; b=TngCbunazPb8XpPJ3044S/yOSlmG0nTLToeCggLHQeuvbbO0F9R3yO5j9WvZrS5Ft829+9 4mez7IZtxvSGaRo/vSf/G/Pil970S2H6p2SN+XXxv7ePctv+PGxgCavcS1ft1HulGPyZZz 0YAd+fhyPwT5NUC9bMiIi8Y7ejRHglE= Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-586-4oURUnEzN9GQMDI0F-qkSA-1; Wed, 02 Aug 2023 18:48:17 -0400 X-MC-Unique: 4oURUnEzN9GQMDI0F-qkSA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1FD183C025D1; Wed, 2 Aug 2023 22:48:17 +0000 (UTC) Received: from elisabeth (unknown [10.39.208.24]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6DEB7F7FA4; Wed, 2 Aug 2023 22:48:16 +0000 (UTC) Date: Thu, 3 Aug 2023 00:48:14 +0200 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH 11/17] netlink: Clearer reasoning about the netlink response buffer size Message-ID: <20230803004814.3dc81c44@elisabeth> In-Reply-To: <20230724060936.952659-12-david@gibson.dropbear.id.au> References: <20230724060936.952659-1-david@gibson.dropbear.id.au> <20230724060936.952659-12-david@gibson.dropbear.id.au> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: AAUMDPKHQ6WNSZKTNAVONIGUBOERG37Z X-Message-ID-Hash: AAUMDPKHQ6WNSZKTNAVONIGUBOERG37Z X-MailFrom: sbrivio@redhat.com 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: On Mon, 24 Jul 2023 16:09:30 +1000 David Gibson wrote: > 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. Oops. > Update NLBUFSIZ to 64kiB with a more detailed rationale. > > Link: https://bugs.passt.top/show_bug.cgi?id=67 > > Signed-off-by: David Gibson > --- > netlink.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > 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" > > -#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.html#buffer-sizing > + */ > +#define NLBUFSIZ 65536 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. -- Stefano