mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Dong Yibo <dong100@mucse.com>
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, vadim.fedorenko@linux.dev,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	yaojun@mucse.com
Subject: Re: [PATCH net-next v8 1/4] net: rnpgbe: Add interrupt handling
Date: Wed, 5 Aug 2026 10:34:28 +0100	[thread overview]
Message-ID: <20260805093428.GN51943@horms.kernel.org> (raw)
In-Reply-To: <20260731120322.895955-2-dong100@mucse.com>

On Fri, Jul 31, 2026 at 08:03:19PM +0800, Dong Yibo wrote:

...

> diff --git a/drivers/net/ethernet/mucse/rnpgbe/rnpgbe_main.c b/drivers/net/ethernet/mucse/rnpgbe/rnpgbe_main.c

...

> @@ -50,6 +68,11 @@ static int rnpgbe_open(struct net_device *netdev)
>   **/
>  static int rnpgbe_close(struct net_device *netdev)
>  {
> +	struct mucse *mucse = netdev_priv(netdev);
> +
> +	rnpgbe_down(mucse);
> +	rnpgbe_free_irq(mucse);
> +
>  	return 0;
>  }

Hi Dong,

There is an AI-generated review of this patch-set available at
https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260731120322.895955-1-dong100%40mucse.com
I would appreciate it if you could take a look over it.

In particular, the following issue does seem to be of concern.

I take the last portion regarding ixgbe to be a template for a solution to
the problem raised, not that the __IXGBE_DOWN bit should litteraly be used
in the rnpgbe driver.

  Is ndo_stop now safe to call twice?

  rnpgbe_dev_shutdown() in this same file calls rnpgbe_close() directly rather
  than going through dev_close():

	  rtnl_lock();
	  netif_device_detach(netdev);
	  if (netif_running(netdev))
		  rnpgbe_close(netdev);
	  rtnl_unlock();

  netif_device_detach() only clears __LINK_STATE_PRESENT, so IFF_UP and
  __LINK_STATE_START stay set and the core still believes the interface is up.

  A later dev_close() (device_shutdown() runs before migrate_to_reboot_cpu(),
  so an "ip link set dev X down" on another CPU can still get through), or an
  unbind/unregister_netdev() after a shutdown, would call ndo_stop again:

    dev_close() -> __dev_close_many() -> ops->ndo_stop() -> rnpgbe_close()

  On that second pass rnpgbe_down() runs again:

	  void rnpgbe_down(struct mucse *mucse)
	  {
		  set_bit(__MUCSE_DOWN, &mucse->state);
		  rnpgbe_napi_disable_all(mucse);
		  rnpgbe_irq_disable(mucse);
	  }

  With plain set_bit() there is nothing to detect the re-entry, so
  napi_disable() runs on an already-disabled NAPI.  In napi_disable_locked():

	  while (val & (NAPIF_STATE_SCHED | NAPIF_STATE_NPSVC)) {
		  usleep_range(20, 200);
		  val = READ_ONCE(n->state);
	  }

  The irq is already freed and NAPI was never re-enabled, so can anything
  clear those bits?  That loop has no timeout, and it runs under rtnl_lock().

  The second rnpgbe_free_irq() would also call free_irq() on vectors already
  released, giving the "Trying to free already-free IRQ" warning.

  Before this patch rnpgbe_close() was just "return 0;", so the double call
  was harmless.

  Would the ixgbe guard fit here?

	  drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:ixgbe_down() {
		  /* signal that we are down to the interrupt handler */
		  if (test_and_set_bit(__IXGBE_DOWN, &adapter->state))
			return; /* do nothing if already down */
		...
	}

  Alternatively, should rnpgbe_dev_shutdown() call dev_close() so the core
  state stays consistent?

...

  reply	other threads:[~2026-08-05  9:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-31 12:03 [PATCH net-next v8 0/4] net: rnpgbe: Add TX/RX and link status support Dong Yibo
2026-07-31 12:03 ` [PATCH net-next v8 1/4] net: rnpgbe: Add interrupt handling Dong Yibo
2026-08-05  9:34   ` Simon Horman [this message]
2026-08-05 11:04     ` Yibo Dong
2026-07-31 12:03 ` [PATCH net-next v8 2/4] net: rnpgbe: Add basic TX packet transmission support Dong Yibo
2026-07-31 12:03 ` [PATCH net-next v8 3/4] net: rnpgbe: Add RX packet reception support Dong Yibo
2026-07-31 12:03 ` [PATCH net-next v8 4/4] net: rnpgbe: Add link status handling support Dong Yibo
2026-08-05  9:39   ` Simon Horman

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=20260805093428.GN51943@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dong100@mucse.com \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=vadim.fedorenko@linux.dev \
    --cc=yaojun@mucse.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®