mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: illusion.wang@nebula-matrix.com
Cc: dimon.zhao@nebula-matrix.com, alvin.wang@nebula-matrix.com,
	sam.chen@nebula-matrix.com, netdev@vger.kernel.org,
	kuba@kernel.org, andrew+netdev@lunn.ch, pabeni@redhat.com,
	edumazet@google.com, horms@kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v35 net-next 8/8] net/nebula-matrix: add common dev start/stop operation
Date: Mon, 23 Nov 2026 12:52:09 +0000	[thread overview]
Message-ID: <179543832921.3135.12200832894176272241@kernel.org> (raw)
In-Reply-To: <20261119113530.32107-9-illusion.wang@nebula-matrix.com>

Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The commit message and the new comments argue against earlier
  review feedback more than they describe this change.
- [Low] This patch adds a third queue_work() site for the mailbox clean
  task: the hardirq handler nbl_dev_clean_mailbox() calls…
- [Low] A comment in nbl_dev_setup_common_dev() (added earlier in this
  series by commit "net/nebula-matrix: add common/ctrl dev init/remove…

--

net/nebula-matrix: add common dev start/stop operation

This commit adds nbl_dev_start() and nbl_dev_stop(). They are called
from nbl_probe() and nbl_remove() through nbl_core_start() and
nbl_core_stop().

Start configures the MSI-X map, fetches the VSI/ETH ids, allocates the
MSI-X vectors and arms the mailbox interrupt. Stop undoes these steps.

nbl_probe() now also rejects a function that has neither the ctrl nor
the net capability.

> diff --git a/drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_dev.c b/drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_dev.c
> index b20747d47fde2..de6a30996bb32 100644
> --- a/drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_dev.c
> +++ b/drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_dev.c

[ ... ]

> @@ -19,6 +30,247 @@ static void nbl_dev_init_msix_cnt(struct nbl_dev_mgt *dev_mgt)

[ ... ]

> +static int nbl_dev_disable_mailbox_irq(struct nbl_dev_mgt *dev_mgt)
> +{

[ ... ]

> +	lvec = msix_info->serv_info[NBL_MSIX_MAILBOX_TYPE].base_vector_id;
> +	/*
> +	 * Disable sequence invariant: clear the software READY flag first,
> +	 * then mask the hardware interrupt. Must not reverse the order.
> +	 *

[ ... ]

> +	 * This does NOT preserve in-flight ACKs, and must not be described
> +	 * as doing so: the woken sender gives up and resets its slot to
> +	 * IDLE, so an ACK arriving afterwards finds a non-WAITING slot and
> +	 * is dropped by the receive path ("Skip ack invalid status").
> +	 * Interrupt mode is being torn down here; the guarantee is a
> +	 * bounded, deterministic failure, not delivery.  In this driver
> +	 * every ACK-requesting sender runs from probe/remove and the clean
> +	 * task only sends ACK-less replies, so nothing depends on the
> +	 * stronger claim today.

[Severity: Low]
This isn't a bug, but could this comment be cut down to just the
invariant? Wording like "must not be described as doing so" reads like
a reply to earlier review, not documentation of the code.

The same thing happens in a few other places in this patch.

The comment at the top of nbl_dev_start() repeats the commit message's
argument for -ETIMEDOUT over -EPROBE_DEFER.

The lifetime of the control PF's MSI-X resources is explained three
times: in the commit message, at the err_destroy_map label in
nbl_dev_start(), and again in nbl_dev_stop(). This covers the
had_config path, the coherent table being kept, and nbl_intr_mgt_stop()
being the only release.

Those comments also describe the internals of functions in
nbl_interrupt.c:

  __nbl_res_intr_prepare_destroy_msix_map()
  __nbl_res_intr_complete_destroy_msix_map()
  the rollback in nbl_res_intr_cfg_msix_map()
  nbl_intr_mgt_stop()

Won't these comments go stale without anyone noticing when those
functions change?

Most of the commit message is also about alternatives that were not
taken, for example:

    Relaxing the dependency to
    "func 0 finished nbl_dev_init()" would therefore let every sibling RPC
    sit out the full 5-6s polling wait.  Converting the timeout to
    -EPROBE_DEFER would only hide it behind dev_dbg() and make every later
    bind pay that wait again.

The same goes for the pcim_msi_release double free discussion and the
driver_override paths. Could the changelog focus on what start and stop
actually do?

The label rename in nbl_dev_init() (setup_ctrl_dev_fail becomes
out_remove_common_dev, and setup_err is dropped) is not related to
start/stop. Would it fit better in a separate patch?

[ ... ]

> @@ -86,6 +338,14 @@ static void nbl_dev_clean_mailbox_task(struct work_struct *work)
>  				      NBL_CHAN_TYPE_MAILBOX);
>  }
>  
> +static void nbl_dev_clean_mailbox_schedule(struct nbl_dev_mgt *dev_mgt)
> +{
> +	struct nbl_dev_common *common_dev = dev_mgt->common_dev;
> +	struct nbl_common_info *common = dev_mgt->common;
> +
> +	queue_work(common->wq, &common_dev->clean_mbx_task);
> +}

[Severity: Low]
This adds a third queue_work() site for clean_mbx_task, called from the
nbl_dev_clean_mailbox() hardirq handler. The invariant comment in the
channel layer still says there are only two:

drivers/net/ethernet/nebula-matrix/nbl/nbl_channel/nbl_channel.c:nbl_chan_teardown_queue() {
    ...
	 * Nothing can be queued once Step 1 has run: both queue_work()
	 * sites (the sender's ACK poll and the worker's own self-requeue)
	 * check shutdn and clean_task under state_lock, and Step 1 cleared
	 * both.
    ...
}

The new site checks neither shutdn nor clean_task, and it cannot take
the state_lock mutex from hardirq context. It also skips the common->wq
check that nbl_chan_send_msg() makes before calling queue_work().

The invariant still holds today, but only because the device layer
frees the mailbox IRQ first. nbl_dev_stop() calls
nbl_dev_free_mailbox_irq() before the channel is torn down in
nbl_core_remove()->nbl_dev_remove_common_dev(). The nbl_dev_start()
rollback frees the IRQ at err_free_irq.

Should the comment in nbl_chan_teardown_queue() list the hardirq site?
Should it also say that the invariant depends on the IRQ being freed
before teardown_queue() runs? This patch's commit message already
lists three sources ("queued by the mailbox hardirq, by the task's own
self-requeue, or by this function's polling sends").

[ ... ]

> @@ -309,3 +569,189 @@ void nbl_dev_remove(struct nbl_adapter *adapter)
>  	if (common->has_ctrl)
>  		nbl_dev_remove_ctrl_dev(adapter);
>  }
> +
> +/* ----------  Dev start process  ---------- */
> +int nbl_dev_start(struct nbl_adapter *adapter)
> +{

[ ... ]

> +	ret = nbl_dev_cfg_msix_map(dev_mgt);
> +	if (ret)
> +		goto err_destroy_map;
> +
> +	/* Fetch VSI/ETH identity after cfg_msix_map */
> +	ret = disp_ops->get_vsi_id(priv, NBL_VSI_DATA, &common->vsi_id);
> +	if (ret)
> +		goto err_destroy_map;
> +	ret = disp_ops->get_eth_id(priv, common->vsi_id, &common->eth_num,
> +				   &common->eth_id, &common->logic_eth_id);
> +	if (ret)
> +		goto err_destroy_map;

[Severity: Low]
Does this match the comment that an earlier patch in this series added
to nbl_dev_setup_common_dev()?

	/*
	 * VSI/ETH identity is deliberately not fetched here but in the
	 * start path, which is where it is used: the IDs only feed MSI-X
	 * and queue setup.

Here the IDs are fetched after nbl_dev_cfg_msix_map(), and the
cfg_msix_map dispatch op takes no VSI/ETH input:

drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_dispatch.h:
	int (*cfg_msix_map)(struct nbl_dispatch_mgt *disp_mgt,
			    u16 num_net_msix, u16 num_others_msix,
			    bool net_msix_mask_en);

The series has no queue setup yet either. As far as I can tell,
common->vsi_id, eth_id, eth_num and logic_eth_id are written here and
never read. The one exception is vsi_id, which is passed to get_eth_id.

Even so, a failure from either RPC still aborts probe through
err_destroy_map. For example, nbl_res_get_eth_id() can return an error
for a PF/VSI mismatch or when rel_pf_id >= eth_num.

Should the fetch move to the patch that uses these IDs? If not, should
the comment in nbl_dev_setup_common_dev() be corrected?

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261119113530.32107-1-illusion.wang%40nebula-matrix.com

      reply	other threads:[~2026-11-23 12:52 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 11:35 [PATCH v35 net-next 0/8] nbl driver for Nebulamatrix NICs illusion.wang
2026-11-19 11:35 ` [PATCH v35 net-next 1/8] net/nebula-matrix: add channel layer illusion.wang
2026-11-23 12:51   ` netdev-bot+sashiko
2026-11-19 11:35 ` [PATCH v35 net-next 2/8] net/nebula-matrix: add common resource implementation illusion.wang
2026-11-23 12:52   ` netdev-bot+sashiko
2026-11-19 11:35 ` [PATCH v35 net-next 3/8] net/nebula-matrix: add intr " illusion.wang
2026-11-23 12:52   ` netdev-bot+sashiko
2026-11-19 11:35 ` [PATCH v35 net-next 4/8] net/nebula-matrix: add chip-wide hardware init/deinit implementation illusion.wang
2026-11-23 12:52   ` netdev-bot+sashiko
2026-11-19 11:35 ` [PATCH v35 net-next 5/8] net/nebula-matrix: dispatch: add control-level routing core infrastructure illusion.wang
2026-11-19 11:35 ` [PATCH v35 net-next 6/8] net/nebula-matrix: dispatch: add mailbox RPCs for msix map, mailbox irq and vsi/eth id illusion.wang
2026-11-23 12:52   ` netdev-bot+sashiko
2026-11-19 11:35 ` [PATCH v35 net-next 7/8] net/nebula-matrix: add common/ctrl dev init/remove operation illusion.wang
2026-11-23 12:52   ` netdev-bot+sashiko
2026-11-19 11:35 ` [PATCH v35 net-next 8/8] net/nebula-matrix: add common dev start/stop operation illusion.wang
2026-11-23 12:52   ` netdev-bot+sashiko [this message]

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=179543832921.3135.12200832894176272241@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=alvin.wang@nebula-matrix.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=dimon.zhao@nebula-matrix.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=illusion.wang@nebula-matrix.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sam.chen@nebula-matrix.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

all inboxes | Powered by JetHome®