All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH net v1] i40e: Fix queues reservation for XDP
Date: Fri, 26 Nov 2021 16:55:10 +0100	[thread overview]
Message-ID: <YaEDXl4Xi089+vPT@boxer> (raw)
In-Reply-To: <20211126101122.25085-1-mateusz.palczewski@intel.com>

On Fri, Nov 26, 2021 at 11:11:22AM +0100, Mateusz Palczewski wrote:
> From: Sylwester Dziedziuch <sylwesterx.dziedziuch@intel.com>
> 
> When XDP was configured on a system with large number of CPUs
> and X722 NIC there was a call trace with NULL pointer dereference.
> 
> i40e 0000:87:00.0: failed to get tracking for 256 queues for VSI 0 err -12
> i40e 0000:87:00.0: setup of MAIN VSI failed
> 
> BUG: kernel NULL pointer dereference, address: 0000000000000000
> RIP: 0010:i40e_xdp+0xea/0x1b0 [i40e]
> Call Trace:
> ? i40e_reconfig_rss_queues+0x130/0x130 [i40e]
> dev_xdp_install+0x61/0xe0
> dev_xdp_attach+0x18a/0x4c0
> dev_change_xdp_fd+0x1e6/0x220
> do_setlink+0x616/0x1030
> ? ahci_port_stop+0x80/0x80
> ? ata_qc_issue+0x107/0x1e0
> ? lock_timer_base+0x61/0x80
> ? __mod_timer+0x202/0x380
> rtnl_setlink+0xe5/0x170
> ? bpf_lsm_binder_transaction+0x10/0x10
> ? security_capable+0x36/0x50
> rtnetlink_rcv_msg+0x121/0x350
> ? rtnl_calcit.isra.0+0x100/0x100
> netlink_rcv_skb+0x50/0xf0
> netlink_unicast+0x1d3/0x2a0
> netlink_sendmsg+0x22a/0x440
> sock_sendmsg+0x5e/0x60
> __sys_sendto+0xf0/0x160
> ? __sys_getsockname+0x7e/0xc0
> ? _copy_from_user+0x3c/0x80
> ? __sys_setsockopt+0xc8/0x1a0
> __x64_sys_sendto+0x20/0x30
> do_syscall_64+0x33/0x40
> entry_SYSCALL_64_after_hwframe+0x44/0xae
> RIP: 0033:0x7f83fa7a39e0
> 
> This was caused by PF queue pile fragmentation due to
> flow director VSI queue being placed right after main VSI.
> Because of this main VSI was not able to resize its
> queue allocation for XDP resulting in no queues allocated
> for main VSI when XDP was turned on.
> 
> Fix this by always allocating last queue in PF queue pile
> for a flow director VSI.
> 
> Fixes: 41c445ff0f48 ("i40e: main driver core")

I'd also add:
Fixes: 74608d17fe29 ("i40e: add support for XDP_TX action")

> Signed-off-by: Sylwester Dziedziuch <sylwesterx.dziedziuch@intel.com>
> Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>

Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>

> ---
>  drivers/net/ethernet/intel/i40e/i40e_main.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
> index 86fb795..9c612b1 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
> @@ -192,6 +192,20 @@ static int i40e_get_lump(struct i40e_pf *pf, struct i40e_lump_tracking *pile,
>  		return -EINVAL;
>  	}
>  
> +	/* Allocate last queue in the pile for FDIR VSI queue
> +	 * so it doesn't fragment the qp_pile
> +	 */
> +	if (pile == pf->qp_pile && pf->vsi[id]->type == I40E_VSI_FDIR) {
> +		if (pile->list[pile->num_entries - 1] & I40E_PILE_VALID_BIT) {
> +			dev_err(&pf->pdev->dev,
> +				"Cannot allocate queue %d for I40E_VSI_FDIR\n",
> +				pile->num_entries - 1);
> +			return -ENOMEM;
> +		}
> +		pile->list[pile->num_entries - 1] = id | I40E_PILE_VALID_BIT;
> +		return pile->num_entries - 1;
> +	}
> +
>  	i = 0;
>  	while (i < pile->num_entries) {
>  		/* skip already allocated entries */
> -- 
> 2.27.0
> 
> _______________________________________________
> Intel-wired-lan mailing list
> Intel-wired-lan at osuosl.org
> https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

  reply	other threads:[~2021-11-26 15:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-26 10:11 [Intel-wired-lan] [PATCH net v1] i40e: Fix queues reservation for XDP Mateusz Palczewski
2021-11-26 15:55 ` Maciej Fijalkowski [this message]
2021-11-26 14:47   ` [Intel-wired-lan] Wrong email time (was: [PATCH net v1] i40e: Fix queues reservation for XDP) Paul Menzel
2022-01-05  6:14 ` [Intel-wired-lan] [PATCH net v1] i40e: Fix queues reservation for XDP Bhandare, KiranX

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=YaEDXl4Xi089+vPT@boxer \
    --to=maciej.fijalkowski@intel.com \
    --cc=intel-wired-lan@osuosl.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.