From: Jacob Keller <jacob.e.keller@intel.com>
To: Daniel Machon <daniel.machon@microchip.com>
Cc: Vladimir Oltean <olteanv@gmail.com>,
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>
Subject: Re: [PATCH net-next v2 6/9] ice: use <linux/packing.h> for Tx and Rx queue context data
Date: Tue, 29 Oct 2024 15:09:18 -0700 [thread overview]
Message-ID: <8e1a742c-380c-4faf-a6c2-3fa67689c57e@intel.com> (raw)
In-Reply-To: <20241029145011.4obrgprcaksworlq@DEN-DL-M70577>
On 10/29/2024 7:50 AM, Daniel Machon wrote:
> Hi Jacob,
>> +/**
>> + * ice_pack_rxq_ctx - Pack Rx queue context into a HW buffer
>> + * @ctx: the Rx queue context to pack
>> + * @buf: the HW buffer to pack into
>> + *
>> + * Pack the Rx queue context from the CPU-friendly unpacked buffer into its
>> + * bit-packed HW layout.
>> + */
>> +static void ice_pack_rxq_ctx(const struct ice_rlan_ctx *ctx,
>> + ice_rxq_ctx_buf_t *buf)
>> +{
>> + CHECK_PACKED_FIELDS_20(ice_rlan_ctx_fields, ICE_RXQ_CTX_SZ);
>> + BUILD_BUG_ON(sizeof(*buf) != ICE_RXQ_CTX_SZ);
>> +
>> + pack_fields(buf, sizeof(*buf), ctx, ice_rlan_ctx_fields,
>> + QUIRK_LITTLE_ENDIAN | QUIRK_LSW32_IS_FIRST);
>> +}
>> +
>
> FWIW, I noticed that smatch bails out checking all the CHECK_PACKED_FIELDS_*
> variants >= 20, with the warning:
>
> ice_common.c:1486 ice_pack_txq_ctx() parse error: OOM: 3000148Kb sm_state_count = 413556
> ice_common.c:1486 ice_pack_txq_ctx() warn: Function too hairy. No more merges.
> ice_common.c:1486 ice_pack_txq_ctx() parse error: Function too hairy. Giving up. 43 second
>
We might need to wrap these checks to become no-ops when running under
such a checker. It looks like the parser doesn't like the size of the
macros?
> Maybe this can just be ignored .. not sure :-)
>
I would prefer if we found a way to at least silence it, rather than
straight up ignore it.
I am not that familiar with smatch. Let me see if there's an obvious way
we can handle this.
>> +/**
>> + * ice_pack_txq_ctx - Pack Tx queue context into a HW buffer
>> + * @ctx: the Tx queue context to pack
>> + * @buf: the HW buffer to pack into
>> + *
>> + * Pack the Tx queue context from the CPU-friendly unpacked buffer into its
>> + * bit-packed HW layout.
>> + */
>> +void ice_pack_txq_ctx(const struct ice_tlan_ctx *ctx, ice_txq_ctx_buf_t *buf)
>> +{
>> + CHECK_PACKED_FIELDS_27(ice_tlan_ctx_fields, ICE_TXQ_CTX_SZ);
>> + BUILD_BUG_ON(sizeof(*buf) != ICE_TXQ_CTX_SZ);
>> +
>> + pack_fields(buf, sizeof(*buf), ctx, ice_tlan_ctx_fields,
>> + QUIRK_LITTLE_ENDIAN | QUIRK_LSW32_IS_FIRST);
>> +}
>> +
>
> Same here with the 27 variant.
>
Yea, same problem of course. The generated checks are too large to be
parsed by smatch.
<snip removed code>
>
> Some nice cleanup!
>
Yea. I got motivated with this because I was looking at introducing the
inverse 'unpacking' variants for supporting VF live migration, and
realized how ugly the existing code was and how much worse adding yet
more code to unpack would be.
>
> /Daniel
Thanks for the careful review!
next prev parent reply other threads:[~2024-10-29 22:09 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 [this message]
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 ` [PATCH net-next v2 0/9] lib: packing: introduce and use (un)pack_fields Vladimir Oltean
2024-10-31 9:30 ` 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=8e1a742c-380c-4faf-a6c2-3fa67689c57e@intel.com \
--to=jacob.e.keller@intel.com \
--cc=akpm@linux-foundation.org \
--cc=anthony.l.nguyen@intel.com \
--cc=daniel.machon@microchip.com \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.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
all inboxes | Powered by JetHome®