public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: ernis@linux.microsoft.com
Cc: Jakub Kicinski <kuba@kernel.org>,
	kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org,
	decui@microsoft.com, longli@microsoft.com, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
	kotaranov@microsoft.com, horms@kernel.org,
	shradhagupta@linux.microsoft.com, dipayanroy@linux.microsoft.com,
	yury.norov@gmail.com, shirazsaleem@microsoft.com,
	kees@kernel.org, linux-hyperv@vger.kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-rdma@vger.kernel.org
Subject: Re: [PATCH net-next v7] net: mana: Expose hardware diagnostic info via debugfs
Date: Fri,  1 May 2026 17:54:09 -0700	[thread overview]
Message-ID: <20260502005409.3645108-1-kuba@kernel.org> (raw)
In-Reply-To: <20260430075342.1871554-1-ernis@linux.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.
---
net: mana: Expose hardware diagnostic info via debugfs

This patch adds debugfs entries under /sys/kernel/debug/mana/<BDF>/ to
expose device-level and per-vPort hardware configuration and diagnostic
information. Debugfs creation and removal are moved into mana_gd_setup()
and a renamed mana_gd_cleanup_device() so probe, remove, suspend, resume
and shutdown share a single path.

> diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c
> index a654b3699c4c..077d3a1ff6bf 100644
> --- a/drivers/net/ethernet/microsoft/mana/mana_en.c
> +++ b/drivers/net/ethernet/microsoft/mana/mana_en.c

[ ... ]

> @@ -3659,6 +3684,11 @@ int mana_probe(struct gdma_dev *gd, bool resuming)
>  
>  	ac->bm_hostmode = bm_hostmode;
>  
> +	debugfs_create_u16("num_vports", 0400, gc->mana_pci_debugfs,
> +			   &ac->num_ports);
> +	debugfs_create_u8("bm_hostmode", 0400, gc->mana_pci_debugfs,
> +			  &ac->bm_hostmode);
> +
>  	if (!resuming) {
>  		ac->num_ports = num_ports;
>  	} else {

Is the num_vports debugfs file pointed at ac->num_ports before that
field has been assigned from the queried num_ports value?

On a fresh probe (!resuming), the sequence in mana_probe() is:

    err = mana_query_device_cfg(ac, ..., &num_ports, &bm_hostmode);
    ...
    ac->bm_hostmode = bm_hostmode;

    debugfs_create_u16("num_vports", 0400, gc->mana_pci_debugfs,
                       &ac->num_ports);
    ...

    if (!resuming) {
            ac->num_ports = num_ports;
    } else {
            ...
    }
    ...
    if (ac->num_ports > MAX_PORTS_IN_MANA_DEV)
            ac->num_ports = MAX_PORTS_IN_MANA_DEV;

During the window between debugfs_create_u16() and the assignment (and
subsequent clamp to MAX_PORTS_IN_MANA_DEV), would a reader of the
num_vports debugfs file observe 0 rather than the hardware-reported
value?

Would it be clearer to create this file after ac->num_ports has been
assigned and clamped, so the exposed value matches what the commit
message describes as "Device configuration"?
-- 
pw-bot: cr

      reply	other threads:[~2026-05-02  0:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-30  7:53 [PATCH net-next v7] net: mana: Expose hardware diagnostic info via debugfs Erni Sri Satya Vennela
2026-05-02  0:54 ` Jakub Kicinski [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=20260502005409.3645108-1-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=decui@microsoft.com \
    --cc=dipayanroy@linux.microsoft.com \
    --cc=edumazet@google.com \
    --cc=ernis@linux.microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=horms@kernel.org \
    --cc=kees@kernel.org \
    --cc=kotaranov@microsoft.com \
    --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=shirazsaleem@microsoft.com \
    --cc=shradhagupta@linux.microsoft.com \
    --cc=wei.liu@kernel.org \
    --cc=yury.norov@gmail.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