Re: [PATCH rdma-next] RDMA/ipoib: Allow user space differentiate between valid dev_port

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, May 06, 2019 at 05:06:06PM +0300, Leon Romanovsky wrote:
> On Mon, May 06, 2019 at 04:45:34PM +0300, Gal Pressman wrote:
> > On 06-May-19 13:49, Leon Romanovsky wrote:
> > > On Mon, May 06, 2019 at 01:35:07PM +0300, Gal Pressman wrote:
> > >> On 06-May-19 13:21, Leon Romanovsky wrote:
> > >>> From: Leon Romanovsky <leonro@xxxxxxxxxxxx>
> > >>>
> > >>> Systemd triggers the following warning during IPoIB device load:
> > >>>
> > >>>  mlx5_core 0000:00:0c.0 ib0: "systemd-udevd" wants to know my dev_id.
> > >>>         Should it look at dev_port instead?
> > >>>         See Documentation/ABI/testing/sysfs-class-net for more info.
> > >>>
> > >>> This is caused due to user space attempt to differentiate old systems
> > >>> without dev_port and new systems with dev_port. In case dev_port will
> > >>> be zero, the systemd will try to read dev_id instead.
> > >>>
> > >>> There is no need to print a warning in such case, because it is valid
> > >>> situation and it is needed to ensure systemd compatibility with old
> > >>> kernels.
> > >>>
> > >>> Link: https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L358
> > >>> Cc: <stable@xxxxxxxxxxxxxxx> # 4.19
> > >>> Fixes: f6350da41dc7 ("IB/ipoib: Log sysfs 'dev_id' accesses from userspace")
> > >>> Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx>
> > >>>  drivers/infiniband/ulp/ipoib/ipoib_main.c | 12 +++++++++++-
> > >>>  1 file changed, 11 insertions(+), 1 deletion(-)
> > >>>
> > >>> diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
> > >>> index 48eda16db1a7..34e6495aa8c5 100644
> > >>> +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
> > >>> @@ -2402,7 +2402,17 @@ static ssize_t dev_id_show(struct device *dev,
> > >>>  {
> > >>>  	struct net_device *ndev = to_net_dev(dev);
> > >>>
> > >>> -	if (ndev->dev_id == ndev->dev_port)
> > >>> +	/*
> > >>> +	 * ndev->dev_port will be equal to 0 in old kernel prior to commit
> > >>> +	 * 9b8b2a323008 ("IB/ipoib: Use dev_port to expose network interface port numbers")
> > >>> +	 * Zero was chosen as special case for user space applications to fallback
> > >>> +	 * and query dev_id to check if it has different value or not.
> > >>> +	 *
> > >>> +	 * Don't pring warning in such scenario.
> > >>
> > >> "pring" -> "print".
> > >
> > > Are you ok with other changes and I can add your ROB tag?
> >
> > To my understanding, the test should be for just:
> > if (ndev->dev_port)
> >
> > As if dev_port is set then there's no reason to use dev_id, regardless of its value.
> > But I'm not really familiar with this flow..
> 
> It makes sense, but I'm not certain either.

The dev_id == dev_port thing makes no sense to me since the driver
always sets them equal on startup - is there some way for these values
to change outside the driver's control?

Jason




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux