All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Michael Margolin <mrgolin@amazon.com>
Cc: Gal Pressman <gal.pressman@linux.dev>,
	Jason Gunthorpe <jgg@nvidia.com>, Tom Sela <tomsela@amazon.com>,
	linux-rdma@vger.kernel.org, sleybo@amazon.com, matua@amazon.com,
	Yonatan Nachum <ynachum@amazon.com>
Subject: Re: [PATCH for-next] RDMA/efa: Add AH usage counter with sysfs exposure
Date: Mon, 16 Feb 2026 11:41:00 +0200	[thread overview]
Message-ID: <20260216094100.GE12989@unreal> (raw)
In-Reply-To: <20260216084819.GA23783@dev-dsk-mrgolin-1c-b2091117.eu-west-1.amazon.com>

On Mon, Feb 16, 2026 at 08:48:19AM +0000, Michael Margolin wrote:
> On Sun, Feb 15, 2026 at 07:15:43PM +0200, Leon Romanovsky wrote:
> > On Sun, Feb 15, 2026 at 01:41:22PM +0000, Michael Margolin wrote:
> > > On Thu, Feb 12, 2026 at 06:36:28PM +0200, Leon Romanovsky wrote:
> > > > On Thu, Feb 12, 2026 at 08:52:41AM +0200, Gal Pressman wrote:
> > > > > On 11/02/2026 15:13, Jason Gunthorpe wrote:
> > > > > > On Wed, Feb 11, 2026 at 01:10:48PM +0000, Tom Sela wrote:
> > > > > >> +static ssize_t ah_count_show(struct device *dev, struct device_attribute *attr, char *buf)
> > > > > >> +{
> > > > > >> +	struct efa_dev *efa_dev = pci_get_drvdata(to_pci_dev(dev));
> > > > > >> +
> > > > > >> +	return sysfs_emit(buf, "%lld\n", atomic64_read(&efa_dev->ah_count));
> > > > > >> +}
> > > > > >> +
> > > > > >> +static DEVICE_ATTR_RO(ah_count);
> > > > > >> +
> > > > > >> +int efa_sysfs_init(struct efa_dev *dev)
> > > > > >> +{
> > > > > >> +	struct device *device = &dev->pdev->dev;
> > > > > >> +
> > > > > >> +	if (device_create_file(device, &dev_attr_ah_count))
> > > > > >> +		dev_err(device, "Failed to create AH count sysfs file\n");
> > > > > > 
> > > > > > This is not the right way to use sysfs in rdma drivers.
> > > > > > 
> > > > > > Also we have netlink counters as the prefered approach why are you
> > > > > > using sysfs?
> > > > > 
> > > > > Yes, and EFA already supports stats reporting, the sysfs choice is strange..
> > > > > 
> > > > > BTW, isn't this something that can be added to restrack?
> > > > 
> > > > Unlikely. Most drivers that implement such counters were written long before
> > > > bpftrace became widely used. I don't think modern drivers should carry these
> > > > counters, as they are trivial to collect without requiring any kernel changes.
> > > > This is especially true for EFA, which does not support kverbs.
> > > > 
> > > > Thanks.
> > > 
> > > 
> > > This approach was selected since this case doesn't naturally fit any of
> > > the suggested ideas. It represents usage level of device AH objects
> > > which might be different than the number of kernel objects as usually
> > > covered by restrack count. Stats also doesn't seem as the right place
> > > for this.
> > 
> > How can the kernel and this new counter report a different number of AH
> > objects?
> 
> When application creates multiple AH objects for same peer, the device
> reuses the existing resource and returns its AH number. The new counter
> counts unique AH numbers thus represents the amount of device resources
> currently in use.

https://lore.kernel.org/all/20260215175707.GC12989@unreal

Thanks

  reply	other threads:[~2026-02-16  9:41 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-11 13:10 [PATCH for-next] RDMA/efa: Add AH usage counter with sysfs exposure Tom Sela
2026-02-11 13:13 ` Jason Gunthorpe
2026-02-12  6:52   ` Gal Pressman
2026-02-12 16:36     ` Leon Romanovsky
2026-02-15 13:41       ` Michael Margolin
2026-02-15 17:15         ` Leon Romanovsky
2026-02-15 17:23           ` Gal Pressman
2026-02-15 17:57             ` Leon Romanovsky
2026-02-16 11:08               ` Michael Margolin
2026-02-16 11:22                 ` Leon Romanovsky
2026-02-17 14:54                   ` Michael Margolin
2026-02-18  0:14                     ` Jason Gunthorpe
2026-02-18  9:15                       ` Leon Romanovsky
2026-02-18 17:27                         ` Michael Margolin
2026-02-16  8:48           ` Michael Margolin
2026-02-16  9:41             ` Leon Romanovsky [this message]
2026-02-11 18:48 ` yanjun.zhu
2026-02-12  6:52 ` Gal Pressman

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=20260216094100.GE12989@unreal \
    --to=leon@kernel.org \
    --cc=gal.pressman@linux.dev \
    --cc=jgg@nvidia.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=matua@amazon.com \
    --cc=mrgolin@amazon.com \
    --cc=sleybo@amazon.com \
    --cc=tomsela@amazon.com \
    --cc=ynachum@amazon.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.