Netdev List
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: Jacob Keller <jacob.e.keller@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Tony Nguyen <anthony.l.nguyen@intel.com>,
	Przemek Kitszel <przemyslaw.kitszel@intel.com>,
	Masahiro Yamada <masahiroy@kernel.org>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	Vladimir Oltean <vladimir.oltean@nxp.com>
Subject: Re: [PATCH net-next v2 0/9] lib: packing: introduce and use (un)pack_fields
Date: Tue, 29 Oct 2024 20:28:27 +0200	[thread overview]
Message-ID: <20241029182827.u4az53onywedeot6@skbuf> (raw)
In-Reply-To: <20241025-packing-pack-fields-and-ice-implementation-v2-0-734776c88e40@intel.com>

On Fri, Oct 25, 2024 at 05:04:52PM -0700, Jacob Keller wrote:
> This series improves the packing library with a new API for packing or
> unpacking a large number of fields at once with minimal code footprint. The
> API is then used to replace bespoke packing logic in the ice driver,
> preparing it to handle unpacking in the future. Finally, the ice driver has
> a few other cleanups related to the packing logic.
> 
> The pack_fields and unpack_fields functions have the following improvements
> over the existing pack() and unpack() API:
> 
>  1. Packing or unpacking a large number of fields takes significantly less
>     code. This significantly reduces the .text size for an increase in the
>     .data size which is much smaller.
> 
>  2. The unpacked data can be stored in sizes smaller than u64 variables.
>     This reduces the storage requirement both for runtime data structures,
>     and for the rodata defining the fields. This scales with the number of
>     fields used.
> 
>  3. Most of the error checking is done at compile time, rather than
>     runtime via CHECK_PACKED_FIELD_* macros. This saves wasted computation
>     time, *and* catches errors in the field definitions immediately instead
>     of only after the offending code executes.
> 
> The actual packing and unpacking code still uses the u64 size
> variables. However, these are converted to the appropriate field sizes when
> storing or reading the data from the buffer.
> 
> One complexity is that the CHECK_PACKED_FIELD_* macros need to be defined
> one per size of the packed_fields array. This is because we don't have a
> good way to handle the ordering checks otherwise. The C pre-processor is
> unable to generate and run variable length loops at compile time.
> 
> This is a significant amount of macro code, ~22,000 lines of code. To
> ensure it is correct and to avoid needing to store this directly in the
> kernel history, this file is generated as <generated/packing-checks.h> via
> a small C program, gen_packing_checks. To generate this, we need to update
> the top level Kbuild process to include the compilation of
> gen_packing_checks and execution to generate the packing-checks.h file.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
> Changes in v2:
> - Add my missing sign-off to the first patch
> - Update the descriptions for a few patches
> - Only generate CHECK_PACKED_FIELDS_N when another module selects it
> - Add a new patch introducing wrapper structures for the packed Tx and Rx
>   queue context, suggested by Vladimir.
> - Drop the now unnecessary macros in ice, thanks to the new types
> - Link to v1: https://lore.kernel.org/r/20241011-packing-pack-fields-and-ice-implementation-v1-0-d9b1f7500740@intel.com

For the set:

Reviewed-by: Vladimir Oltean <olteanv@gmail.com>

Thanks for working on this!

  parent reply	other threads:[~2024-10-29 18:28 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-26  0:04 [PATCH net-next v2 0/9] lib: packing: introduce and use (un)pack_fields Jacob Keller
2024-10-26  0:04 ` [PATCH net-next v2 1/9] lib: packing: create __pack() and __unpack() variants without error checking Jacob Keller
2024-10-26  0:04 ` [PATCH net-next v2 2/9] lib: packing: demote truncation error in pack() to a warning in __pack() Jacob Keller
2024-10-26  0:04 ` [PATCH net-next v2 3/9] lib: packing: add pack_fields() and unpack_fields() Jacob Keller
2024-11-03 18:31   ` Jakub Kicinski
2024-11-04 19:06     ` Jacob Keller
2024-10-26  0:04 ` [PATCH net-next v2 4/9] ice: remove int_q_state from ice_tlan_ctx Jacob Keller
2024-10-29 14:36   ` Daniel Machon
2024-10-26  0:04 ` [PATCH net-next v2 5/9] ice: use structures to keep track of queue context size Jacob Keller
2024-10-29 14:42   ` Daniel Machon
2024-10-26  0:04 ` [PATCH net-next v2 6/9] ice: use <linux/packing.h> for Tx and Rx queue context data Jacob Keller
2024-10-29 14:50   ` Daniel Machon
2024-10-29 22:09     ` Jacob Keller
2024-10-29 23:32       ` Jacob Keller
2024-10-30 11:19         ` Dan Carpenter
2024-10-30 20:34           ` Jacob Keller
2024-10-31  7:46             ` Dan Carpenter
2024-11-07 17:32               ` Jacob Keller
2024-10-26  0:04 ` [PATCH net-next v2 7/9] ice: reduce size of queue context fields Jacob Keller
2024-10-26  0:05 ` [PATCH net-next v2 8/9] ice: move prefetch enable to ice_setup_rx_ctx Jacob Keller
2024-10-26  0:05 ` [PATCH net-next v2 9/9] ice: cleanup Rx queue context programming functions Jacob Keller
2024-10-29 18:28 ` Vladimir Oltean [this message]
2024-10-31  9:30 ` [PATCH net-next v2 0/9] lib: packing: introduce and use (un)pack_fields Daniel Machon

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=20241029182827.u4az53onywedeot6@skbuf \
    --to=olteanv@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=anthony.l.nguyen@intel.com \
    --cc=edumazet@google.com \
    --cc=jacob.e.keller@intel.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=vladimir.oltean@nxp.com \
    /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