From: Simon Horman <horms@kernel.org>
To: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Cc: intel-wired-lan@lists.osuosl.org, anthony.l.nguyen@intel.com,
netdev@vger.kernel.org
Subject: Re: [Intel-wired-lan] [PATCH iwl-net v3 5/6] ixgbe: fix ITR value overflow in adaptive interrupt throttling
Date: Sat, 18 Apr 2026 13:26:16 +0100 [thread overview]
Message-ID: <20260418122616.GC280379@horms.kernel.org> (raw)
In-Reply-To: <20260415142841.3222399-6-aleksandr.loktionov@intel.com>
On Wed, Apr 15, 2026 at 04:28:40PM +0200, Aleksandr Loktionov wrote:
> ixgbe_update_itr() packs a mode flag (IXGBE_ITR_ADAPTIVE_LATENCY,
> bit 7) and a usecs delay (bits [6:0]) into an unsigned int, then
> stores the combined value in ring_container->itr which is declared as
> u8. Values above 0xFF wrap on truncation, corrupting both the delay
> and the mode flag on the next readback.
>
> Keep the mode bit (IXGBE_ITR_ADAPTIVE_LATENCY) and the usec delay as
> separate operands in the final store expression. Clamp only the usecs
> portion to [IXGBE_ITR_ADAPTIVE_MIN_USECS, IXGBE_ITR_ADAPTIVE_MAX_USECS]
> using clamp_val() so that:
> - overflow cannot bleed into the mode bit (bit 7),
> - the delay cannot exceed 126 us (IXGBE_ITR_ADAPTIVE_MAX_USECS),
> - the delay cannot drop below 10 us (IXGBE_ITR_ADAPTIVE_MIN_USECS).
>
> Fixes: b4ded8327fea ("ixgbe: Update adaptive ITR algorithm")
> Cc: stable@vger.kernel.org
> Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> ---
> v2 -> v3:
> - Use clamp_val() instead of min_t() to also guard the lower bound
> (IXGBE_ITR_ADAPTIVE_MIN_USECS); keep mode and delay as separate
> operands until final store; use IXGBE_ITR_ADAPTIVE_MAX_USECS (126)
> as upper bound instead of IXGBE_ITR_ADAPTIVE_LATENCY - 1 (127)
> (Simon Horman).
FTR: I think the code would be easier to reason with if
mode and delay were kept separate during earlier calculation
of itr. But I also think that can be handled as a follow-up.
as this patch does improve things.
Reviewed-by: Simon Horman <horms@kernel.org>
WARNING: multiple messages have this Message-ID (diff)
From: Simon Horman <horms@kernel.org>
To: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Cc: intel-wired-lan@lists.osuosl.org, anthony.l.nguyen@intel.com,
netdev@vger.kernel.org
Subject: Re: [PATCH iwl-net v3 5/6] ixgbe: fix ITR value overflow in adaptive interrupt throttling
Date: Sat, 18 Apr 2026 13:26:16 +0100 [thread overview]
Message-ID: <20260418122616.GC280379@horms.kernel.org> (raw)
In-Reply-To: <20260415142841.3222399-6-aleksandr.loktionov@intel.com>
On Wed, Apr 15, 2026 at 04:28:40PM +0200, Aleksandr Loktionov wrote:
> ixgbe_update_itr() packs a mode flag (IXGBE_ITR_ADAPTIVE_LATENCY,
> bit 7) and a usecs delay (bits [6:0]) into an unsigned int, then
> stores the combined value in ring_container->itr which is declared as
> u8. Values above 0xFF wrap on truncation, corrupting both the delay
> and the mode flag on the next readback.
>
> Keep the mode bit (IXGBE_ITR_ADAPTIVE_LATENCY) and the usec delay as
> separate operands in the final store expression. Clamp only the usecs
> portion to [IXGBE_ITR_ADAPTIVE_MIN_USECS, IXGBE_ITR_ADAPTIVE_MAX_USECS]
> using clamp_val() so that:
> - overflow cannot bleed into the mode bit (bit 7),
> - the delay cannot exceed 126 us (IXGBE_ITR_ADAPTIVE_MAX_USECS),
> - the delay cannot drop below 10 us (IXGBE_ITR_ADAPTIVE_MIN_USECS).
>
> Fixes: b4ded8327fea ("ixgbe: Update adaptive ITR algorithm")
> Cc: stable@vger.kernel.org
> Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> ---
> v2 -> v3:
> - Use clamp_val() instead of min_t() to also guard the lower bound
> (IXGBE_ITR_ADAPTIVE_MIN_USECS); keep mode and delay as separate
> operands until final store; use IXGBE_ITR_ADAPTIVE_MAX_USECS (126)
> as upper bound instead of IXGBE_ITR_ADAPTIVE_LATENCY - 1 (127)
> (Simon Horman).
FTR: I think the code would be easier to reason with if
mode and delay were kept separate during earlier calculation
of itr. But I also think that can be handled as a follow-up.
as this patch does improve things.
Reviewed-by: Simon Horman <horms@kernel.org>
next prev parent reply other threads:[~2026-04-18 12:26 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-15 14:28 [Intel-wired-lan] [PATCH iwl-net v3 0/6] ixgbe: six bug fixes Aleksandr Loktionov
2026-05-13 7:57 ` [Intel-wired-lan] [PATCH iwl-net v4 0/5] ixgbe: five " Aleksandr Loktionov
2026-04-15 14:28 ` [PATCH iwl-net v3 0/6] ixgbe: six " Aleksandr Loktionov
2026-04-15 14:28 ` [Intel-wired-lan] [PATCH iwl-net v3 1/6] ixgbe: fix SWFW semaphore timeout for X550 family Aleksandr Loktionov
2026-05-13 7:57 ` [Intel-wired-lan] [PATCH iwl-net v4 1/5] " Aleksandr Loktionov
2026-04-15 14:28 ` [PATCH iwl-net v3 1/6] " Aleksandr Loktionov
2026-04-15 14:28 ` [Intel-wired-lan] [PATCH iwl-net v3 2/6] ixgbe: add bounds check for debugfs register access Aleksandr Loktionov
2026-04-15 14:28 ` Aleksandr Loktionov
2026-05-13 7:46 ` [Intel-wired-lan] " Larysa Zaremba
2026-05-13 7:46 ` Larysa Zaremba
2026-05-13 21:04 ` [Intel-wired-lan] " Tony Nguyen
2026-05-13 21:04 ` Tony Nguyen
2026-04-15 14:28 ` [Intel-wired-lan] [PATCH iwl-net v3 3/6] ixgbe: call ixgbe_setup_fc() before fc_enable() after NVM update Aleksandr Loktionov
2026-05-13 7:57 ` [Intel-wired-lan] [PATCH iwl-net v4 2/5] " Aleksandr Loktionov
2026-04-15 14:28 ` [PATCH iwl-net v3 3/6] " Aleksandr Loktionov
2026-04-18 12:28 ` [Intel-wired-lan] " Simon Horman
2026-04-18 12:28 ` Simon Horman
2026-04-15 14:28 ` [Intel-wired-lan] [PATCH iwl-net v3 4/6] ixgbe: fix cls_u32 nexthdr path returning success when no entry installed Aleksandr Loktionov
2026-05-13 7:57 ` [Intel-wired-lan] [PATCH iwl-net v4 3/5] " Aleksandr Loktionov
2026-04-15 14:28 ` [PATCH iwl-net v3 4/6] " Aleksandr Loktionov
2026-04-15 14:28 ` [Intel-wired-lan] [PATCH iwl-net v3 5/6] ixgbe: fix ITR value overflow in adaptive interrupt throttling Aleksandr Loktionov
2026-05-13 7:57 ` [Intel-wired-lan] [PATCH iwl-net v4 4/5] " Aleksandr Loktionov
2026-04-15 14:28 ` [PATCH iwl-net v3 5/6] " Aleksandr Loktionov
2026-04-18 12:26 ` Simon Horman [this message]
2026-04-18 12:26 ` Simon Horman
2026-04-15 14:28 ` [Intel-wired-lan] [PATCH iwl-net v3 6/6] ixgbe: fix integer overflow and wrong bit position in ixgbe_validate_rtr() Aleksandr Loktionov
2026-05-13 7:57 ` [Intel-wired-lan] [PATCH iwl-net v4 5/5] " Aleksandr Loktionov
2026-04-15 14:28 ` [PATCH iwl-net v3 6/6] " Aleksandr Loktionov
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=20260418122616.GC280379@horms.kernel.org \
--to=horms@kernel.org \
--cc=aleksandr.loktionov@intel.com \
--cc=anthony.l.nguyen@intel.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=netdev@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.