Re: [PATCH net-next v2] octeontx2-af: Fix PCI device reference leaks in debugfs

From: Jakub Kicinski

Date: Thu Jun 11 2026 - 13:45:57 EST


On Thu, 11 Jun 2026 07:51:08 +0530 Ratheesh Kannoth wrote:
> > Review question sort of based on a Sashiko comment - this is part of
> > the rvu device driver, AFAIU, does anything prevent the AF from getting
> > removed (via sysfs for instance) while this code is using its priv?
>
> RVU AF driver's teardown sequence prevents the race here. In
> rvu_remove(), the very first call is rvu_dbg_exit(rvu),
> which calls debugfs_remove_recursive() on the debugfs root.
> ASFAIK, debugfs_remove_recursive() will block until all active
> readers (i.e., any in-progress seq_file read callbacks like
> cgx_print_stats(), cgx_print_dmac_flt(), and
> cgx_print_fwdata()) have completed before the removal
> proceeds. Only after rvu_dbg_exit() returns does
> rvu_remove() proceed to free the rvu structure.
>
> A better approach would be to pass the rvu object(rvu structure has pdev field) while
> creating the debugfs file itself, e.g.:
>
> RVU_DEBUG_SEQ_FOPS(cgx_dmac_flt, cgx_dmac_flt_display, s/NULL/rvu);
>
> This would eliminate the pci_get_device() lookup entirely. We
> will post this as a code clean-up patch to net-next.

Oh, that's much better, somehow I assumed that this dance is necessary
because we are accessing a different PCI device.

Also, since you're actively working upstream and nobody else on the CC
list responded - should you perhaps be added to maintainers for this
driver so that you're CCed on patches? (instead of one of the useless
ones)