Netdev List
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: satishkh@cisco.com
Cc: Jakub Kicinski <kuba@kernel.org>,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	pabeni@redhat.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, leitao@debian.org,
	sebaddel@cisco.com
Subject: Re: [PATCH net-next v12 05/12] enic: add admin CQ service with MSI-X interrupt and workqueue polling
Date: Mon, 27 Jul 2026 17:41:43 -0700	[thread overview]
Message-ID: <20260728004143.2979882-1-kuba@kernel.org> (raw)
In-Reply-To: <20260719-enic-sriov-v2-admin-channel-v2-v12-5-6ff2c617001d@cisco.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.
---
--- Patch [5]: [PATCH net-next v12 05/12] enic: add admin CQ service with MSI-X interrupt and workqueue polling ---
commit 91aacafcb0c0e3c10237617f2d69726711e41d5c
Author: Satish Kharat <satishkh@cisco.com>

enic: add admin CQ service with MSI-X interrupt and workqueue polling

This commit adds a completion queue service for the admin channel work
queue and receive queue. It sets up an MSI-X interrupt that schedules
a workqueue poller to drain completions and dispatch received messages.

> diff --git a/drivers/net/ethernet/cisco/enic/enic_admin.c b/drivers/net/ethernet/cisco/enic/enic_admin.c
> index b2be420921064..9358165263d98 100644
> --- a/drivers/net/ethernet/cisco/enic/enic_admin.c
> +++ b/drivers/net/ethernet/cisco/enic/enic_admin.c
[ ... ]
> +unsigned int enic_admin_rq_cq_service(struct enic *enic)
> +{
[ ... ]
> +		enic_admin_msg_enqueue(enic, buf->os_buf, bytes_written);
> +
> +next_desc:
> +		enic_admin_rq_buf_clean(rq, rq->to_clean);
> +		rq->to_clean = rq->to_clean->next;
> +		rq->ring.desc_avail++;
> +
> +		vnic_cq_inc_to_clean(cq);
> +		work++;
> +		desc = vnic_cq_to_clean(cq);
> +	}
> +
> +	if (enic_admin_rq_fill(enic, GFP_KERNEL) && net_ratelimit())
> +		netdev_warn(enic->netdev,
> +			    "admin RQ refill failed\n");

[Severity: High]
What happens if enic_admin_rq_fill() fails to allocate memory here?

If it fails under memory pressure and returns without posting new buffers
to the hardware, does the admin channel permanently stall? It looks like
there is no retry timer or fallback mechanism to refill the queue later.
Without available receive buffers, the hardware won't be able to post further
receive completions, meaning the MSI-X interrupt won't fire again to recover
the channel.

> +
> +	return work;
> +}
[ ... ]
> @@ -220,6 +500,19 @@ int enic_admin_channel_open(struct enic *enic)
>  		return err;
>  	}
>  
> +	spin_lock_init(&enic->admin_msg_lock);
> +	INIT_LIST_HEAD(&enic->admin_msg_list);
> +	INIT_WORK(&enic->admin_msg_work, enic_admin_msg_work_handler);
> +	INIT_WORK(&enic->admin_poll_work, enic_admin_poll_work_handler);
> +
> +	err = enic_admin_setup_intr(enic);
> +	if (err) {
> +		netdev_err(enic->netdev,
> +			   "Admin channel requires MSI-X, SR-IOV unavailable: %d\n",
> +			   err);
> +		goto free_resources;
> +	}
> +
> +	enic_admin_init_resources(enic);

[Severity: High]
Since enic_admin_setup_intr() calls request_irq(), is it possible for an
interrupt to fire before enic_admin_init_resources() initializes the
hardware queues?

If a spurious interrupt arrives immediately after request_irq(), it would
schedule admin_poll_work which then calls enic_admin_rq_cq_service().
Because the ring pointers (such as rq->to_use) haven't been initialized by
enic_admin_init_resources() yet, could this lead to a NULL pointer
dereference or lockless data corruption?

>  
>  	vnic_wq_enable(&enic->admin_wq);
> @@ -239,17 +532,31 @@ int enic_admin_channel_open(struct enic *enic)

  parent reply	other threads:[~2026-07-28  0:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-19  8:41 [PATCH net-next v12 00/12] enic: SR-IOV V2 admin channel and MBOX protocol Satish Kharat
2026-07-19  8:41 ` [PATCH net-next v12 01/12] enic: cancel tx_hang_reset work on device removal Satish Kharat
2026-07-28  0:37   ` Jakub Kicinski
2026-07-19  8:41 ` [PATCH net-next v12 02/12] enic: verify firmware supports V2 SR-IOV at probe time Satish Kharat
2026-07-19  8:41 ` [PATCH net-next v12 03/12] enic: add admin channel open and close for SR-IOV Satish Kharat
2026-07-19  8:41 ` [PATCH net-next v12 04/12] enic: add admin RQ buffer management Satish Kharat
2026-07-19  8:41 ` [PATCH net-next v12 05/12] enic: add admin CQ service with MSI-X interrupt and workqueue polling Satish Kharat
2026-07-28  0:41   ` Jakub Kicinski
2026-07-28  0:41   ` Jakub Kicinski [this message]
2026-07-19  8:41 ` [PATCH net-next v12 06/12] enic: define MBOX message types and header structures Satish Kharat
2026-07-19  8:41 ` [PATCH net-next v12 07/12] enic: add MBOX core send and receive for admin channel Satish Kharat
2026-07-19  8:41 ` [PATCH net-next v12 08/12] enic: add MBOX PF handlers for VF register and capability Satish Kharat
2026-07-19  8:41 ` [PATCH net-next v12 09/12] enic: add MBOX VF handlers for capability, register and link state Satish Kharat
2026-07-19  8:41 ` [PATCH net-next v12 10/12] enic: wire V2 SR-IOV enable with admin channel and MBOX Satish Kharat
2026-07-19  8:41 ` [PATCH net-next v12 11/12] enic: add V2 VF probe with admin channel and PF registration Satish Kharat
2026-07-19  8:41 ` [PATCH net-next v12 12/12] enic: re-establish V2 VF admin channel and PF registration after reset Satish Kharat

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=20260728004143.2979882-1-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=leitao@debian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=satishkh@cisco.com \
    --cc=sebaddel@cisco.com \
    /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