Re: [PATCH 037/190] Revert "RDMA/core: Fix several reference count leaks."

Jason Gunthorpe
2021-05-03T18:30:57Z

On Thu, Apr 29, 2021 at 03:38:41PM +0200, Greg Kroah-Hartman wrote:
> On Wed, Apr 28, 2021 at 10:00:44AM -0300, Jason Gunthorpe wrote:
> > On Wed, Apr 28, 2021 at 02:23:40PM +0200, Greg Kroah-Hartman wrote:
> >
> > > > We've talked about this specifically before:
> > > >
> > > > http://lore.kernel.org/r/20210331170720.GY2710221@ziepe.ca
> > > >
> > > > I still don't understand what you mean by "udev sees it properly", as
> > > > above, all the tests I thought of look OK.
> > >
> > > Can you query the udev database to see the attribute values?
> >
> > It appears so unless I misunderstand your ask:
> >
> > $ udevadm info -a /sys/class/infiniband/ibp0s9
> > ATTR{ports/1/cm_rx_duplicates/dreq}=="0"
>
> That works? Nice, I didn't think it did.
>
> But what about the uevent that fired for "1", isn't there attibutes
> assigned to it that udev ignores?

I'm not completely familiar with uevents, but:

$ find /sys/class/infiniband/ibp0s9/ -name "uevent"
/sys/class/infiniband/ibp0s9/uevent

$ udevadm monitor & modprobe mlx5_ib
KERNEL[169.337295] add /bus/auxiliary/drivers/mlx5_ib.multiport (drivers)
UDEV [169.354621] add /bus/auxiliary/drivers/mlx5_ib.multiport (drivers)
KERNEL[169.393088] add /devices/pci0000:00/0000:00:09.0/infiniband_verbs/uverbs0 (infiniband_verbs)
KERNEL[169.393516] add /devices/pci0000:00/0000:00:09.0/infiniband_mad/umad0 (infiniband_mad)
KERNEL[169.394040] add /devices/pci0000:00/0000:00:09.0/infiniband_mad/issm0 (infiniband_mad)
UDEV [169.395189] add /devices/pci0000:00/0000:00:09.0/infiniband_verbs/uverbs0 (infiniband_verbs)
UDEV [169.397812] add /devices/pci0000:00/0000:00:09.0/infiniband_mad/issm0 (infiniband_mad)
KERNEL[169.407727] add /devices/pci0000:00/0000:00:09.0/net/ib0 (net)
KERNEL[169.407851] add /devices/pci0000:00/0000:00:09.0/net/ib0/queues/rx-0 (queues)
KERNEL[169.408113] add /devices/pci0000:00/0000:00:09.0/net/ib0/queues/tx-0 (queues)
KERNEL[169.409059] add /devices/pci0000:00/0000:00:09.0/infiniband/mlx5_0 (infiniband)
KERNEL[169.411483] bind /devices/pci0000:00/0000:00:09.0/mlx5_core.rdma.0 (auxiliary)
KERNEL[169.411836] add /bus/auxiliary/drivers/mlx5_ib.rdma (drivers)
KERNEL[169.411973] add /module/mlx5_ib (module)
UDEV [169.420570] bind /devices/pci0000:00/0000:00:09.0/mlx5_core.rdma.0 (auxiliary)
UDEV [169.421365] add /bus/auxiliary/drivers/mlx5_ib.rdma (drivers)
UDEV [169.447853] add /module/mlx5_ib (module)
KERNEL[169.482293] move /devices/pci0000:00/0000:00:09.0/infiniband/ibp0s9 (infiniband)
UDEV [169.486395] add /devices/pci0000:00/0000:00:09.0/infiniband/mlx5_0 (infiniband)
UDEV [169.495193] move /devices/pci0000:00/0000:00:09.0/infiniband/ibp0s9 (infiniband)
UDEV [169.698592] add /devices/pci0000:00/0000:00:09.0/net/ib0 (net)
UDEV [169.700436] add /devices/pci0000:00/0000:00:09.0/net/ib0/queues/rx-0 (queues)
UDEV [169.700712] add /devices/pci0000:00/0000:00:09.0/net/ib0/queues/tx-0 (queues)
UDEV [170.042132] add /devices/pci0000:00/0000:00:09.0/infiniband_mad/umad0 (infiniband_mad)

I don't see any uevents related to the nested attributes. Same on
removal.

As far I can tell udev is working perfectly fine with 4 levels of
attributes..

> Placing a raw kobject below a struct device breaks the "device tree"
> model. You now have devices with an arbritrary number of levels deep
> set of attributes, making it impossible to determine all attributes for
> a device in a simple way.

Since udev is able to determine the attributes, does this mean at some
point it abandoned the simple way and is now doing something complex?

Jason