All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.e.keller@intel.com>
To: <sashiko-reviews@lists.linux.dev>
Cc: <intel-wired-lan@lists.osuosl.org>
Subject: Re: [PATCH iwl-next v2 2/6] ice: count number of VSIS in agg_vsi_list
Date: Fri, 9 Oct 2026 16:11:15 -0700	[thread overview]
Message-ID: <033cb9c9-4a2c-42d9-b71e-bf14841d06d7@intel.com> (raw)
In-Reply-To: <sashiko-outbox-166033@kernel.org>

On 10/9/2026 1:27 PM, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] ice: num_vsis inflated and stale entry left on VSI move failure
> --
> 
> commit a9d16d503219ec18b5a73776a1a7f4b0b851cd1b
> Author: Jacob Keller <jacob.e.keller@intel.com>
> 
> ice: count number of VSIS in agg_vsi_list
> 
> This patch adds a member num_vsis to the ice_sched_agg_info structure to track
> the number of VSIs associated with an aggregator node. The counter is
> incremented when adding a VSI to the list and decremented when removing it,
> avoiding the need to iterate over the agg_vsi_list.
> 
>> diff --git a/drivers/net/ethernet/intel/ice/ice_sched.c b/drivers/net/ethernet/intel/ice/ice_sched.c
>> index bcfc9db69e17e..08d0f685f6c45 100644
>> --- a/drivers/net/ethernet/intel/ice/ice_sched.c
>> +++ b/drivers/net/ethernet/intel/ice/ice_sched.c
> 
> [ ... ]
> 
>> @@ -2915,24 +2920,26 @@ ice_sched_assoc_vsi_to_agg(struct ice_port_info *pi, u32 agg_id,
>>  		/* add VSI ID into the aggregator list */
>>  		agg_vsi_info->vsi_handle = vsi_handle;
>>  		list_add(&agg_vsi_info->list_entry, &agg_info->agg_vsi_list);
>> +		agg_info->num_vsis++;
>>  	}
>>  	/* Move VSI node to new aggregator node for requested TC(s) */
>>  	ice_for_each_traffic_class(tc) {
>>  		if (!ice_is_tc_ena(*tc_bitmap, tc))
>>  			continue;
>>  
>>  		/* Move VSI to new aggregator */
>>  		status = ice_sched_move_vsi_to_agg(pi, vsi_handle, agg_id, tc);
>>  		if (status)
>>  			break;
> 
> [Severity: Medium]
> If ice_sched_move_vsi_to_agg() fails and returns an error here, the loop will
> break. Should the function roll back the agg_info->num_vsis increment and remove
> the newly added agg_vsi_info from agg_info->agg_vsi_list before returning?
> 
> Without a rollback, a stale VSI entry with an empty tc_bitmap remains in the
> aggregator list, permanently inflating the num_vsis counter. If subsequent code
> relies on num_vsis to enforce limits like ICE_MAX_VSIS_IN_AGG_NODE, this could
> cause the aggregator to prematurely reject new VSIs.
> 

I'll have to check this but cleaning up seems reasonable if it can be
done properly.

Honestly the entire logic here feels like the data types and
abstractions are not very good.. but its been difficult to try and take
incremental steps forward on fixing it :\

>>  
>>  		set_bit(tc, agg_vsi_info->tc_bitmap);
>>  		if (old_agg_vsi_info)
>>  			clear_bit(tc, old_agg_vsi_info->tc_bitmap);
>>  	}
>>  	if (old_agg_vsi_info && !old_agg_vsi_info->tc_bitmap[0]) {
>>  		list_del(&old_agg_vsi_info->list_entry);
>>  		devm_kfree(ice_hw_to_dev(pi->hw), old_agg_vsi_info);
>> +		old_agg_info->num_vsis--;
>>  	}
>>  	return status;
>>  }
> 


  reply	other threads:[~2026-10-09 23:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-09 20:11 [PATCH iwl-next v2 0/6] ice: refactor aggregator node logic Jacob Keller
2026-10-09 20:11 ` [PATCH iwl-next v2 1/6] ice: convert hw->agg_list from linked list to xarray Jacob Keller
2026-10-09 20:11 ` [PATCH iwl-next v2 2/6] ice: count number of VSIS in agg_vsi_list Jacob Keller
2026-10-09 20:27   ` sashiko-bot
2026-10-09 23:11     ` Jacob Keller [this message]
2026-10-09 20:11 ` [PATCH iwl-next v2 3/6] ice: extract aggregator allocation out of ice_sched_cfg_agg Jacob Keller
2026-10-09 20:11 ` [PATCH iwl-next v2 4/6] ice: pass agg_info instead of performing lookup Jacob Keller
2026-10-09 20:11 ` [PATCH iwl-next v2 5/6] ice: remove ice_agg_node wrapper structure Jacob Keller
2026-10-09 20:26   ` sashiko-bot
2026-10-09 23:08     ` Jacob Keller
2026-10-09 20:11 ` [PATCH iwl-next v2 6/6] ice: remove unused aggregator node functions Jacob Keller

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=033cb9c9-4a2c-42d9-b71e-bf14841d06d7@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.