All of lore.kernel.org
 help / color / mirror / Atom feed
* [net] devlink: Add method for time-stamp on reporter's dump
@ 2019-08-22  8:17 Aya Levin
  2019-08-22 11:05 ` [iproute2, master 0/2] Fix reporter's dump's time-stamp Aya Levin
  2019-08-22 14:06 ` [net] devlink: Add method for time-stamp on " Andrew Lunn
  0 siblings, 2 replies; 11+ messages in thread
From: Aya Levin @ 2019-08-22  8:17 UTC (permalink / raw)
  To: David S. Miller; +Cc: Jiri Pirko, netdev, linux-kernel, Aya Levin

When setting the dump's time-stamp, use ktime_get_real in addition to
jiffies. This simplifies the user space implementation and bypasses
some inconsistent behavior with translating jiffies to current time.

Fixes: c8e1da0bf923 ("devlink: Add health report functionality")
Signed-off-by: Aya Levin <ayal@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
---
 include/uapi/linux/devlink.h | 2 ++
 net/core/devlink.c           | 6 ++++++
 2 files changed, 8 insertions(+)

diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h
index ffc993256527..4dd4e4e7b19b 100644
--- a/include/uapi/linux/devlink.h
+++ b/include/uapi/linux/devlink.h
@@ -348,6 +348,8 @@ enum devlink_attr {
 	DEVLINK_ATTR_PORT_PCI_PF_NUMBER,	/* u16 */
 	DEVLINK_ATTR_PORT_PCI_VF_NUMBER,	/* u16 */
 
+	DEVLINK_ATTR_HEALTH_REPORTER_DUMP_TSPEC,
+
 	/* add new attributes above here, update the policy in devlink.c */
 
 	__DEVLINK_ATTR_MAX,
diff --git a/net/core/devlink.c b/net/core/devlink.c
index d3dbb904bf3b..b26875c4329b 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -4577,6 +4577,7 @@ struct devlink_health_reporter {
 	bool auto_recover;
 	u8 health_state;
 	u64 dump_ts;
+	struct timespec dump_real_ts;
 	u64 error_count;
 	u64 recovery_count;
 	u64 last_recovery_ts;
@@ -4749,6 +4750,7 @@ static int devlink_health_do_dump(struct devlink_health_reporter *reporter,
 		goto dump_err;
 
 	reporter->dump_ts = jiffies;
+	reporter->dump_real_ts = ktime_to_timespec(ktime_get_real());
 
 	return 0;
 
@@ -4911,6 +4913,10 @@ devlink_nl_health_reporter_fill(struct sk_buff *msg,
 			      jiffies_to_msecs(reporter->dump_ts),
 			      DEVLINK_ATTR_PAD))
 		goto reporter_nest_cancel;
+	if (reporter->dump_fmsg &&
+	    nla_put(msg, DEVLINK_ATTR_HEALTH_REPORTER_DUMP_TSPEC,
+		    sizeof(reporter->dump_real_ts), &reporter->dump_real_ts))
+		goto reporter_nest_cancel;
 
 	nla_nest_end(msg, reporter_attr);
 	genlmsg_end(msg, hdr);
-- 
2.14.1


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

end of thread, other threads:[~2019-09-06  7:17 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-22  8:17 [net] devlink: Add method for time-stamp on reporter's dump Aya Levin
2019-08-22 11:05 ` [iproute2, master 0/2] Fix reporter's dump's time-stamp Aya Levin
2019-08-22 11:05   ` [iproute2, master 1/2] devlink: Print health reporter's dump time-stamp in a helper function Aya Levin
2019-08-29 23:25     ` Stephen Hemminger
2019-09-06  7:17       ` Aya Levin
2019-08-22 11:05   ` [iproute2, master 2/2] devlink: Add a new time-stamp format for health reporter's dump Aya Levin
2019-08-29 23:27     ` Stephen Hemminger
2019-09-06  7:17       ` Aya Levin
2019-08-22 14:06 ` [net] devlink: Add method for time-stamp on " Andrew Lunn
2019-08-22 17:40   ` Ido Schimmel
2019-08-22 19:11     ` Arnd Bergmann

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.