lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZF5hepLUMDrY5Fuh@nimitz>
Date: Fri, 12 May 2023 17:55:38 +0200
From: Piotr Raczynski <piotr.raczynski@...el.com>
To: Simon Horman <simon.horman@...igine.com>
CC: "intel-wired-lan@...osl.org" <intel-wired-lan@...osl.org>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>, "Swiatkowski, Michal"
	<michal.swiatkowski@...el.com>, "Saleem, Shiraz" <shiraz.saleem@...el.com>,
	"Keller, Jacob E" <jacob.e.keller@...el.com>, "Samudrala, Sridhar"
	<sridhar.samudrala@...el.com>, "Brandeburg, Jesse"
	<jesse.brandeburg@...el.com>, "Lobakin, Aleksander"
	<aleksander.lobakin@...el.com>, "Czapnik, Lukasz" <lukasz.czapnik@...el.com>,
	Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>, "Pucha, HimasekharX
 Reddy" <himasekharx.reddy.pucha@...el.com>
Subject: Re: [PATCH net-next v4 6/8] ice: add individual interrupt allocation

On Mon, May 08, 2023 at 09:51:28PM +0200, Simon Horman wrote:
> On Mon, May 08, 2023 at 02:43:19PM +0200, Piotr Raczynski wrote:
> > Currently interrupt allocations, depending on a feature are distributed
> > in batches. Also, after allocation there is a series of operations that
> > distributes per irq settings through that batch of interrupts.
> > 
> > Although driver does not yet support dynamic interrupt allocation, keep
> > allocated interrupts in a pool and add allocation abstraction logic to
> > make code more flexible. Keep per interrupt information in the
> > ice_q_vector structure, which yields ice_vsi::base_vector redundant.
> > Also, as a result there are a few functions that can be removed.
> > 
> > Reviewed-by: Jacob Keller <jacob.e.keller@...el.com>
> > Reviewed-by: Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>
> > Reviewed-by: Simon Horman <simon.horman@...igine.com>
> > Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@...el.com> (A Contingent worker at Intel)
> > Signed-off-by: Piotr Raczynski <piotr.raczynski@...el.com>
> 
> ...
> 
> > diff --git a/drivers/net/ethernet/intel/ice/ice_base.c b/drivers/net/ethernet/intel/ice/ice_base.c
> > index 1911d644dfa8..7dd7a0f32471 100644
> > --- a/drivers/net/ethernet/intel/ice/ice_base.c
> > +++ b/drivers/net/ethernet/intel/ice/ice_base.c
> > @@ -105,8 +105,7 @@ static int ice_vsi_alloc_q_vector(struct ice_vsi *vsi, u16 v_idx)
> >  	struct ice_q_vector *q_vector;
> >  
> >  	/* allocate q_vector */
> > -	q_vector = devm_kzalloc(ice_pf_to_dev(pf), sizeof(*q_vector),
> > -				GFP_KERNEL);
> > +	q_vector = kzalloc(sizeof(*q_vector), GFP_KERNEL);
> >  	if (!q_vector)
> >  		return -ENOMEM;
> >  
> > @@ -118,9 +117,31 @@ static int ice_vsi_alloc_q_vector(struct ice_vsi *vsi, u16 v_idx)
> >  	q_vector->rx.itr_mode = ITR_DYNAMIC;
> >  	q_vector->tx.type = ICE_TX_CONTAINER;
> >  	q_vector->rx.type = ICE_RX_CONTAINER;
> > +	q_vector->irq.index = -ENOENT;
> >  
> > -	if (vsi->type == ICE_VSI_VF)
> > +	if (vsi->type == ICE_VSI_VF) {
> > +		q_vector->reg_idx = ice_calc_vf_reg_idx(vsi->vf, q_vector);
> >  		goto out;
> > +	} else if (vsi->type == ICE_VSI_CTRL && vsi->vf) {
> > +		struct ice_vsi *ctrl_vsi = ice_get_vf_ctrl_vsi(pf, vsi);
> > +
> > +		if (ctrl_vsi) {
> > +			if (unlikely(!ctrl_vsi->q_vectors))
> > +				return -ENOENT;
> 
> Hi Piotr,
> 
> Smatch tells me that q_vector i leaked here.
> 

Nice catch! Thanks. Will respin with some other fix from my side as
well.

Piotr

> > +			q_vector->irq = ctrl_vsi->q_vectors[0]->irq;
> > +			goto skip_alloc;
> > +		}
> > +	}
> > +
> > +	q_vector->irq = ice_alloc_irq(pf);
> > +	if (q_vector->irq.index < 0) {
> > +		kfree(q_vector);
> > +		return -ENOMEM;
> > +	}
> > +
> > +skip_alloc:
> > +	q_vector->reg_idx = q_vector->irq.index;
> > +
> >  	/* only set affinity_mask if the CPU is online */
> >  	if (cpu_online(v_idx))
> >  		cpumask_set_cpu(v_idx, &q_vector->affinity_mask);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ