ptp: ocp: Expose various resources on the timecard.
PATCH v4 1/1 ptp: ocp: Expose various resources on the timecard.
The OpenCompute timecard driver has additional functionality besides a clock. Make the following resources available:
- The external timestamp channels (ts0/ts1)
- devlink support for flashing and health reporting
- GPS and MAC serial ports
- board serial number (obtained from i2c device)
Also add watchdog functionality for when GNSS goes into holdover.
The resources are collected under a timecard class directory:
[jlemon@timecard ~]$ ls -g /sys/class/timecard/ocp1/ total 0
-r--r--r--. 1 root 4096 Aug 3 19:49 available_clock_sources -rw-r--r--. 1 root 4096 Aug 3 19:49 clock_source lrwxrwxrwx. 1 root 0 Aug 3 19:49 device -> ../../../0000:04:00.0/ -r--r--r--. 1 root 4096 Aug 3 19:49 gps_sync lrwxrwxrwx. 1 root 0 Aug 3 19:49 i2c -> ../../xiic-i2c.1024/i2c-2/ drwxr-xr-x. 2 root 0 Aug 3 19:49 power/ lrwxrwxrwx. 1 root 0 Aug 3 19:49 pps -> ../../../../../virtual/pps/pps1/ lrwxrwxrwx. 1 root 0 Aug 3 19:49 ptp -> ../../ptp/ptp2/ -r--r--r--. 1 root 4096 Aug 3 19:49 serialnum lrwxrwxrwx. 1 root 0 Aug 3 19:49 subsystem -> ../../../../../../class/timecard/ lrwxrwxrwx. 1 root 0 Aug 3 19:49 ttyGPS -> ../../tty/ttyS7/ lrwxrwxrwx. 1 root 0 Aug 3 19:49 ttyMAC -> ../../tty/ttyS8/ -rw-r--r--. 1 root 4096 Aug 3 19:39 uevent
The labeling is needed at the minimum, in order to tell the serial devices apart.
---
v4: change /proc/driver/ to /sys/class/timecard/
v3: fix missed warning: 0 -> NULL. Checked w/KCFLAGS=-W again.
v2: fix warnings.
drivers/ptp/Kconfig | 7 + drivers/ptp/ptp_ocp.c | 1385 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 1347 insertions(+), 45 deletions(-)
drivers/ptp/Kconfig +7 -0
@@ -157,6 +157,13 @@ config PTP_1588_CLOCK_OCP tristate "OpenCompute TimeCard as PTP clock" depends on PTP_1588_CLOCK depends on HAS_IOMEM && PCI + depends on SPI && I2C && MTD + imply SPI_MEM + imply SPI_XILINX + imply MTD_SPI_NOR + imply I2C_XILINX + select SERIAL_8250 + default n help This driver adds support for an OpenCompute time card.
drivers/ptp/ptp_ocp.c +1340 -45
1,539 lines not on this page · raw message
Signature · 1 line
2.31.1
Quoted 14 lines · Jonathan Lemon
The OpenCompute timecard driver has additional functionality besides a clock. Make the following resources available:
- The external timestamp channels (ts0/ts1)
- devlink support for flashing and health reporting
- GPS and MAC serial ports
- board serial number (obtained from i2c device)Also add watchdog functionality for when GNSS goes into holdover.
The resources are collected under a timecard class directory:
[jlemon@timecard ~]$ ls -g
/sys/class/timecard/ocp1/total 0
Quoted 15 lines
-r--r--r--. 1 root 4096 Aug 3 19:49 available_clock_sources -rw-r--r--. 1 root 4096 Aug 3 19:49 clock_source lrwxrwxrwx. 1 root 0 Aug 3 19:49 device -> ../../../0000:04:00.0/ -r--r--r--. 1 root 4096 Aug 3 19:49 gps_sync lrwxrwxrwx. 1 root 0 Aug 3 19:49 i2c -> ../../xiic-i2c.1024/i2c-2/ drwxr-xr-x. 2 root 0 Aug 3 19:49 power/ lrwxrwxrwx. 1 root 0 Aug 3 19:49 pps -> ../../../../../virtual/pps/pps1/ lrwxrwxrwx. 1 root 0 Aug 3 19:49 ptp -> ../../ptp/ptp2/ -r--r--r--. 1 root 4096 Aug 3 19:49 serialnum lrwxrwxrwx. 1 root 0 Aug 3 19:49 subsystem -> ../../../../../../class/timecard/ lrwxrwxrwx. 1 root 0 Aug 3 19:49 ttyGPS -> ../../tty/ttyS7/ lrwxrwxrwx. 1 root 0 Aug 3 19:49 ttyMAC -> ../../tty/ttyS8/ -rw-r--r--. 1 root 4096 Aug 3 19:39 uevent
I like this user friendly grouping.
kernel test robot
build botI love your patch! Yet something to improve:
Hi Jonathan,
I love your patch! Yet something to improve:
[auto build test ERROR on net-next/master]
url: https://github.com/0day-ci/linux/commits/Jonathan-Lemon/ptp-ocp-Expose-various-resources-on-the-timecard/20210804-114123 base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git b820c114eba7e105556429031656918ebdd50ab1 config: ia64-randconfig-r025-20210804 (attached as .config) compiler: ia64-linux-gcc (GCC) 10.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/2939bb01aaac0637e53647ee9108cd638e0504b8
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Jonathan-Lemon/ptp-ocp-Expose-various-resources-on-the-timecard/20210804-114123 git checkout 2939bb01aaac0637e53647ee9108cd638e0504b8
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=ia64
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>, old ones prefixed by <<):
ERROR: modpost: "devlink_health_reporter_create" [drivers/ptp/ptp_ocp.ko] undefined!
ERROR: modpost: "devlink_params_publish" [drivers/ptp/ptp_ocp.ko] undefined!
ERROR: modpost: "devlink_params_register" [drivers/ptp/ptp_ocp.ko] undefined!
ERROR: modpost: "devlink_register" [drivers/ptp/ptp_ocp.ko] undefined!
ERROR: modpost: "devlink_alloc_ns" [drivers/ptp/ptp_ocp.ko] undefined!
>> ERROR: modpost: "devlink_free" [drivers/ptp/ptp_ocp.ko] undefined! >> ERROR: modpost: "devlink_unregister" [drivers/ptp/ptp_ocp.ko] undefined! >> ERROR: modpost: "devlink_params_unregister" [drivers/ptp/ptp_ocp.ko] undefined! >> ERROR: modpost: "devlink_health_reporter_destroy" [drivers/ptp/ptp_ocp.ko] undefined! >> ERROR: modpost: "clk_hw_unregister_fixed_rate" [drivers/ptp/ptp_ocp.ko] undefined!
WARNING: modpost: suppressed 11 unresolved symbol warnings because there were too many)
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Jakub Kicinski
maintainerdrivers/ptp/ptp_ocp.c ptp_ocp_tod_info(struct ptp_ocp *bp) · line 742
Quoted 7 lines · On Tue, 3 Aug 2021 20:33:27 -0700 Jonathan Lemon wrote:
drivers/ptp/ptp_ocp.c +7
-0+static const struct devlink_param ptp_ocp_devlink_params[] = { +}; + +static void +ptp_ocp_devlink_set_params_init_values (struct devlink *devlink) +{ +}
Why register empty set of params?
Quoted 28 lines
drivers/ptp/ptp_ocp.c +27
-0+static int +ptp_ocp_devlink_register (struct devlink *devlink,struct device *dev) +{ +int err; + + err =devlink_register (devlink, dev); +if (err) +return err; + + err =devlink_params_register (devlink, ptp_ocp_devlink_params, +ARRAY_SIZE (ptp_ocp_devlink_params)); +ptp_ocp_devlink_set_params_init_values (devlink); +if (err) + goto out; +devlink_params_publish (devlink); + +return 0 ; + +out: +devlink_unregister (devlink); +return err; +} +static int +ptp_ocp_devlink_info_get (struct devlink *devlink,struct devlink_info_req *req, +struct netlink_ext_ack *extack) +{ +struct ptp_ocp *bp =devlink_priv (devlink);
drivers/ptp/ptp_ocp.c ptp_ocp_tod_info(struct ptp_ocp *bp) · line 877
Quoted 10 lines
drivers/ptp/ptp_ocp.c +10
-0+char buf[32 ]; +int err; + + err =devlink_info_driver_name_put (req,KBUILD_MODNAME ); +if (err) +return err; + +if (bp->pending_image) { + err =devlink_info_version_stored_put (req, +"timecard" ,"pending" );
"pending" is not a version. It seems you're talking to the flash directly, why not read the version?
Quoted 5 lines
drivers/ptp/ptp_ocp.c +5
-0+ } + +if (bp->image) { +u32 ver =ioread32 (&bp->image->version); +
drivers/ptp/ptp_ocp.c ptp_ocp_tod_info(struct ptp_ocp *bp) · line 894
Quoted 10 lines
drivers/ptp/ptp_ocp.c +10
-0+if (ver &0xffff ) { +sprintf (buf,"%d" , ver); + err =devlink_info_version_running_put (req, +"timecard" , + buf); + }else { +sprintf (buf,"%d" , ver >>16 ); + err =devlink_info_version_running_put (req, +"golden flash" , + buf);
What's the difference between "timecard" and "golden flash"? Why call firmware for a timecard timecard? We don't call NIC firmware "NIC".
Drivers using devlink should document what they implement and meaning of various fields. Please see examples in Documentation/networking/devlink/
Quoted 46 lines
drivers/ptp/ptp_ocp.c +45
-0+ } +if (err) +return err; + } +static int +ptp_ocp_health_diagnose (struct devlink_health_reporter *reporter, +struct devlink_fmsg *fmsg, +struct netlink_ext_ack *extack) +{ +struct ptp_ocp *bp =devlink_health_reporter_priv (reporter); +char buf[32 ]; +int err; + +if (!bp->gps_lost) +return 0 ; + +sprintf (buf,"%ptT" , &bp->gps_lost); + err =devlink_fmsg_string_pair_put (fmsg,"Lost sync at" , buf); +if (err) +return err; + +return 0 ; +} + +static void +ptp_ocp_health_update (struct ptp_ocp *bp) +{ +int state; + + state = bp->gps_lost ?DEVLINK_HEALTH_REPORTER_STATE_ERROR + :DEVLINK_HEALTH_REPORTER_STATE_HEALTHY ; + +if (bp->gps_lost) +devlink_health_report (bp->health,"No GPS signal" ,NULL ); + +devlink_health_reporter_state_update (bp->health, state); +} + +static const struct devlink_health_reporter_ops ptp_ocp_health_ops = { + .name ="gps_sync" , + .diagnose = ptp_ocp_health_diagnose, +}; + +static void +ptp_ocp_devlink_health_register (struct devlink *devlink)
drivers/ptp/ptp_ocp.c ptp_ocp_tod_info(struct ptp_ocp *bp) · line 968
Quoted 10 lines
drivers/ptp/ptp_ocp.c +10
-0+{ +struct ptp_ocp *bp =devlink_priv (devlink); +struct devlink_health_reporter *r; + + r =devlink_health_reporter_create (devlink, &ptp_ocp_health_ops,0 , bp); +if (IS_ERR (r)) +dev_err (&bp->pdev->dev,"Failed to create reporter, err %ld\n" , +PTR_ERR (r)); + bp->health = r; +}
What made you use devlink health here? Why not just print that "No GPS signal" message to the logs? Devlink health is supposed to give us meaningful context dumps and remediation, here neither is used.
Quoted 10 lines · Jakub Kicinski
drivers/ptp/ptp_ocp.c ptp_ocp_tod_info(struct ptp_ocp *bp) · line 742
Quoted 7 lines · On Tue, 3 Aug 2021 20:33:27 -0700 Jonathan Lemon wrote:
drivers/ptp/ptp_ocp.c +7
-0+static const struct devlink_param ptp_ocp_devlink_params[] = { +}; + +static void +ptp_ocp_devlink_set_params_init_values (struct devlink *devlink) +{ +}Why register empty set of params?
I had this filled out at some point, but they got removed.
Quoted 33 lines
Quoted 33 lines
drivers/ptp/ptp_ocp.c +32
-0+static int +ptp_ocp_devlink_register (struct devlink *devlink,struct device *dev) +{ +int err; + + err =devlink_register (devlink, dev); +if (err) +return err; + + err =devlink_params_register (devlink, ptp_ocp_devlink_params, +ARRAY_SIZE (ptp_ocp_devlink_params)); +ptp_ocp_devlink_set_params_init_values (devlink); +if (err) + goto out; +devlink_params_publish (devlink); + +return 0 ; + +out: +devlink_unregister (devlink); +return err; +} +static int +ptp_ocp_devlink_info_get (struct devlink *devlink,struct devlink_info_req *req, +struct netlink_ext_ack *extack) +{ +struct ptp_ocp *bp =devlink_priv (devlink); +char buf[32 ]; +int err; + + err =devlink_info_driver_name_put (req,KBUILD_MODNAME ); +if (err)
Quoted 8 lines
drivers/ptp/ptp_ocp.c ptp_ocp_tod_info(struct ptp_ocp *bp) · line 877
Quoted 5 lines
drivers/ptp/ptp_ocp.c +5
-0+return err; + +if (bp->pending_image) { + err =devlink_info_version_stored_put (req, +"timecard" ,"pending" );"pending" is not a version. It seems you're talking to the flash directly, why not read the version?
We're not talking to the flash yet. We're writing a new image, but don't know the image version, since it's not accessible from the FPGA blob. So since we're don't know what the stored image is until we reboot, I've set it to 'pending' here - aka "pending reboot". Could also be "unknown".
Quoted 9 lines
Quoted 9 lines
drivers/ptp/ptp_ocp.c +9
-0+ } + +if (bp->image) { +u32 ver =ioread32 (&bp->image->version); + +if (ver &0xffff ) { +sprintf (buf,"%d" , ver); + err = devlink_info_version_running_put(req, + "timecard",
Quoted 8 lines
drivers/ptp/ptp_ocp.c ptp_ocp_tod_info(struct ptp_ocp *bp) · line 894
Quoted 6 lines
drivers/ptp/ptp_ocp.c +6
-0+ buf); + }else { +sprintf (buf,"%d" , ver >>16 ); + err =devlink_info_version_running_put (req, +"golden flash" , + buf);What's the difference between "timecard" and "golden flash"?
There are two images stored in flash: "golden image", an image that just provides flash functionality, and the actual featured FPGA image.
Quoted 2 lines
Why call firmware for a timecard timecard? We don't call NIC firmware "NIC".
I didn't see a standard string to use. I can call it 'fw.version', just needed to differentiate it between the 'golden flash' loader and actual firmware.
Quoted 3 lines
Drivers using devlink should document what they implement and meaning of various fields. Please see examples in
Documentation/networking/devlink/
I'll add things there.
Quoted 8 lines
Quoted 8 lines
drivers/ptp/ptp_ocp.c +8
-0+static void +ptp_ocp_devlink_health_register (struct devlink *devlink) +{ +struct ptp_ocp *bp =devlink_priv (devlink); +struct devlink_health_reporter *r; + + r =devlink_health_reporter_create (devlink, &ptp_ocp_health_ops,0 , bp); +if (IS_ERR (r))
Quoted 8 lines
drivers/ptp/ptp_ocp.c ptp_ocp_tod_info(struct ptp_ocp *bp) · line 968
Quoted 4 lines
drivers/ptp/ptp_ocp.c +4
-0+dev_err (&bp->pdev->dev,"Failed to create reporter, err %ld\n" , +PTR_ERR (r)); + bp->health = r; +}What made you use devlink health here? Why not just print that "No GPS signal" message to the logs? Devlink health is supposed to give us meaningful context dumps and remediation, here neither is used.
The initial idea was to use 'devlink monitor' report the immediate failure of the GNSS signal (rather than going through the kernel logs) The 'devlink health' also keeps a count of how often the GPS signal is lost.
Our application guys decided to use a different monitoring method, so I can rip this out if objectionable.
Signature · 1 line
Jonathan
Jakub Kicinski
maintainerQuoted 19 lines · On Wed, 4 Aug 2021 16:52:23 -0700 Jonathan Lemon wrote:
Quoted 10 lines
Quoted 10 lines
drivers/ptp/ptp_ocp.c +10
-0+static int +ptp_ocp_devlink_info_get (struct devlink *devlink,struct devlink_info_req *req, +struct netlink_ext_ack *extack) +{ +struct ptp_ocp *bp =devlink_priv (devlink); +char buf[32 ]; +int err; + + err =devlink_info_driver_name_put (req,KBUILD_MODNAME ); +if (err)Quoted 8 lines
drivers/ptp/ptp_ocp.c ptp_ocp_tod_info(struct ptp_ocp *bp) · line 877
Quoted 5 lines
drivers/ptp/ptp_ocp.c +5
-0+return err; + +if (bp->pending_image) { + err =devlink_info_version_stored_put (req, +"timecard" ,"pending" );"pending" is not a version. It seems you're talking to the flash directly, why not read the version?
Quoted 4 lines
We're not talking to the flash yet. We're writing a new image, but don't know the image version, since it's not accessible from the FPGA blob. So since we're don't know what the stored image is until we reboot, I've set it to 'pending' here - aka "pending reboot". Could also be "unknown".
Having the driver remember that the device was flashed is not a solid indication that the image is actually different. It may be that user flashed the same version, driver may get reloaded and lose the indication.. Let's not make a precedent for (ab) use of the version field to indicate reset required.
Quoted 21 lines
Quoted 9 lines
Quoted 9 lines
drivers/ptp/ptp_ocp.c +9
-0+ } + +if (bp->image) { +u32 ver =ioread32 (&bp->image->version); + +if (ver &0xffff ) { +sprintf (buf,"%d" , ver); + err = devlink_info_version_running_put(req, + "timecard",Quoted 8 lines
drivers/ptp/ptp_ocp.c ptp_ocp_tod_info(struct ptp_ocp *bp) · line 894
Quoted 6 lines
drivers/ptp/ptp_ocp.c +6
-0+ buf); + }else { +sprintf (buf,"%d" , ver >>16 ); + err =devlink_info_version_running_put (req, +"golden flash" , + buf);What's the difference between "timecard" and "golden flash"?
There are two images stored in flash: "golden image", an image that just provides flash functionality, and the actual featured FPGA image.
Quoted 6 lines
Quoted 2 lines
Why call firmware for a timecard timecard? We don't call NIC firmware "NIC".
I didn't see a standard string to use. I can call it 'fw.version', just needed to differentiate it between the 'golden flash' loader and actual firmware.
Is the 'golden flash' a backup in case full featured image does not work or 'first stage' image/'loader'? IIUC it's the latter so maybe we can just use "loader"? "fw" for the actual image would be better than "fw.version" the entire string is a version after all.
Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
drivers/ptp/ptp_ocp.c +8
-0+static void +ptp_ocp_devlink_health_register (struct devlink *devlink) +{ +struct ptp_ocp *bp =devlink_priv (devlink); +struct devlink_health_reporter *r; + + r =devlink_health_reporter_create (devlink, &ptp_ocp_health_ops,0 , bp); +if (IS_ERR (r))Quoted 8 lines
drivers/ptp/ptp_ocp.c ptp_ocp_tod_info(struct ptp_ocp *bp) · line 968
Quoted 4 lines
drivers/ptp/ptp_ocp.c +4
-0+dev_err (&bp->pdev->dev,"Failed to create reporter, err %ld\n" , +PTR_ERR (r)); + bp->health = r; +}What made you use devlink health here? Why not just print that "No GPS signal" message to the logs? Devlink health is supposed to give us meaningful context dumps and remediation, here neither is used.
Quoted 7 lines
The initial idea was to use 'devlink monitor' report the immediate failure of the GNSS signal (rather than going through the kernel logs) The 'devlink health' also keeps a count of how often the GPS signal is lost.
Our application guys decided to use a different monitoring method, so I can rip this out if objectionable.
Great, thanks!
Quoted 25 lines · Jakub Kicinski
Quoted 19 lines · On Wed, 4 Aug 2021 16:52:23 -0700 Jonathan Lemon wrote:
Quoted 10 lines
Quoted 10 lines
drivers/ptp/ptp_ocp.c +10
-0+static int +ptp_ocp_devlink_info_get (struct devlink *devlink,struct devlink_info_req *req, +struct netlink_ext_ack *extack) +{ +struct ptp_ocp *bp =devlink_priv (devlink); +char buf[32 ]; +int err; + + err =devlink_info_driver_name_put (req,KBUILD_MODNAME ); +if (err)Quoted 8 lines
drivers/ptp/ptp_ocp.c ptp_ocp_tod_info(struct ptp_ocp *bp) · line 877
Quoted 5 lines
drivers/ptp/ptp_ocp.c +5
-0+return err; + +if (bp->pending_image) { + err =devlink_info_version_stored_put (req, +"timecard" ,"pending" );"pending" is not a version. It seems you're talking to the flash directly, why not read the version?
Quoted 4 lines
We're not talking to the flash yet. We're writing a new image, but don't know the image version, since it's not accessible from the FPGA blob. So since we're don't know what the stored image is until we reboot, I've set it to 'pending' here - aka "pending reboot". Could also be "unknown".
Quoted 5 lines
Having the driver remember that the device was flashed is not a solid indication that the image is actually different. It may be that user flashed the same version, driver may get reloaded and lose the indication.. Let's not make a precedent for (ab) use of the version field to indicate reset required.
I'd like to have some way to remind/tell the user that a reset is required.
Right now, I can only get the running version from the FPGA register, so after flashing, there's no way for me to know what's on the flash (or if the flash write failed). Setting "pending" or "reboot" works for most cases - but obviously fails if the driver is reloaded.
But most users won't do rmmod/insmod, just a reboot.
Quoted 24 lines
Quoted 24 lines
Quoted 9 lines
Quoted 9 lines
drivers/ptp/ptp_ocp.c +9
-0+ } + +if (bp->image) { +u32 ver =ioread32 (&bp->image->version); + +if (ver &0xffff ) { +sprintf (buf,"%d" , ver); + err = devlink_info_version_running_put(req, + "timecard",Quoted 8 lines
drivers/ptp/ptp_ocp.c ptp_ocp_tod_info(struct ptp_ocp *bp) · line 894
Quoted 6 lines
drivers/ptp/ptp_ocp.c +6
-0+ buf); + }else { +sprintf (buf,"%d" , ver >>16 ); + err =devlink_info_version_running_put (req, +"golden flash" , + buf);What's the difference between "timecard" and "golden flash"?
There are two images stored in flash: "golden image", an image that just provides flash functionality, and the actual featured FPGA image.
Quoted 2 lines
Why call firmware for a timecard timecard? We don't call NIC firmware "NIC".
Quoted 8 lines
Quoted 3 lines
I didn't see a standard string to use. I can call it 'fw.version', just needed to differentiate it between the 'golden flash' loader and actual firmware.
Is the 'golden flash' a backup in case full featured image does not work or 'first stage' image/'loader'? IIUC it's the latter so maybe we can just use "loader"? "fw" for the actual image would be better than "fw.version" the entire string is a version after all.
Undetermined. I believe that /currently/ it is the same image, but that is just happenstance. The vendor says the only functionality that the golden image guarantees is flashing - the rest of the FPGA may or may not work.
I'll use "fw" and "loader".
Quoted 26 lines
Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
drivers/ptp/ptp_ocp.c +8
-0+static void +ptp_ocp_devlink_health_register (struct devlink *devlink) +{ +struct ptp_ocp *bp =devlink_priv (devlink); +struct devlink_health_reporter *r; + + r =devlink_health_reporter_create (devlink, &ptp_ocp_health_ops,0 , bp); +if (IS_ERR (r))Quoted 8 lines
drivers/ptp/ptp_ocp.c ptp_ocp_tod_info(struct ptp_ocp *bp) · line 968
Quoted 4 lines
drivers/ptp/ptp_ocp.c +4
-0+dev_err (&bp->pdev->dev,"Failed to create reporter, err %ld\n" , +PTR_ERR (r)); + bp->health = r; +}What made you use devlink health here? Why not just print that "No GPS signal" message to the logs? Devlink health is supposed to give us meaningful context dumps and remediation, here neither is used.
Quoted 7 lines
The initial idea was to use 'devlink monitor' report the immediate failure of the GNSS signal (rather than going through the kernel logs) The 'devlink health' also keeps a count of how often the GPS signal is lost.
Our application guys decided to use a different monitoring method, so I can rip this out if objectionable.
Great, thanks!
Jakub Kicinski
maintainerQuoted 11 lines · On Thu, 5 Aug 2021 10:26:23 -0700 Jonathan Lemon wrote:
Quoted 10 lines
Quoted 4 lines
We're not talking to the flash yet. We're writing a new image, but don't know the image version, since it's not accessible from the FPGA blob. So since we're don't know what the stored image is until we reboot, I've set it to 'pending' here - aka "pending reboot". Could also be "unknown".
Having the driver remember that the device was flashed is not a solid indication that the image is actually different. It may be that user flashed the same version, driver may get reloaded and lose the indication.. Let's not make a precedent for (ab) use of the version field to indicate reset required.
Quoted 8 lines
I'd like to have some way to remind/tell the user that a reset is required.
Right now, I can only get the running version from the FPGA register, so after flashing, there's no way for me to know what's on the flash (or if the flash write failed). Setting "pending" or "reboot" works for most cases - but obviously fails if the driver is reloaded.
But most users won't do rmmod/insmod, just a reboot.
I appreciate the problem of knowing if FW activation is required exists but the way devlink API is intending to solve it is by displaying the actual versions. Version entries are for carrying versions, not arbitrary information.
If we assume driver does not get re-initialized / kernel kexeced etc. we can assume other things, like for example that nothing will mess with the filesystem. Ergo the flashing process can create a file in a well known location on the FS to indicate that reset is pending..