IB/mlx5: give back valid speed/width even without plugged in SFP module
Hi,
----- Original Message -----
From: [email protected]
To: parav-VPRAkNaXOzVWk0Htik3J/[email protected], [email protected], matanb-VPRAkNaXOzVWk0Htik3J/[email protected], leonro-VPRAkNaXOzVWk0Htik3J/[email protected], [email protected], [email protected], [email protected]
Cc: [email protected]
Sent: Friday, October 27, 2017 2:30:33 PM GMT -08:00 US/Canada Pacific
Subject: Re: [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module
Quoted 21 lines · Parav Pandit
Quoted 13 lines
-----Original Message-----
From: Hal Rosenstock [mailto:[email protected]]
Sent: Friday, October 27, 2017 3:19 PM
To: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>; Thomas Bogendoerfer <[email protected]>; Matan Barak <matanb-VPRAkNaXOzVWk0Htik3J/[email protected]>; Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>; Doug Ledford <[email protected]>; [email protected]; [email protected]
Cc: Ghazale Hosseinabadi <[email protected]>
Subject: Re: [PATCH] IB/mlx5: give back valid speed/width even without plugged
in SFP moduleQuoted 8 lines
Quoted 1 line · Parav Pandit
However I believe that ibstat tool should be enhanced to report unknown port
speed instead of expecting drivers to supply some random number like this.
ibstat gets the rate from libibumad via /sys/class/infiniband/<IB device>/ports/<port number>/rate file which is supposed to be populated by the driver. Is there no rate file in this error case ?
Quoted 6 lines
<...>/<port_num>/rate file exist.
rate_show()has invalidactive_widthas expected due to nonexistence of SFP. So sysfs call return invalid value.
We don't haveinvalid_active_widthdefined right now.
So ibstat and other applications should not crash on such valid errors.
Agreed. I haven't seen ibstat crash reported though. Can someone provide the crash details ?
When running ibstat (if transceiver is not connected in adapter):
ibpanic: [7851] main: stat of IB device 'mlx5_1' failed: Invalid argument
Thanks,
Ghazale
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 3 lines · Ghazale Hosseinabadi
When running ibstat (if transceiver is not connected in adapter):
ibpanic: [7851] main: stat of IB device '
mlx5_1' failed: Invalid argument
Any output before that ? I'm trying to understand how far it gets. It looks to me that empty rate file would be parsed as 0 and ibstat would show that rate. ibpanic would occur if file was not found but I could be missing something.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 5 lines · Hal Rosenstock
Quoted 3 lines · Ghazale Hosseinabadi
When running ibstat (if transceiver is not connected in adapter):
ibpanic: [7851] main: stat of IB device '
mlx5_1' failed: Invalid argumentAny output before that ?
no, It only prints this line.
-- Ghazale
Quoted 5 lines
I'm trying to understand how far it gets. It
looks to me that empty rate file would be parsed as 0 and ibstat would show that rate. ibpanic would occur if file was not found but I could be missing something.
Quoted 10 lines · Ghazale Hosseinabadi
Quoted 6 lines · Hal Rosenstock
Quoted 4 lines · Ghazale Hosseinabadi
When running ibstat (if transceiver is not connected in adapter):
ibpanic: [7851] main: stat of IB device '
mlx5_1' failed: Invalid argumentAny output before that ?
no, It only prints this line.
and setting the width to 1x in the driver so the rate file is properly populated fixes this ? I must be missing something as to what is going on in this scenario.
sysfs.c:rate_show is inconsistent as it paves over an invalid speed setting that to SDR but does not pave over invalid width returning -EINVAL but this comment is in another "direction".
-- Hal
Quoted 9 lines
-- Ghazale
Quoted 5 lines
I'm trying to understand how far it gets. It
looks to me that empty rate file would be parsed as 0 and ibstat would show that rate. ibpanic would occur if file was not found but I could be missing something.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 7 lines · Hal Rosenstock
Quoted 6 lines · Ghazale Hosseinabadi
Quoted 3 lines · Hal Rosenstock
Quoted 2 lines · Ghazale Hosseinabadi
When running ibstat (if transceiver is not connected in adapter):
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
ibpanic: [7851] main: stat of IB device '
mlx5_1' failed: Invalid argumentAny output before that ?
no, It only prints this line.
and setting the width to 1x in the driver so the rate file is properly populated fixes this ? I must be missing something as to what is going on in this scenario.
[off list...]
Are you using libibumad or rdma-core package ? Which version ? What version of infiniband-diags are you using ?
Can you build from sources ?
I have patch to libibumad/rdma-core and another patch to ibstat (infiniband-diags) which I'd like you to try. Is that possible ?
Thanks.
-- Hal
Quoted 15 lines
sysfs.c:rate_show is inconsistent as it paves over an invalid speed setting that to SDR but does not pave over invalid width returning
-EINVALbut this comment is in another "direction".-- Hal
Quoted 9 lines
-- Ghazale
Quoted 5 lines
I'm trying to understand how far it gets. It
looks to me that empty rate file would be parsed as 0 and ibstat would show that rate. ibpanic would occur if file was not found but I could be missing something.
Quoted 9 lines · Hal Rosenstock
Quoted 8 lines · Hal Rosenstock
Quoted 7 lines · Ghazale Hosseinabadi
Quoted 5 lines · Hal Rosenstock
Quoted 4 lines · Ghazale Hosseinabadi
When running ibstat (if transceiver is not connected in adapter):
ibpanic: [7851] main: stat of IB device '
mlx5_1' failed: Invalid argument
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Quoted 1 line
Any output before that ?
no, It only prints this line.
and setting the width to 1x in the driver so the rate file is properly populated fixes this ? I must be missing something as to what is going on in this scenario.
[off list...]
Are you using libibumad or rdma-core package ?
rdma-core
Quoted 1 line
Which version ?
rdma-core-13-25
Quoted 1 line
What version of infiniband-diags are you using ?
infiniband-diags-1.6.7-1
Quoted 3 lines
Can you build from sources ?
I have patch to libibumad/rdma-core and another patch to ibstat (infiniband-diags) which I'd like you to try. Is that possible ?
I haven't built user-land packages myself, but I can definitely try it. Please send me the patches and I will try to build.
Thanks,
Ghazale
Quoted 18 lines
Thanks.
-- Hal
Quoted 13 lines
sysfs.c:rate_show is inconsistent as it paves over an invalid speed setting that to SDR but does not pave over invalid width returning
-EINVALbut this comment is in another "direction".-- Hal
Quoted 7 lines
-- Ghazale
Quoted 5 lines
I'm trying to understand how far it gets. It
looks to me that empty rate file would be parsed as 0 and ibstat would show that rate. ibpanic would occur if file was not found but I could be missing something.
Quoted 4 lines · Hal Rosenstock
Quoted 3 lines · Ghazale Hosseinabadi
Quoted 1 line · Hal Rosenstock
On 10/27/2017 5:54 PM, Ghazale Hosseinabadi wrote:
Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines
When running ibstat (if transceiver is not connected in adapter):
ibpanic: [7851] main: stat of IB device '
mlx5_1' failed: Invalid argumentAny output before that ?
no, It only prints this line.
and setting the width to 1x in the driver so the rate file is properly populated fixes this ?
Yes, because a value is written in /sys/class/infiniband/mlx5_X/ports/1/rate
Quoted 2 lines
I must be missing something as to what is going
on in this scenario.
Without this bug fix, file /sys/class/infiniband/mlx5_X/ports/1/rate is empty, which results in ibpanic.
-- Ghazale
Quoted 14 lines
sysfs.c:rate_show is inconsistent as it paves over an invalid speed setting that to SDR but does not pave over invalid width returning
-EINVALbut this comment is in another "direction".-- Hal
Quoted 7 lines
-- Ghazale
Quoted 5 lines
I'm trying to understand how far it gets. It
looks to me that empty rate file would be parsed as 0 and ibstat would show that rate. ibpanic would occur if file was not found but I could be missing something.
Quoted 11 lines · On Fri, 27 Oct 2017 19:19:05 -0400 Hal Rosenstock…
Quoted 10 lines · Ghazale Hosseinabadi
Quoted 6 lines · Hal Rosenstock
Quoted 4 lines · Ghazale Hosseinabadi
When running ibstat (if transceiver is not connected in adapter):
ibpanic: [7851] main: stat of IB device '
mlx5_1' failed: Invalid argumentAny output before that ?
no, It only prints this line.
rate_show() generates an EINVAL, that's propably what ibstat/*libs confuses.
Quoted 2 lines
and setting the width to 1x in the driver so the rate file is properly populated fixes this ?
yes, because then rate_show() will not return EINVAL.
Quoted 5 lines
I must be missing something as to what is going on in this scenario.
sysfs.c:rate_show is inconsistent as it paves over an invalid speed setting that to SDR but does not pave over invalid width returning
-EINVALbut this comment is in another "direction".
I thought about going in the other direction by making the speed/width unknown case somehow visible in rate_show(). When I checked all other drivers only mlx5 stand out so I decided to only change mlx5. But I make a change to let rate_show() print out, that is currently has no rate for the port.
Thomas.
Signature · 5 lines
Thomas Bogendoerfer <[email protected]> -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 1 line · Thomas Bogendoerfer
Quoted 1 line
I must be missing something as to what is going on in this scenario.
I think I see what's going on now. The -EINVAL in kernel sysfs/rate_show causes error to either open or read of file. I had checked that an empty file is parsed correctly but didn't consider an error on open or read.
Quoted 7 lines
Quoted 3 lines
sysfs.c:rate_show is inconsistent as it paves over an invalid speed setting that to SDR but does not pave over invalid width returning
-EINVALbut this comment is in another "direction".I thought about going in the other direction by making the speed/width unknown case somehow visible in
rate_show(). When I checked all other drivers only mlx5 stand out so I decided to only change mlx5. But I make a change to letrate_show()print out, that is currently has no rate for the port.
I wasn't proposing to make that visible in rate_show() but rather pointing out the inconsistency in changing unknown speeds to SDR but unknown widths are error. There were comments on not having to set "random" numbers for speed/width. If so, shouldn't these be handled consistently here ? Would setting -EINVAL when not one of recognized speeds cause an issue (rather than setting to SDR) ?
IMO a more future proof implementation is not to have error for ib_width_enum_to_int but have unknown widths default to 1x similar to how unknown speeds default to SDR:
include/rdma/ib_verbs.h:
static inline int ib_width_enum_to_int(enum ib_port_width width)
{
switch (width) {
case IB_WIDTH_1X: return 1;
case IB_WIDTH_4X: return 4;
case IB_WIDTH_8X: return 8;
case IB_WIDTH_12X: return 12;
default: return 1;
}
}For example, 2x link widths have been added to IBA spec.
This is alternative approach to libibumad/ibstat patches for invalid link width as it's not set when QSFP is not plugged into port.
-- Hal