public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: longli@microsoft.com
Cc: Simon Horman <horms@kernel.org>,
	davem@davemloft.net, edumazet@google.com, haiyangz@microsoft.com,
	linux-rdma@vger.kernel.org, linux-hyperv@vger.kernel.org,
	kuba@kernel.org, wei.liu@kernel.org,
	shradhagupta@linux.microsoft.com, pabeni@redhat.com,
	kotaranov@microsoft.com, schakrabarti@linux.microsoft.com,
	erick.archer@outlook.com, linux-kernel@vger.kernel.org,
	kys@microsoft.com, decui@microsoft.com, netdev@vger.kernel.org
Subject: Re: [v2,net-next,1/6] net: mana: Create separate EQs for each vPort
Date: Fri,  6 Mar 2026 16:08:20 +0000	[thread overview]
Message-ID: <20260306160820.525640-1-horms@kernel.org> (raw)
In-Reply-To: <20260304000017.333312-2-longli@microsoft.com>

This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.

For local reproduction steps see https://netdev-ai.bots.linux.dev/ai-local.html
---
net: mana: Create separate EQs for each vPort

To prepare for assigning vPorts to dedicated MSI-X vectors, this commit
removes EQ sharing among vPorts and creates dedicated EQs for each vPort.
The EQ definition is moved from struct mana_context to struct
mana_port_context and related support functions are updated.

> diff --git a/include/net/mana/mana.h b/include/net/mana/mana.h
> --- a/include/net/mana/mana.h
> +++ b/include/net/mana/mana.h

[ ... ]

> @@ -499,6 +497,9 @@ struct mana_port_context {
>
>  	u8 mac_addr[ETH_ALEN];
>
> +	struct mana_eq *eqs;
> +	struct dentry *mana_eqs_debugfs;
> +
>  	enum TRI_STATE rss_state;
>
>  	mana_handle_t default_rxobj;

[ ... ]

> diff --git a/drivers/infiniband/hw/mana/qp.c b/drivers/infiniband/hw/mana/qp.c
> --- a/drivers/infiniband/hw/mana/qp.c
> +++ b/drivers/infiniband/hw/mana/qp.c
> @@ -188,7 +188,7 @@ struct mana_obj_spec cq_spec = {};
>  		cq_spec.gdma_region = cq->queue.gdma_region;
>  		cq_spec.queue_size = cq->cqe * COMP_ENTRY_SIZE;
>  		cq_spec.modr_ctx_id = 0;
> -		eq = &mpc->ac->eqs[cq->comp_vector];
> +		eq = &mpc->eqs[cq->comp_vector % mpc->num_queues];
                           ^^^^^^^
>  		cq_spec.attached_eq = eq->eq->id;

Can mpc->eqs be NULL here? Looking at the initialization paths:

Before this patch, mpc->ac->eqs was allocated during mana_probe() and was
always non-NULL after driver initialization.

After this patch, mpc->eqs is only allocated in two places:
1. mana_alloc_queues() - called when the Ethernet interface is brought up
2. mana_ib_cfg_vport() - called when RDMA RAW QPs configure the vport

However, mana_ib_create_qp_rss() doesn't call mana_ib_cfg_vport(). If an
RSS QP is created via RDMA verbs before the Ethernet port is brought up
and before any RAW QP has configured the vport, mpc->eqs would still be
NULL.

Computing &mpc->eqs[cq->comp_vector % mpc->num_queues] from a NULL pointer
produces an invalid address, and the subsequent dereference eq->eq->id
would crash the kernel.

Should there be a NULL check here, or should mana_ib_create_qp_rss()
ensure EQs are created before reaching this point?

>
>  		ret = mana_create_wq_obj(mpc, mpc->port_handle, GDMA_RQ,

[ ... ]

  parent reply	other threads:[~2026-03-06 16:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-04  0:00 [PATCH v2 net-next 0/6] net: mana: Per-vPort EQ and MSI-X interrupt management Long Li
2026-03-04  0:00 ` [PATCH v2 net-next 1/6] net: mana: Create separate EQs for each vPort Long Li
2026-03-04 14:58   ` Leon Romanovsky
2026-03-06 16:08   ` Simon Horman [this message]
2026-03-06 20:45     ` [EXTERNAL] Re: [v2,net-next,1/6] " Long Li
2026-03-04  0:00 ` [PATCH v2 net-next 2/6] net: mana: Query device capabilities and configure MSI-X sharing for EQs Long Li
2026-03-04  0:00 ` [PATCH v2 net-next 3/6] net: mana: Introduce GIC context with refcounting for interrupt management Long Li
2026-03-04  0:00 ` [PATCH v2 net-next 4/6] net: mana: Use GIC functions to allocate global EQs Long Li
2026-03-04  0:00 ` [PATCH v2 net-next 5/6] net: mana: Allocate interrupt context for each EQ when creating vPort Long Li
2026-03-04  0:00 ` [PATCH v2 net-next 6/6] RDMA/mana_ib: Allocate interrupt contexts on EQs Long Li
2026-03-04 14:59   ` Leon Romanovsky

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=20260306160820.525640-1-horms@kernel.org \
    --to=horms@kernel.org \
    --cc=davem@davemloft.net \
    --cc=decui@microsoft.com \
    --cc=edumazet@google.com \
    --cc=erick.archer@outlook.com \
    --cc=haiyangz@microsoft.com \
    --cc=kotaranov@microsoft.com \
    --cc=kuba@kernel.org \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=longli@microsoft.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=schakrabarti@linux.microsoft.com \
    --cc=shradhagupta@linux.microsoft.com \
    --cc=wei.liu@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox