<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/infiniband/core/device.c, branch linux-4.20.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.20.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.20.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2019-02-12T19:02:10Z</updated>
<entry>
<title>RDMA/core: Sync unregistration with netlink commands</title>
<updated>2019-02-12T19:02:10Z</updated>
<author>
<name>Parav Pandit</name>
</author>
<published>2018-11-16T01:50:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f9acb02096f0a8927029a1861cc6b143ac9b8f0c'/>
<id>urn:sha1:f9acb02096f0a8927029a1861cc6b143ac9b8f0c</id>
<content type='text'>
[ Upstream commit 01b671170d7f82b959dad6d5dbb44d7a915e647d ]

When the rdma device is getting removed, get resource info can race with
device removal, as below:

      CPU-0                                  CPU-1
    --------                               --------
    rdma_nl_rcv_msg()
       nldev_res_get_cq_dumpit()
          mutex_lock(device_lock);
          get device reference
          mutex_unlock(device_lock);        [..]
                                            ib_unregister_device()
                                            /* Valid reference to
                                             * device-&gt;dev exists.
                                             */
                                             ib_dealloc_device()

          [..]
          provider-&gt;fill_res_entry();

Even though device object is not freed, fill_res_entry() can get called on
device which doesn't have a driver anymore. Kernel core device reference
count is not sufficient, as this only keeps the structure valid, and
doesn't guarantee the driver is still loaded.

Similar race can occur with device renaming and device removal, where
device_rename() tries to rename a unregistered device. While this is fine
for devices of a class which are not net namespace aware, but it is
incorrect for net namespace aware class coming in subsequent series.  If a
class is net namespace aware, then the below [1] call trace is observed in
above situation.

Therefore, to avoid the race, keep a reference count and let device
unregistration wait until all netlink users drop the reference.

[1] Call trace:
kernfs: ns required in 'infiniband' for 'mlx5_0'
WARNING: CPU: 18 PID: 44270 at fs/kernfs/dir.c:842 kernfs_find_ns+0x104/0x120
libahci i2c_core mlxfw libata dca [last unloaded: devlink]
RIP: 0010:kernfs_find_ns+0x104/0x120
Call Trace:
kernfs_find_and_get_ns+0x2e/0x50
sysfs_rename_link_ns+0x40/0xb0
device_rename+0xb2/0xf0
ib_device_rename+0xb3/0x100 [ib_core]
nldev_set_doit+0x165/0x190 [ib_core]
rdma_nl_rcv_msg+0x249/0x250 [ib_core]
? netlink_deliver_tap+0x8f/0x3e0
rdma_nl_rcv+0xd6/0x120 [ib_core]
netlink_unicast+0x17c/0x230
netlink_sendmsg+0x2f0/0x3e0
sock_sendmsg+0x30/0x40
__sys_sendto+0xdc/0x160

Fixes: da5c85078215 ("RDMA/nldev: add driver-specific resource tracking")
Signed-off-by: Parav Pandit &lt;parav@mellanox.com&gt;
Signed-off-by: Leon Romanovsky &lt;leonro@mellanox.com&gt;
Signed-off-by: Jason Gunthorpe &lt;jgg@mellanox.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>RDMA/core: Refactor ib_register_device() function</title>
<updated>2018-10-17T15:43:07Z</updated>
<author>
<name>Parav Pandit</name>
</author>
<published>2018-10-17T10:20:20Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=548cb4fbe80d68b9d1b8b30aca179636e74bec36'/>
<id>urn:sha1:548cb4fbe80d68b9d1b8b30aca179636e74bec36</id>
<content type='text'>
ib_register_device() does several allocation and initialization
steps. Split it into smaller more readable functions for easy
review and maintenance.

Signed-off-by: Parav Pandit &lt;parav@mellanox.com&gt;
Reviewed-by: Daniel Jurgens &lt;danielj@mellanox.com&gt;
Signed-off-by: Leon Romanovsky &lt;leonro@mellanox.com&gt;
Signed-off-by: Doug Ledford &lt;dledford@redhat.com&gt;
</content>
</entry>
<entry>
<title>RDMA/core: Fix unwinding flow in case of error to register device</title>
<updated>2018-10-17T15:43:07Z</updated>
<author>
<name>Parav Pandit</name>
</author>
<published>2018-10-17T10:19:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=67fecaf8e9cc28812042f61194ac0e0a9737f897'/>
<id>urn:sha1:67fecaf8e9cc28812042f61194ac0e0a9737f897</id>
<content type='text'>
If port pkey list initialization fails, free the port_immutable memory
during cleanup path. Currently it is missed out.

If cache setup fails, free the pkey list during cleanup path.

Fixes: d291f1a65 ("IB/core: Enforce PKey security on QPs")
Signed-off-by: Parav Pandit &lt;parav@mellanox.com&gt;
Reviewed-by: Daniel Jurgens &lt;danielj@mellanox.com&gt;
Signed-off-by: Leon Romanovsky &lt;leonro@mellanox.com&gt;
Signed-off-by: Doug Ledford &lt;dledford@redhat.com&gt;
</content>
</entry>
<entry>
<title>RDMA/core: Implement IB device rename function</title>
<updated>2018-10-16T17:37:16Z</updated>
<author>
<name>Leon Romanovsky</name>
</author>
<published>2018-10-10T06:19:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d21943dd19b5c79dc09bb0e8bf80cd5ee09c41c2'/>
<id>urn:sha1:d21943dd19b5c79dc09bb0e8bf80cd5ee09c41c2</id>
<content type='text'>
Generic implementation of IB device rename function.

Signed-off-by: Leon Romanovsky &lt;leonro@mellanox.com&gt;
Signed-off-by: Doug Ledford &lt;dledford@redhat.com&gt;
</content>
</entry>
<entry>
<title>RDMA/core: Use dev_name instead of ibdev-&gt;name</title>
<updated>2018-09-26T19:51:48Z</updated>
<author>
<name>Jason Gunthorpe</name>
</author>
<published>2018-09-20T22:42:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=896de0090a85f4c3a2b37fc0f46215a73c5b5429'/>
<id>urn:sha1:896de0090a85f4c3a2b37fc0f46215a73c5b5429</id>
<content type='text'>
These return the same thing but dev_name is a more conventional use of the
kernel API.

Signed-off-by: Jason Gunthorpe &lt;jgg@mellanox.com&gt;
Reviewed-by: Steve Wise &lt;swise@opengridcomputing.com&gt;
Reviewed-by: Leon Romanovsky &lt;leonro@mellanox.com&gt;
Reviewed-by: Dennis Dalessandro &lt;dennis.dalessandro@intel.com&gt;
</content>
</entry>
<entry>
<title>RDMA/core: Use dev_err/dbg/etc instead of pr_* + ibdev-&gt;name</title>
<updated>2018-09-26T19:51:48Z</updated>
<author>
<name>Jason Gunthorpe</name>
</author>
<published>2018-09-20T22:42:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=43c7c851b9bce9e6091f2c882871a3b388aa38c3'/>
<id>urn:sha1:43c7c851b9bce9e6091f2c882871a3b388aa38c3</id>
<content type='text'>
Any messages related to a device should be printed with the dev_*
formatters. This provides greater consistency for the user.

The core does not set pr_fmt so this has no significant change.

Signed-off-by: Jason Gunthorpe &lt;jgg@mellanox.com&gt;
Reviewed-by: Steve Wise &lt;swise@opengridcomputing.com&gt;
Reviewed-by: Leon Romanovsky &lt;leonro@mellanox.com&gt;
Reviewed-by: Dennis Dalessandro &lt;dennis.dalessandro@intel.com&gt;
</content>
</entry>
<entry>
<title>RDMA: Fully setup the device name in ib_register_device</title>
<updated>2018-09-26T19:51:36Z</updated>
<author>
<name>Jason Gunthorpe</name>
</author>
<published>2018-09-25T22:58:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e349f858d29f300ad9ad327fd57735a1d15e147f'/>
<id>urn:sha1:e349f858d29f300ad9ad327fd57735a1d15e147f</id>
<content type='text'>
The current code has two copies of the device name, ibdev-&gt;dev and
dev_name(&amp;ibdev-&gt;dev), and they are setup at different times, which is
very confusing.

Set them both up at the same time and make dev_name() the lead name, which
is the proper use of the driver core APIs. To make it very clear that the
name is not valid until registration pass it in to the
ib_register_device() call rather than messing with ibdev-&gt;name directly.

Also the reorganization now checks that dev_name is unique even if it does
not contain a %.

Signed-off-by: Jason Gunthorpe &lt;jgg@mellanox.com&gt;
Acked-by: Adit Ranadive &lt;aditr@vmware.com&gt;
Reviewed-by: Steve Wise &lt;swise@opengridcomputing.com&gt;
Acked-by: Devesh Sharma &lt;devesh.sharma@broadcom.com&gt;
Reviewed-by: Shiraz Saleem &lt;shiraz.saleem@intel.com&gt;
Reviewed-by: Leon Romanovsky &lt;leonro@mellanox.com&gt;
Reviewed-by: Dennis Dalessandro &lt;dennis.dalessandro@intel.com&gt;
Reviewed-by: Michael J. Ruhl &lt;michael.j.ruhl@intel.com&gt;
</content>
</entry>
<entry>
<title>RDMA/core: Assign device ifindex before publishing the device</title>
<updated>2018-09-06T20:34:38Z</updated>
<author>
<name>Parav Pandit</name>
</author>
<published>2018-09-06T07:58:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=273993509f05623934dda14a56237738149b2906'/>
<id>urn:sha1:273993509f05623934dda14a56237738149b2906</id>
<content type='text'>
Even though device-&gt;ifindex is assigned before adding the device in the
list which is read by netlink flow, it is better to assign rdma device
index before publishing the device in the system to users and clients.

Signed-off-by: Parav Pandit &lt;parav@mellanox.com&gt;
Reviewed-by: Daniel Jurgens &lt;danielj@mellanox.com&gt;
Signed-off-by: Leon Romanovsky &lt;leonro@mellanox.com&gt;
Signed-off-by: Jason Gunthorpe &lt;jgg@mellanox.com&gt;
</content>
</entry>
<entry>
<title>RDMA/core: Follow correct unregister order between sysfs and cgroup</title>
<updated>2018-09-06T20:32:21Z</updated>
<author>
<name>Parav Pandit</name>
</author>
<published>2018-09-06T07:55:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c715a39541bb399eb03d728a996b224d90ce1336'/>
<id>urn:sha1:c715a39541bb399eb03d728a996b224d90ce1336</id>
<content type='text'>
During register_device() init sequence is,
(a) register with rdma cgroup followed by
(b) register with sysfs

Therefore, unregister_device() sequence should follow the reverse order.

Signed-off-by: Parav Pandit &lt;parav@mellanox.com&gt;
Reviewed-by: Daniel Jurgens &lt;danielj@mellanox.com&gt;
Signed-off-by: Leon Romanovsky &lt;leonro@mellanox.com&gt;
Signed-off-by: Jason Gunthorpe &lt;jgg@mellanox.com&gt;
</content>
</entry>
<entry>
<title>RDMA/core: Define client_data_lock as rwlock instead of spinlock</title>
<updated>2018-09-06T19:45:38Z</updated>
<author>
<name>Parav Pandit</name>
</author>
<published>2018-08-28T12:08:45Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e1f540c3ed0e9634d0f8c4600f3c85df8aff4ae2'/>
<id>urn:sha1:e1f540c3ed0e9634d0f8c4600f3c85df8aff4ae2</id>
<content type='text'>
Even though device registration/unregistration and client
registration/unregistration is not a performance path, define the
client_data_lock as rwlock for code clarity.

Signed-off-by: Parav Pandit &lt;parav@mellanox.com&gt;
Reviewed-by: Daniel Jurgens &lt;danielj@mellanox.com&gt;
Signed-off-by: Leon Romanovsky &lt;leonro@mellanox.com&gt;
Signed-off-by: Jason Gunthorpe &lt;jgg@mellanox.com&gt;
</content>
</entry>
</feed>
