Skip to contentSkip to conversation

devlink: cleanups and move devlink health functionality to separate file

PATCH Superseded Moshe Shemesh 3 participants 19 messages Feb 13, 2023 – Feb 14, 2023

Subsystems (5)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#1 lore raw

PATCH 1/10 devlink: Split out health reporter create code

In reply to Moshe Shemesh

Move devlink health reporter create/destroy and related dev code to new file health.c. This file shall include all callbacks and functionality that are related to devlink health. No functional change in this patch.

---
 net/devlink/Makefile        |   2 +-
 net/devlink/devl_internal.h |  28 +++++
 net/devlink/health.c        | 196 +++++++++++++++++++++++++++++++++
 net/devlink/leftover.c      | 209 +-----------------------------------
 4 files changed, 226 insertions(+), 209 deletions(-)
 create mode 100644 net/devlink/health.c
net/devlink/Makefile +1 -1
index daad4521c61e..ef91a76646a3 100644
@@ -1,3 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0
 
-obj-y := leftover.o core.o netlink.o dev.o
+obj-y := leftover.o core.o netlink.o dev.o health.o
net/devlink/devl_internal.h +28 -0
index 2f4820e40d27..49fe9e2dae34 100644
@@ -198,6 +198,34 @@ int devlink_resources_validate(struct devlink *devlink,
 			       struct devlink_resource *resource,
 			       struct genl_info *info);
 
+/* Health */
+struct devlink_health_reporter {
+	struct list_head list;
+	void *priv;
+	const struct devlink_health_reporter_ops *ops;
+	struct devlink *devlink;
+	struct devlink_port *devlink_port;
+	struct devlink_fmsg *dump_fmsg;
+	struct mutex dump_lock; /* lock parallel read/write from dump buffers */
+	u64 graceful_period;
+	bool auto_recover;
+	bool auto_dump;
+	u8 health_state;
+	u64 dump_ts;
+	u64 dump_real_ts;
+	u64 error_count;
+	u64 recovery_count;
+	u64 last_recovery_ts;
+};
+
+struct devlink_health_reporter *
+devlink_health_reporter_find_by_name(struct devlink *devlink,
+				     const char *reporter_name);
+struct devlink_health_reporter *
+devlink_port_health_reporter_find_by_name(struct devlink_port *devlink_port,
+					  const char *reporter_name);
+void devlink_fmsg_free(struct devlink_fmsg *fmsg);
+
 /* Line cards */
 struct devlink_linecard;
 
net/devlink/health.c new file +196 -0

196 lines not on this page · raw message

net/devlink/leftover.c +1 -208

221 lines not on this page · raw message

Signature · 1 line
2.27.0
#7 lore raw

PATCH 3/10 devlink: Move devlink health get and set code to health file

In reply to Moshe Shemesh

Move devlink health get and set callbacks and related code from leftover.c to health.c. No functional change in this patch.

---
 net/devlink/devl_internal.h |  18 +++
 net/devlink/health.c        | 214 +++++++++++++++++++++++++++++++++++
 net/devlink/leftover.c      | 219 +-----------------------------------
 3 files changed, 234 insertions(+), 217 deletions(-)
net/devlink/devl_internal.h +18 -0
index 49fe9e2dae34..085f80b5feb8 100644
@@ -176,6 +176,8 @@ int devlink_port_netdevice_event(struct notifier_block *nb,
 
 struct devlink_port *
 devlink_port_get_from_info(struct devlink *devlink, struct genl_info *info);
+struct devlink_port *devlink_port_get_from_attrs(struct devlink *devlink,
+						 struct nlattr **attrs);
 
 /* Reload */
 bool devlink_reload_actions_valid(const struct devlink_ops *ops);
@@ -224,6 +226,18 @@ devlink_health_reporter_find_by_name(struct devlink *devlink,
 struct devlink_health_reporter *
 devlink_port_health_reporter_find_by_name(struct devlink_port *devlink_port,
 					  const char *reporter_name);
+struct devlink_health_reporter *
+devlink_health_reporter_get_from_attrs(struct devlink *devlink,
+				       struct nlattr **attrs);
+struct devlink_health_reporter *
+devlink_health_reporter_get_from_info(struct devlink *devlink,
+				      struct genl_info *info);
+int
+devlink_nl_health_reporter_fill(struct sk_buff *msg,
+				struct devlink_health_reporter *reporter,
+				enum devlink_command cmd, u32 portid,
+				u32 seq, int flags);
+
 void devlink_fmsg_free(struct devlink_fmsg *fmsg);
 
 /* Line cards */
@@ -249,3 +263,7 @@ int devlink_nl_cmd_info_get_doit(struct sk_buff *skb, struct genl_info *info);
 int devlink_nl_cmd_flash_update(struct sk_buff *skb, struct genl_info *info);
 int devlink_nl_cmd_selftests_get_doit(struct sk_buff *skb, struct genl_info *info);
 int devlink_nl_cmd_selftests_run(struct sk_buff *skb, struct genl_info *info);
+int devlink_nl_cmd_health_reporter_get_doit(struct sk_buff *skb,
+					    struct genl_info *info);
+int devlink_nl_cmd_health_reporter_set_doit(struct sk_buff *skb,
+					    struct genl_info *info);
net/devlink/health.c +214 -0

217 lines not on this page · raw message

net/devlink/leftover.c +2 -217

243 lines not on this page · raw message

Signature · 1 line
2.27.0
#8 lore raw

PATCH 4/10 devlink: health: Don't try to add trace with NULL msg

In reply to Moshe Shemesh

In case devlink_health_report() msg argument is NULL a warning is triggered, but then continue and try to print a trace with NULL pointer.

Fix it to skip trace call if msg pointer is NULL.

---
 net/devlink/leftover.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/devlink/leftover.c +2 -2
index 0b1c5e0122f3..bc72d80141cf 100644
@@ -6077,8 +6077,8 @@ int devlink_health_report(struct devlink_health_reporter *reporter,
 	int ret;
 
 	/* write a log message of the current error */
-	WARN_ON(!msg);
-	trace_devlink_health_report(devlink, reporter->ops->name, msg);
+	if (!WARN_ON(!msg))
+		trace_devlink_health_report(devlink, reporter->ops->name, msg);
 	reporter->error_count++;
 	prev_health_state = reporter->health_state;
 	reporter->health_state = DEVLINK_HEALTH_REPORTER_STATE_ERROR;
Signature · 1 line
2.27.0
#0 lore raw

cover devlink: cleanups and move devlink health functionality to separate file

This patchset moves devlink health callbacks, helpers and related code from leftover.c to new file health.c. About 1.3K LoC are moved by this patchset, covering all devlink health functionality.

In addition this patchset includes a couple of small cleanups in devlink health code and documentation update.

Moshe Shemesh (10):
devlink: Split out health reporter create code
devlink: health: Fix nla_nest_end in error flow
devlink: Move devlink health get and set code to health file
devlink: health: Don't try to add trace with NULL msg
devlink: Move devlink health report and recover to health file
devlink: Move devlink fmsg and health diagnose to health file
devlink: Move devlink health dump to health file
devlink: Move devlink health test to health file
devlink: Move health common function to health file
devlink: Update devlink health documentation

 .../networking/devlink/devlink-health.rst     |   23 +-
 net/devlink/Makefile                          |    2 +-
 net/devlink/devl_internal.h                   |   16 +
 net/devlink/health.c                          | 1333 +++++++++++++++++
 net/devlink/leftover.c                        | 1330 +---------------
 5 files changed, 1373 insertions(+), 1331 deletions(-)
 create mode 100644 net/devlink/health.c
Signature · 1 line
2.27.0
#4 lore raw

PATCH 2/10 devlink: health: Fix nla_nest_end in error flow

devlink_nl_health_reporter_fill() error flow calls nla_nest_end(). Fix it to call nla_nest_cancel() instead.

---
 net/devlink/leftover.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/devlink/leftover.c +1 -1
index cfd1b90a0fc1..90f95f06de28 100644
@@ -6028,7 +6028,7 @@ devlink_nl_health_reporter_fill(struct sk_buff *msg,
 	return 0;
 
 reporter_nest_cancel:
-	nla_nest_end(msg, reporter_attr);
+	nla_nest_cancel(msg, reporter_attr);
 genlmsg_cancel:
 	genlmsg_cancel(msg, hdr);
 	return -EMSGSIZE;
Signature · 1 line
2.27.0
#11 lore raw

PATCH 5/10 devlink: Move devlink health report and recover to health file

In reply to Moshe Shemesh

Move devlink health report helper and recover callback and related code from leftover.c to health.c. No functional change in this patch.

---
 net/devlink/devl_internal.h |   5 ++
 net/devlink/health.c        | 136 ++++++++++++++++++++++++++++++++++
 net/devlink/leftover.c      | 141 +-----------------------------------
 3 files changed, 144 insertions(+), 138 deletions(-)
net/devlink/devl_internal.h +5 -0
index 085f80b5feb8..d1a901cb5900 100644
@@ -237,6 +237,9 @@ devlink_nl_health_reporter_fill(struct sk_buff *msg,
 				struct devlink_health_reporter *reporter,
 				enum devlink_command cmd, u32 portid,
 				u32 seq, int flags);
+int devlink_health_do_dump(struct devlink_health_reporter *reporter,
+			   void *priv_ctx,
+			   struct netlink_ext_ack *extack);
 
 void devlink_fmsg_free(struct devlink_fmsg *fmsg);
 
@@ -267,3 +270,5 @@ int devlink_nl_cmd_health_reporter_get_doit(struct sk_buff *skb,
 					    struct genl_info *info);
 int devlink_nl_cmd_health_reporter_set_doit(struct sk_buff *skb,
 					    struct genl_info *info);
+int devlink_nl_cmd_health_reporter_recover_doit(struct sk_buff *skb,
+						struct genl_info *info);
net/devlink/health.c +136 -0

145 lines not on this page · raw message

net/devlink/leftover.c +3 -138

165 lines not on this page · raw message

Signature · 1 line
2.27.0
#12 lore raw

PATCH 6/10 devlink: Move devlink fmsg and health diagnose to health file

In reply to Moshe Shemesh

Devlink fmsg (formatted message) is used by devlink health diagnose, dump and drivers which support these devlink health callbacks. Therefore, move devlink fmsg helpers and related code to file health.c. Move devlink health diagnose to file health.c. No functional change in this patch.

---
 net/devlink/devl_internal.h |   6 +
 net/devlink/health.c        | 630 ++++++++++++++++++++++++++++++++++++
 net/devlink/leftover.c      | 630 ------------------------------------
 3 files changed, 636 insertions(+), 630 deletions(-)
net/devlink/devl_internal.h +6 -0
index d1a901cb5900..a4b96f8a0ab4 100644
@@ -240,7 +240,11 @@ devlink_nl_health_reporter_fill(struct sk_buff *msg,
 int devlink_health_do_dump(struct devlink_health_reporter *reporter,
 			   void *priv_ctx,
 			   struct netlink_ext_ack *extack);
+int devlink_fmsg_dumpit(struct devlink_fmsg *fmsg, struct sk_buff *skb,
+			struct netlink_callback *cb,
+			enum devlink_command cmd);
 
+struct devlink_fmsg *devlink_fmsg_alloc(void);
 void devlink_fmsg_free(struct devlink_fmsg *fmsg);
 
 /* Line cards */
@@ -272,3 +276,5 @@ int devlink_nl_cmd_health_reporter_set_doit(struct sk_buff *skb,
 					    struct genl_info *info);
 int devlink_nl_cmd_health_reporter_recover_doit(struct sk_buff *skb,
 						struct genl_info *info);
+int devlink_nl_cmd_health_reporter_diagnose_doit(struct sk_buff *skb,
+						 struct genl_info *info);
net/devlink/health.c +630 -0

639 lines not on this page · raw message

net/devlink/leftover.c +0 -630

642 lines not on this page · raw message

Signature · 1 line
2.27.0
#13 lore raw

PATCH 7/10 devlink: Move devlink health dump to health file

In reply to Moshe Shemesh

Move devlink health report dump callbacks and related code from leftover.c to health.c. No functional change in this patch.

---
 net/devlink/devl_internal.h |   4 ++
 net/devlink/health.c        | 122 +++++++++++++++++++++++++++++++++++
 net/devlink/leftover.c      | 123 ------------------------------------
 3 files changed, 126 insertions(+), 123 deletions(-)
net/devlink/devl_internal.h +4 -0
index a4b96f8a0ab4..ae7229742d66 100644
@@ -278,3 +278,7 @@ int devlink_nl_cmd_health_reporter_recover_doit(struct sk_buff *skb,
 						struct genl_info *info);
 int devlink_nl_cmd_health_reporter_diagnose_doit(struct sk_buff *skb,
 						 struct genl_info *info);
+int devlink_nl_cmd_health_reporter_dump_get_dumpit(struct sk_buff *skb,
+						   struct netlink_callback *cb);
+int devlink_nl_cmd_health_reporter_dump_clear_doit(struct sk_buff *skb,
+						   struct genl_info *info);
net/devlink/health.c +122 -0

137 lines not on this page · raw message

net/devlink/leftover.c +0 -123

129 lines not on this page · raw message

Signature · 1 line
2.27.0
#14 lore raw

PATCH 8/10 devlink: Move devlink health test to health file

In reply to Moshe Shemesh

Move devlink health report test callback from leftover.c to health.c. No functional change in this patch.

---
 net/devlink/devl_internal.h |  2 ++
 net/devlink/health.c        | 16 ++++++++++++++++
 net/devlink/leftover.c      | 16 ----------------
 3 files changed, 18 insertions(+), 16 deletions(-)
net/devlink/devl_internal.h +2 -0
index ae7229742d66..211f7ea38d6a 100644
@@ -282,3 +282,5 @@ int devlink_nl_cmd_health_reporter_dump_get_dumpit(struct sk_buff *skb,
 						   struct netlink_callback *cb);
 int devlink_nl_cmd_health_reporter_dump_clear_doit(struct sk_buff *skb,
 						   struct genl_info *info);
+int devlink_nl_cmd_health_reporter_test_doit(struct sk_buff *skb,
+					     struct genl_info *info);
net/devlink/health.c +16 -0
index 0080eb442a4e..3ebd531dee8a 100644
@@ -1296,3 +1296,19 @@ int devlink_nl_cmd_health_reporter_dump_clear_doit(struct sk_buff *skb,
 	mutex_unlock(&reporter->dump_lock);
 	return 0;
 }
+
+int devlink_nl_cmd_health_reporter_test_doit(struct sk_buff *skb,
+					     struct genl_info *info)
+{
+	struct devlink *devlink = info->user_ptr[0];
+	struct devlink_health_reporter *reporter;
+
+	reporter = devlink_health_reporter_get_from_info(devlink, info);
+	if (!reporter)
+		return -EINVAL;
+
+	if (!reporter->ops->test)
+		return -EOPNOTSUPP;
+
+	return reporter->ops->test(reporter, info->extack);
+}
net/devlink/leftover.c +0 -16
index 55be664d14ad..dffca2f9bfa7 100644
@@ -5372,22 +5372,6 @@ static int devlink_nl_cmd_region_read_dumpit(struct sk_buff *skb,
 	return err;
 }
 
-static int devlink_nl_cmd_health_reporter_test_doit(struct sk_buff *skb,
-						    struct genl_info *info)
-{
-	struct devlink *devlink = info->user_ptr[0];
-	struct devlink_health_reporter *reporter;
-
-	reporter = devlink_health_reporter_get_from_info(devlink, info);
-	if (!reporter)
-		return -EINVAL;
-
-	if (!reporter->ops->test)
-		return -EOPNOTSUPP;
-
-	return reporter->ops->test(reporter, info->extack);
-}
-
 struct devlink_stats {
 	u64_stats_t rx_bytes;
 	u64_stats_t rx_packets;
Signature · 1 line
2.27.0
#15 lore raw

PATCH 9/10 devlink: Move health common function to health file

In reply to Moshe Shemesh

Now that all devlink health callbacks and related code are in file health.c move common health functions and devlink_health_reporter struct to be local in health.c file.

---
 net/devlink/devl_internal.h | 47 -------------------------------------
 net/devlink/health.c        | 45 +++++++++++++++++++++++++----------
 2 files changed, 32 insertions(+), 60 deletions(-)
net/devlink/devl_internal.h +0 -47
index 211f7ea38d6a..e133f423294a 100644
@@ -200,53 +200,6 @@ int devlink_resources_validate(struct devlink *devlink,
 			       struct devlink_resource *resource,
 			       struct genl_info *info);
 
-/* Health */
-struct devlink_health_reporter {
-	struct list_head list;
-	void *priv;
-	const struct devlink_health_reporter_ops *ops;
-	struct devlink *devlink;
-	struct devlink_port *devlink_port;
-	struct devlink_fmsg *dump_fmsg;
-	struct mutex dump_lock; /* lock parallel read/write from dump buffers */
-	u64 graceful_period;
-	bool auto_recover;
-	bool auto_dump;
-	u8 health_state;
-	u64 dump_ts;
-	u64 dump_real_ts;
-	u64 error_count;
-	u64 recovery_count;
-	u64 last_recovery_ts;
-};
-
-struct devlink_health_reporter *
-devlink_health_reporter_find_by_name(struct devlink *devlink,
-				     const char *reporter_name);
-struct devlink_health_reporter *
-devlink_port_health_reporter_find_by_name(struct devlink_port *devlink_port,
-					  const char *reporter_name);
-struct devlink_health_reporter *
-devlink_health_reporter_get_from_attrs(struct devlink *devlink,
-				       struct nlattr **attrs);
-struct devlink_health_reporter *
-devlink_health_reporter_get_from_info(struct devlink *devlink,
-				      struct genl_info *info);
-int
-devlink_nl_health_reporter_fill(struct sk_buff *msg,
-				struct devlink_health_reporter *reporter,
-				enum devlink_command cmd, u32 portid,
-				u32 seq, int flags);
-int devlink_health_do_dump(struct devlink_health_reporter *reporter,
-			   void *priv_ctx,
-			   struct netlink_ext_ack *extack);
-int devlink_fmsg_dumpit(struct devlink_fmsg *fmsg, struct sk_buff *skb,
-			struct netlink_callback *cb,
-			enum devlink_command cmd);
-
-struct devlink_fmsg *devlink_fmsg_alloc(void);
-void devlink_fmsg_free(struct devlink_fmsg *fmsg);
-
 /* Line cards */
 struct devlink_linecard;
 
net/devlink/health.c +32 -13

105 lines not on this page · raw message

Signature · 1 line
2.27.0
#16 lore raw

PATCH 10/10 devlink: Update devlink health documentation

In reply to Moshe Shemesh

Update devlink-health.rst file:
- Add devlink formatted message (fmsg) API documentation.
- Add auto-dump as a condition to do dump once error reported.
- Expand OOB to clarify this acronym.

---
 .../networking/devlink/devlink-health.rst     | 23 +++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)
Documentation/networking/devlink/devlink-health.rst +21 -2
index e37f77734b5b..e0b8cfed610a 100644
@@ -33,7 +33,7 @@ Device driver can provide specific callbacks for each "health reporter", e.g.:
   * Recovery procedures
   * Diagnostics procedures
   * Object dump procedures
-  * OOB initial parameters
+  * Out Of Box initial parameters
 
 Different parts of the driver can register different types of health reporters
 with different handlers.
@@ -46,12 +46,31 @@ Once an error is reported, devlink health will perform the following actions:
   * A log is being send to the kernel trace events buffer
   * Health status and statistics are being updated for the reporter instance
   * Object dump is being taken and saved at the reporter instance (as long as
-    there is no other dump which is already stored)
+    auto-dump is set and there is no other dump which is already stored)
   * Auto recovery attempt is being done. Depends on:
 
     - Auto-recovery configuration
     - Grace period vs. time passed since last recover
 
+Devlink formatted message
+=========================
+
+To handle devlink health diagnose and health dump requests, devlink creates a
+formatted message structure ``devlink_fmsg`` and send it to the driver's callback
+to fill the data in using the devlink fmsg API.
+
+Devlink fmsg is a mechanism to pass descriptors between drivers and devlink, in
+json-like format. The API allows the driver to add nested attributes such as
+object, object pair and value array, in addition to attributes such as name and
+value.
+
+Driver should use this API to fill the fmsg context in a format which will be
+translated by the devlink to the netlink message later. When it needs to send
+the data using SKBs to the netlink layer, it fragments the data between
+different SKBs. In order to do this fragmentation, it uses virtual nests
+attributes, to avoid actual nesting use which cannot be divided between
+different SKBs.
+
 User Interface
 ==============
 
Signature · 1 line
2.27.0
maintainer Reviewed-by on the v1 series
#17 lore raw
In reply to Moshe Shemesh
Quoted 7 lines · Mon, Feb 13, 2023 at 02:14:08PM CET, [email protected] wrote:

This patchset moves devlink health callbacks, helpers and related code from leftover.c to new file health.c. About 1.3K LoC are moved by this patchset, covering all devlink health functionality.

In addition this patchset includes a couple of small cleanups in devlink health code and documentation update.

Quoted 11 lines

Moshe Shemesh (10):
devlink: Split out health reporter create code
devlink: health: Fix nla_nest_end in error flow
devlink: Move devlink health get and set code to health file
devlink: health: Don't try to add trace with NULL msg
devlink: Move devlink health report and recover to health file
devlink: Move devlink fmsg and health diagnose to health file
devlink: Move devlink health dump to health file
devlink: Move devlink health test to health file
devlink: Move health common function to health file
devlink: Update devlink health documentation

set-

Thanks Moshe!

maintainer
#2 lore raw

Re: [PATCH net-next 01/10] devlink: Split out health reporter create code

In reply to Moshe Shemesh
Quoted 9 lines · On Mon, 13 Feb 2023 15:14:09 +0200 Moshe Shemesh wrote:

+/**
+ * devl_port_health_reporter_create - create devlink health reporter for
+ * specified port instance
+ *
+ * @port: devlink_port which should contain the new reporter
+ * @ops: ops
+ * @graceful_period: to avoid recovery loops, in msecs
+ * @priv: priv
+ */

Can we drop or touch-up the kdoc as we move?

The indent should just use a space, not a tab.
() after function name

@port: devlink_port to which the health reports will relate @ops: driver health reporter ops
@graceful_period: min time between recovery attempts @priv: driver priv pointer

maintainer
#5 lore raw

Re: [PATCH net-next 02/10] devlink: health: Fix nla_nest_end in error flow

In reply to Moshe Shemesh
Quoted 2 lines · On Mon, 13 Feb 2023 15:14:10 +0200 Moshe Shemesh wrote:

devlink_nl_health_reporter_fill() error flow calls nla_nest_end(). Fix it to call nla_nest_cancel() instead.

If you do respin please add a sentence to say that this is harmless because we cancel the entire message, anyway.

maintainer
#9 lore raw

Re: [PATCH net-next 04/10] devlink: health: Don't try to add trace with NULL msg

In reply to Moshe Shemesh
Quoted 4 lines · On Mon, 13 Feb 2023 15:14:12 +0200 Moshe Shemesh wrote:

In case devlink_health_report() msg argument is NULL a warning is triggered, but then continue and try to print a trace with NULL pointer.

Fix it to skip trace call if msg pointer is NULL.

The trace macros take NULLs, can you double check? Same story with adding a note why this is harmless as patch 2

maintainer Reviewed-by on the v1 series
#18 lore raw
In reply to Moshe Shemesh
Quoted 6 lines · On Mon, 13 Feb 2023 15:14:08 +0200 Moshe Shemesh wrote:

This patchset moves devlink health callbacks, helpers and related code from leftover.c to new file health.c. About 1.3K LoC are moved by this patchset, covering all devlink health functionality.

In addition this patchset includes a couple of small cleanups in devlink health code and documentation update.

#3 lore raw

Re: [PATCH net-next 01/10] devlink: Split out health reporter create code

In reply to Jakub Kicinski
Quoted 11 lines · Jakub Kicinski
Quoted 9 lines · On Mon, 13 Feb 2023 15:14:09 +0200 Moshe Shemesh wrote:

+/**
+ * devl_port_health_reporter_create - create devlink health reporter for
+ * specified port instance
+ *

+ *   @port: devlink_port which should contain the new reporter
+ *   @ops: ops
+ *   @graceful_period: to avoid recovery loops, in msecs
+ *   @priv: priv

+ */

Can we drop or touch-up the kdoc as we move?

Sure,  will send v2 fixing kdoc

Quoted 8 lines

The indent should just use a space, not a tab.
() after function name

@port: devlink_port to which the health reports will relate @ops: driver health reporter ops
@graceful_period: min time between recovery attempts @priv: driver priv pointer

#6 lore raw

Re: [PATCH net-next 02/10] devlink: health: Fix nla_nest_end in error flow

In reply to Jakub Kicinski
Quoted 5 lines · Jakub Kicinski
Quoted 2 lines · On Mon, 13 Feb 2023 15:14:10 +0200 Moshe Shemesh wrote:

devlink_nl_health_reporter_fill() error flow calls nla_nest_end(). Fix it to call nla_nest_cancel() instead.

If you do respin please add a sentence to say that this is harmless because we cancel the entire message, anyway.

Ack.

That's why no fixes tag

#10 lore raw

Re: [PATCH net-next 04/10] devlink: health: Don't try to add trace with NULL msg

In reply to Jakub Kicinski
Quoted 6 lines · Jakub Kicinski
Quoted 4 lines · On Mon, 13 Feb 2023 15:14:12 +0200 Moshe Shemesh wrote:

In case devlink_health_report() msg argument is NULL a warning is triggered, but then continue and try to print a trace with NULL pointer.

Fix it to skip trace call if msg pointer is NULL.

The trace macros take NULLs, can you double check?

Just tested it, so basically the trace will log "(null)" instead of msg.

But in this case, msg=NULL influence also reporter_name in the trace which led me to another fix :

include/trace/events/devlink.h +0 -0
index 24969184c534..77ff7cfc6049 100644
@@ -88,7 +88,7 @@ TRACE_EVENT(devlink_health_report,

                __string(bus_name, devlink_to_dev(devlink)->bus->name) __string(dev_name, dev_name(devlink_to_dev(devlink))) __string(driver_name, devlink_to_dev(devlink)->driver->name) -               __string(reporter_name, msg)
+               __string(reporter_name, reporter_name) __string(msg, msg)
        ),

Here too, the trace logs part of reporter name and "(null)", not really harmful, but wrong, as we do have the reporter_name.

I will drop this patch as I think having a log with most data (timestamp, device, reporter name), but "(null)" instead of msg along with the warning is better then no log.

I will add a patch to fix the wrong trace point struct entry for reporter_name.

Quoted 1 line

Same story with adding a note why this is harmless as patch 2