linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Vladimir Koushnir <vladimirk@mellanox.com>
Cc: Haim Boozaglo <haimbo@mellanox.com>,
	Jason Gunthorpe <jgg@ziepe.ca>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>
Subject: Re: "ibstat -l" displays CA device list in an unsorted order
Date: Thu, 27 Feb 2020 15:59:29 +0200	[thread overview]
Message-ID: <20200227135929.GM12414@unreal> (raw)
In-Reply-To: <DBAPR05MB70932DD7E5FC7DCDD71543A3CEEB0@DBAPR05MB7093.eurprd05.prod.outlook.com>

On Thu, Feb 27, 2020 at 12:57:31PM +0000, Vladimir Koushnir wrote:
> Ibstat dumps the current status only.
> It has nothing to do with hotplug.

Of course, print has nothing to do with hotplug, but we are talking
about general function to sort linked list of already existing devices.
The idea to sort such list in insertion means that every hotplug event
will reshuffle the list.

Thanks

>
> -----Original Message-----
> From: linux-rdma-owner@vger.kernel.org <linux-rdma-owner@vger.kernel.org> On Behalf Of Leon Romanovsky
> Sent: Thursday, February 27, 2020 2:50 PM
> To: Haim Boozaglo <haimbo@mellanox.com>
> Cc: Jason Gunthorpe <jgg@ziepe.ca>; linux-rdma@vger.kernel.org
> Subject: Re: "ibstat -l" displays CA device list in an unsorted order
>
> On Thu, Feb 27, 2020 at 09:48:45AM +0200, Haim Boozaglo wrote:
> >
> >
> > On 2/26/2020 7:09 PM, Jason Gunthorpe wrote:
> > > On Wed, Feb 26, 2020 at 03:57:49PM +0200, Leon Romanovsky wrote:
> > > > On Wed, Feb 26, 2020 at 09:43:10AM -0400, Jason Gunthorpe wrote:
> > > > > On Tue, Feb 25, 2020 at 10:25:49AM +0200, Haim Boozaglo wrote:
> > > > > >
> > > > > >
> > > > > > On 2/24/2020 9:41 PM, Jason Gunthorpe wrote:
> > > > > > > On Mon, Feb 24, 2020 at 08:06:56PM +0200, Haim Boozaglo wrote:
> > > > > > > > Hi all,
> > > > > > > >
> > > > > > > > When running "ibstat" or "ibstat -l", the output of CA
> > > > > > > > device list is displayed in an unsorted order.
> > > > > > > >
> > > > > > > > Before pull request #561, ibstat displayed the CA device
> > > > > > > > list sorted in alphabetical order.
> > > > > > > >
> > > > > > > > The problem is that users expect to have the output sorted
> > > > > > > > in alphabetical order and now they get it not as expected (in an unsorted order).
> > > > > > >
> > > > > > > Really? Why? That doesn't look like it should happen, the
> > > > > > > list is constructed out of readdir() which should be sorted?
> > > > > > >
> > > > > > > Do you know where this comes from?
> > > > > > >
> > > > > > > Jason
> > > > > > >
> > > > > >
> > > > > > readdir() gives us struct by struct and doesn't keep on alphabetical order.
> > > > > > Before pull request #561 ibstat have used this API of libibumad:
> > > > > > int umad_get_cas_names(char cas[][UMAD_CA_NAME_LEN], int max)
> > > > > >
> > > > > > This API used this function:
> > > > > > n = scandir(SYS_INFINIBAND, &namelist, NULL, alphasort);
> > > > > >
> > > > > > scandir() can return a sorted CA device list in alphabetical order.
> > > > >
> > > > > Oh what a weird unintended side effect.
> > > > >
> > > > > Resolving it would require adding a sorting pass on a linked
> > > > > list.. Will you try?
> > > >
> > > > Please be aware that once ibstat will be converted to netlink, the
> > > > order will change again.
> > >
> > > This is why I suggest a function to sort the linked list that tools
> > > needing sorted order can call. Then it doesn't matter how we got the
> > > list
> > >
> > > Jason
> > >
> >
> > I can just sort the list at the time of insertion of each node.
>
> Will you "resort" your list in the hotplug event?
>
> Thanks
>
> >
> > Haim.

  reply	other threads:[~2020-02-27 13:59 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-24 18:06 "ibstat -l" displays CA device list in an unsorted order Haim Boozaglo
2020-02-24 19:41 ` Jason Gunthorpe
2020-02-25  8:25   ` Haim Boozaglo
2020-02-26 13:43     ` Jason Gunthorpe
2020-02-26 13:57       ` Leon Romanovsky
2020-02-26 17:09         ` Jason Gunthorpe
2020-02-27  7:48           ` Haim Boozaglo
2020-02-27 12:49             ` Leon Romanovsky
2020-02-27 12:57               ` Vladimir Koushnir
2020-02-27 13:59                 ` Leon Romanovsky [this message]
2020-02-27 13:33             ` Jason Gunthorpe
2020-02-27 14:55               ` Dennis Dalessandro
2020-02-27 15:26                 ` Jason Gunthorpe
2020-02-25  7:48 ` Leon Romanovsky
2020-02-25  8:36   ` Haim Boozaglo
2020-02-25  9:18     ` Leon Romanovsky
2020-02-25 17:18       ` Jens Domke
2020-02-25 19:43         ` Leon Romanovsky
2020-02-26 13:42           ` Dennis Dalessandro
2020-02-26 13:56             ` Leon Romanovsky

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=20200227135929.GM12414@unreal \
    --to=leon@kernel.org \
    --cc=haimbo@mellanox.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-rdma@vger.kernel.org \
    --cc=vladimirk@mellanox.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).