netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Andrew Lunn <andrew@lunn.ch>
Cc: davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com,
	pabeni@redhat.com, alexanderduyck@fb.com,
	Sanman Pradhan <sanman.p211993@gmail.com>
Subject: Re: [PATCH net-next 4/5] eth: fbnic: add PCIe hardware statistics
Date: Mon, 18 Nov 2024 07:35:01 -0800	[thread overview]
Message-ID: <20241118073501.4e44d114@kernel.org> (raw)
In-Reply-To: <1ed2ba1e-b87f-4738-9d72-da7c5a7180e2@lunn.ch>

On Sun, 17 Nov 2024 21:19:00 +0100 Andrew Lunn wrote:
> > +/* PUL User Registers*/
> > +#define FBNIC_PUL_USER_OB_RD_TLP_CNT_31_0 \
> > +					0x3106e		/* 0xc41b8 */  
> 
> Is there a comment somewhere which explains what these comments mean?
> Otherwise they appear to be useless magic numbers.

The number on the left is the number on the right divided by 4.
We index the registers as an array of u32s so the define is an index,
but for grep-ability we add the absolute address in the comment.

> > +static void fbnic_hw_stat_rst64(struct fbnic_dev *fbd, u32 reg, s32 offset,
> > +				struct fbnic_stat_counter *stat)
> > +{
> > +	/* Record initial counter values and compute deltas from there to ensure
> > +	 * stats start at 0 after reboot/reset. This avoids exposing absolute
> > +	 * hardware counter values to userspace.
> > +	 */
> > +	stat->u.old_reg_value_64 = fbnic_stat_rd64(fbd, reg, offset);  
> 
> I don't know how you use these stats, but now they are in debugfs, do
> they actually need to be 0 after reboot/reset? For most debugging
> performance issues with statistics, i want to know how much a counter
> goes up per second, so userspace will be reading the values twice with
> a sleep, and doing a subtractions anyway. So why not make the kernel
> code simpler?

Right, there is no strong reason to reset debugfs stats. OTOH
consistent behavior across all stats is nice (from rtnl stats 
to debugfs). And we will need the reset helpers for other stats.
Meta uses a lot of multi-host systems, the NIC is reset much
less often than the machines. Starting at 0 is convenient for 
manual debug.

  reply	other threads:[~2024-11-18 15:35 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-15  1:53 [PATCH net-next 0/5] eth: fbnic: cleanup and add a few stats Jakub Kicinski
2024-11-15  1:53 ` [PATCH net-next 1/5] eth: fbnic: add missing SPDX headers Jakub Kicinski
2024-11-17 20:09   ` Andrew Lunn
2024-11-18  3:55   ` Kalesh Anakkur Purayil
2024-11-15  1:53 ` [PATCH net-next 2/5] eth: fbnic: add missing header guards Jakub Kicinski
2024-11-17 20:10   ` Andrew Lunn
2024-11-18  3:55   ` Kalesh Anakkur Purayil
2024-11-15  1:53 ` [PATCH net-next 3/5] eth: fbnic: add basic debugfs structure Jakub Kicinski
2024-11-17 20:09   ` Andrew Lunn
2024-11-18  3:56   ` Kalesh Anakkur Purayil
2024-11-15  1:53 ` [PATCH net-next 4/5] eth: fbnic: add PCIe hardware statistics Jakub Kicinski
2024-11-17 20:19   ` Andrew Lunn
2024-11-18 15:35     ` Jakub Kicinski [this message]
2024-11-18 15:40       ` Andrew Lunn
2024-11-15  1:53 ` [PATCH net-next 5/5] eth: fbnic: add RPC " Jakub Kicinski
2024-11-17 20:24   ` Andrew Lunn
2024-11-19  3:00 ` [PATCH net-next 0/5] eth: fbnic: cleanup and add a few stats patchwork-bot+netdevbpf

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=20241118073501.4e44d114@kernel.org \
    --to=kuba@kernel.org \
    --cc=alexanderduyck@fb.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sanman.p211993@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;
as well as URLs for NNTP newsgroup(s).