All of lore.kernel.org
 help / color / mirror / Atom feed
* "ibstat -l" displays CA device list in an unsorted order
@ 2020-02-24 18:06 Haim Boozaglo
  2020-02-24 19:41 ` Jason Gunthorpe
  2020-02-25  7:48 ` Leon Romanovsky
  0 siblings, 2 replies; 20+ messages in thread
From: Haim Boozaglo @ 2020-02-24 18:06 UTC (permalink / raw)
  To: linux-rdma

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).

Best Regards,
Haim Boozaglo.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: "ibstat -l" displays CA device list in an unsorted order
  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-25  7:48 ` Leon Romanovsky
  1 sibling, 1 reply; 20+ messages in thread
From: Jason Gunthorpe @ 2020-02-24 19:41 UTC (permalink / raw)
  To: Haim Boozaglo; +Cc: linux-rdma

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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: "ibstat -l" displays CA device list in an unsorted order
  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  7:48 ` Leon Romanovsky
  2020-02-25  8:36   ` Haim Boozaglo
  1 sibling, 1 reply; 20+ messages in thread
From: Leon Romanovsky @ 2020-02-25  7:48 UTC (permalink / raw)
  To: Haim Boozaglo; +Cc: linux-rdma

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).

Do we have anything written in official man pages about this expectation?
I don't think so, there is nothing "to fix".

Thanks

>
> Best Regards,
> Haim Boozaglo.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: "ibstat -l" displays CA device list in an unsorted order
  2020-02-24 19:41 ` Jason Gunthorpe
@ 2020-02-25  8:25   ` Haim Boozaglo
  2020-02-26 13:43     ` Jason Gunthorpe
  0 siblings, 1 reply; 20+ messages in thread
From: Haim Boozaglo @ 2020-02-25  8:25 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: linux-rdma



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.

Thanks,
Haim.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: "ibstat -l" displays CA device list in an unsorted order
  2020-02-25  7:48 ` Leon Romanovsky
@ 2020-02-25  8:36   ` Haim Boozaglo
  2020-02-25  9:18     ` Leon Romanovsky
  0 siblings, 1 reply; 20+ messages in thread
From: Haim Boozaglo @ 2020-02-25  8:36 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: linux-rdma



On 2/25/2020 9:48 AM, Leon Romanovsky 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).
> 
> Do we have anything written in official man pages about this expectation?
> I don't think so, there is nothing "to fix".
> 
> Thanks
> 
>>
>> Best Regards,
>> Haim Boozaglo.

Ok, but for many years people got used to getting sorted output in 
alphabetical order and now they don't get it.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: "ibstat -l" displays CA device list in an unsorted order
  2020-02-25  8:36   ` Haim Boozaglo
@ 2020-02-25  9:18     ` Leon Romanovsky
  2020-02-25 17:18       ` Jens Domke
  0 siblings, 1 reply; 20+ messages in thread
From: Leon Romanovsky @ 2020-02-25  9:18 UTC (permalink / raw)
  To: Haim Boozaglo; +Cc: linux-rdma

On Tue, Feb 25, 2020 at 10:36:05AM +0200, Haim Boozaglo wrote:
>
>
> On 2/25/2020 9:48 AM, Leon Romanovsky 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).
> >
> > Do we have anything written in official man pages about this expectation?
> > I don't think so, there is nothing "to fix".
> >
> > Thanks
> >
> > >
> > > Best Regards,
> > > Haim Boozaglo.
>
> Ok, but for many years people got used to getting sorted output in
> alphabetical order and now they don't get it.

Like for many other things, those people will adapt.

Thanks

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: "ibstat -l" displays CA device list in an unsorted order
  2020-02-25  9:18     ` Leon Romanovsky
@ 2020-02-25 17:18       ` Jens Domke
  2020-02-25 19:43         ` Leon Romanovsky
  0 siblings, 1 reply; 20+ messages in thread
From: Jens Domke @ 2020-02-25 17:18 UTC (permalink / raw)
  To: Leon Romanovsky, Haim Boozaglo; +Cc: linux-rdma

Dear Leon,

with all due respect, but if you don't want to be part of the solution,
then please at least stop being part of the problem!

I (and highly likely many other admins out there who don't follow this
list) am in full support of Haim's request for sorted output.

Not everything can/will be pinned down in a manpage, but if you insist
then sure someone can submit a amendment to the ibstat documentation
which demands alphanumeric sorting for the NICs/ports.

Best,
Jens


On 2/25/20 6:18 PM, Leon Romanovsky wrote:
> On Tue, Feb 25, 2020 at 10:36:05AM +0200, Haim Boozaglo wrote:
>>
>>
>> On 2/25/2020 9:48 AM, Leon Romanovsky 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).
>>>
>>> Do we have anything written in official man pages about this expectation?
>>> I don't think so, there is nothing "to fix".
>>>
>>> Thanks
>>>
>>>>
>>>> Best Regards,
>>>> Haim Boozaglo.
>>
>> Ok, but for many years people got used to getting sorted output in
>> alphabetical order and now they don't get it.
> 
> Like for many other things, those people will adapt.
> 
> Thanks
> 

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: "ibstat -l" displays CA device list in an unsorted order
  2020-02-25 17:18       ` Jens Domke
@ 2020-02-25 19:43         ` Leon Romanovsky
  2020-02-26 13:42           ` Dennis Dalessandro
  0 siblings, 1 reply; 20+ messages in thread
From: Leon Romanovsky @ 2020-02-25 19:43 UTC (permalink / raw)
  To: Jens Domke; +Cc: Haim Boozaglo, linux-rdma

On Wed, Feb 26, 2020 at 02:18:06AM +0900, Jens Domke wrote:
> Dear Leon,
>
> with all due respect, but if you don't want to be part of the solution,
> then please at least stop being part of the problem!

To talk about solution, someone needs actually to convince that the
problem exists and right now we are talking about change in internal
implementation of pretty well explained feature - provide device list.

>
> I (and highly likely many other admins out there who don't follow this
> list) am in full support of Haim's request for sorted output.

I don't see any API or utils in the rdma-core which promised to provide
sorted output.

>
> Not everything can/will be pinned down in a manpage, but if you insist
> then sure someone can submit a amendment to the ibstat documentation
> which demands alphanumeric sorting for the NICs/ports.

The manual is not enough, what about other tools? Should we update them
too? Or do we need to make ibstat special while rest of the tools keep
the list unsorted?

Maybe I'm part of the problem, but any solution will require unified
approach for whole rdma-core, so users like you will get stable and
consistent result from any rdma-core API/tool.

Thanks

>
> Best,
> Jens
>
>
> On 2/25/20 6:18 PM, Leon Romanovsky wrote:
> > On Tue, Feb 25, 2020 at 10:36:05AM +0200, Haim Boozaglo wrote:
> > >
> > >
> > > On 2/25/2020 9:48 AM, Leon Romanovsky 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).
> > > >
> > > > Do we have anything written in official man pages about this expectation?
> > > > I don't think so, there is nothing "to fix".
> > > >
> > > > Thanks
> > > >
> > > > >
> > > > > Best Regards,
> > > > > Haim Boozaglo.
> > >
> > > Ok, but for many years people got used to getting sorted output in
> > > alphabetical order and now they don't get it.
> >
> > Like for many other things, those people will adapt.
> >
> > Thanks
> >

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: "ibstat -l" displays CA device list in an unsorted order
  2020-02-25 19:43         ` Leon Romanovsky
@ 2020-02-26 13:42           ` Dennis Dalessandro
  2020-02-26 13:56             ` Leon Romanovsky
  0 siblings, 1 reply; 20+ messages in thread
From: Dennis Dalessandro @ 2020-02-26 13:42 UTC (permalink / raw)
  To: Leon Romanovsky, Jens Domke; +Cc: Haim Boozaglo, linux-rdma

On 2/25/2020 2:43 PM, Leon Romanovsky wrote:
>> I (and highly likely many other admins out there who don't follow this
>> list) am in full support of Haim's request for sorted output.
> 
> I don't see any API or utils in the rdma-core which promised to provide
> sorted output.

That is true, but when sys admins count on things in a certain way and 
the rug gets pulled out from under them that's a headache at best.

>>
>> Not everything can/will be pinned down in a manpage, but if you insist
>> then sure someone can submit a amendment to the ibstat documentation
>> which demands alphanumeric sorting for the NICs/ports.
> 
> The manual is not enough, what about other tools? Should we update them
> too? Or do we need to make ibstat special while rest of the tools keep
> the list unsorted?
> 
> Maybe I'm part of the problem, but any solution will require unified
> approach for whole rdma-core, so users like you will get stable and
> consistent result from any rdma-core API/tool.

So am I understanding this right, the crux of the problem is the code 
switched from using scandir() via libibumad to readdir(). The later of 
which does not keep the same sorted order?

Maybe let's look at why the change was done in the first place rather 
than arguing over which way it should be. Is there a good reason to go 
with readdir() approach if so then maybe that out weights the 
inconvenience of not getting a sorted list. Or maybe it doesn't.

-Denny

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: "ibstat -l" displays CA device list in an unsorted order
  2020-02-25  8:25   ` Haim Boozaglo
@ 2020-02-26 13:43     ` Jason Gunthorpe
  2020-02-26 13:57       ` Leon Romanovsky
  0 siblings, 1 reply; 20+ messages in thread
From: Jason Gunthorpe @ 2020-02-26 13:43 UTC (permalink / raw)
  To: Haim Boozaglo; +Cc: linux-rdma

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?

Jason

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: "ibstat -l" displays CA device list in an unsorted order
  2020-02-26 13:42           ` Dennis Dalessandro
@ 2020-02-26 13:56             ` Leon Romanovsky
  0 siblings, 0 replies; 20+ messages in thread
From: Leon Romanovsky @ 2020-02-26 13:56 UTC (permalink / raw)
  To: Dennis Dalessandro; +Cc: Jens Domke, Haim Boozaglo, linux-rdma

On Wed, Feb 26, 2020 at 08:42:57AM -0500, Dennis Dalessandro wrote:
> On 2/25/2020 2:43 PM, Leon Romanovsky wrote:
> > > I (and highly likely many other admins out there who don't follow this
> > > list) am in full support of Haim's request for sorted output.
> >
> > I don't see any API or utils in the rdma-core which promised to provide
> > sorted output.
>
> That is true, but when sys admins count on things in a certain way and the
> rug gets pulled out from under them that's a headache at best.

I'm not arguing about that and really understand, just don't want people
to develop cargo cult around internal implementation of some tool.

>
> > >
> > > Not everything can/will be pinned down in a manpage, but if you insist
> > > then sure someone can submit a amendment to the ibstat documentation
> > > which demands alphanumeric sorting for the NICs/ports.
> >
> > The manual is not enough, what about other tools? Should we update them
> > too? Or do we need to make ibstat special while rest of the tools keep
> > the list unsorted?
> >
> > Maybe I'm part of the problem, but any solution will require unified
> > approach for whole rdma-core, so users like you will get stable and
> > consistent result from any rdma-core API/tool.
>
> So am I understanding this right, the crux of the problem is the code
> switched from using scandir() via libibumad to readdir(). The later of which
> does not keep the same sorted order?
>
> Maybe let's look at why the change was done in the first place rather than
> arguing over which way it should be. Is there a good reason to go with
> readdir() approach if so then maybe that out weights the inconvenience of
> not getting a sorted list. Or maybe it doesn't.

I sure that Jason will remember more details, but from my point of view,
everything started when we allowed to extend ibstat to look on sysfs
instead of implementing netlink discovery, which will change order
again.

Thanks

>
> -Denny

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: "ibstat -l" displays CA device list in an unsorted order
  2020-02-26 13:43     ` Jason Gunthorpe
@ 2020-02-26 13:57       ` Leon Romanovsky
  2020-02-26 17:09         ` Jason Gunthorpe
  0 siblings, 1 reply; 20+ messages in thread
From: Leon Romanovsky @ 2020-02-26 13:57 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: Haim Boozaglo, linux-rdma

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.

Thanks

>
> Jason

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: "ibstat -l" displays CA device list in an unsorted order
  2020-02-26 13:57       ` Leon Romanovsky
@ 2020-02-26 17:09         ` Jason Gunthorpe
  2020-02-27  7:48           ` Haim Boozaglo
  0 siblings, 1 reply; 20+ messages in thread
From: Jason Gunthorpe @ 2020-02-26 17:09 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: Haim Boozaglo, linux-rdma

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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: "ibstat -l" displays CA device list in an unsorted order
  2020-02-26 17:09         ` Jason Gunthorpe
@ 2020-02-27  7:48           ` Haim Boozaglo
  2020-02-27 12:49             ` Leon Romanovsky
  2020-02-27 13:33             ` Jason Gunthorpe
  0 siblings, 2 replies; 20+ messages in thread
From: Haim Boozaglo @ 2020-02-27  7:48 UTC (permalink / raw)
  To: Jason Gunthorpe, Leon Romanovsky; +Cc: linux-rdma



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.

Haim.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: "ibstat -l" displays CA device list in an unsorted order
  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:33             ` Jason Gunthorpe
  1 sibling, 1 reply; 20+ messages in thread
From: Leon Romanovsky @ 2020-02-27 12:49 UTC (permalink / raw)
  To: Haim Boozaglo; +Cc: Jason Gunthorpe, linux-rdma

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.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* RE: "ibstat -l" displays CA device list in an unsorted order
  2020-02-27 12:49             ` Leon Romanovsky
@ 2020-02-27 12:57               ` Vladimir Koushnir
  2020-02-27 13:59                 ` Leon Romanovsky
  0 siblings, 1 reply; 20+ messages in thread
From: Vladimir Koushnir @ 2020-02-27 12:57 UTC (permalink / raw)
  To: Leon Romanovsky, Haim Boozaglo; +Cc: Jason Gunthorpe, linux-rdma

Ibstat dumps the current status only.
It has nothing to do with hotplug.

-----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.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: "ibstat -l" displays CA device list in an unsorted order
  2020-02-27  7:48           ` Haim Boozaglo
  2020-02-27 12:49             ` Leon Romanovsky
@ 2020-02-27 13:33             ` Jason Gunthorpe
  2020-02-27 14:55               ` Dennis Dalessandro
  1 sibling, 1 reply; 20+ messages in thread
From: Jason Gunthorpe @ 2020-02-27 13:33 UTC (permalink / raw)
  To: Haim Boozaglo; +Cc: Leon Romanovsky, linux-rdma

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.

I'd rather not have to pay the sorting penalty for all users, it seems
only a few command line tools need the sort

Jason

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: "ibstat -l" displays CA device list in an unsorted order
  2020-02-27 12:57               ` Vladimir Koushnir
@ 2020-02-27 13:59                 ` Leon Romanovsky
  0 siblings, 0 replies; 20+ messages in thread
From: Leon Romanovsky @ 2020-02-27 13:59 UTC (permalink / raw)
  To: Vladimir Koushnir; +Cc: Haim Boozaglo, Jason Gunthorpe, linux-rdma

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.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: "ibstat -l" displays CA device list in an unsorted order
  2020-02-27 13:33             ` Jason Gunthorpe
@ 2020-02-27 14:55               ` Dennis Dalessandro
  2020-02-27 15:26                 ` Jason Gunthorpe
  0 siblings, 1 reply; 20+ messages in thread
From: Dennis Dalessandro @ 2020-02-27 14:55 UTC (permalink / raw)
  To: Jason Gunthorpe, Haim Boozaglo; +Cc: Leon Romanovsky, linux-rdma

On 2/27/2020 8:33 AM, Jason Gunthorpe wrote:
> 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.
> 
> I'd rather not have to pay the sorting penalty for all users, it seems
> only a few command line tools need the sort

Should we really go out on limb here and assume it's just a few CLI 
tools? What about all the sysadmin type scripts out there? We aren't 
having a good track record not breaking user space lately.

Is the sorting penalty really going to be that bad? It's not like we 
will have a large number of devices that sorting should really be an 
issue I wouldn't think.

-Denny





^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: "ibstat -l" displays CA device list in an unsorted order
  2020-02-27 14:55               ` Dennis Dalessandro
@ 2020-02-27 15:26                 ` Jason Gunthorpe
  0 siblings, 0 replies; 20+ messages in thread
From: Jason Gunthorpe @ 2020-02-27 15:26 UTC (permalink / raw)
  To: Dennis Dalessandro; +Cc: Haim Boozaglo, Leon Romanovsky, linux-rdma

On Thu, Feb 27, 2020 at 09:55:23AM -0500, Dennis Dalessandro wrote:
> > > I can just sort the list at the time of insertion of each node.
> > 
> > I'd rather not have to pay the sorting penalty for all users, it seems
> > only a few command line tools need the sort
> 
> Should we really go out on limb here and assume it's just a few CLI tools?
> What about all the sysadmin type scripts out there? We aren't having a good
> track record not breaking user space lately.

'sysadmin scripts' can't view the umad list without going through a
cli tool - so sorting the cli tools that show lists of device things
will take care of it.

verbs is has always been unsorted, so things like ibv_devinfo 
return in creation order. (which I think is a different random
ordering than it used to be)

This isn't the first time someone has complated about sorting, I
recall there was a complaint about ibv_get_device_list() too, but it
was never sorted. It just happened that sometimes it would be sorted
by some luck.

At least in the umad case it was actually always sorted before.

I think we should also sort ibv_devinfo too while we are here.

> Is the sorting penalty really going to be that bad? It's not like we will
> have a large number of devices that sorting should really be an issue I
> wouldn't think.

There are configurations where we have a large number of devices.

Jason

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2020-02-27 15:26 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.