Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp693656ybl; Thu, 22 Aug 2019 03:28:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqycg+eOELbSNHrt/zm2jX3uu3sVwW/HzG8wSCY5T2izOUGeTO89+g6PuO5QqZKry8skJgYo X-Received: by 2002:a17:90a:17c4:: with SMTP id q62mr4596066pja.135.1566469719554; Thu, 22 Aug 2019 03:28:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566469719; cv=none; d=google.com; s=arc-20160816; b=c+4mviv+8q5Dl1buohrVAKcaiAWpzUbERXl32x7qrPGwwwgus9qvHhQSGtG8grkxbB VxurdxzW7V2/yKwJ8J2D364us5N+m3mEXAv7lH36Lso8IfIOgUuH9ynQQGdyeMYL7qB7 e8qcfmzL00ak0SX7F6Uap5o9vdxuVTWGespOmmgtRzn19L/NqkyEOmxr0zx/T63OZxTi G+N2k5rwGPF1iyGPVs4BmWq5FMRgbWByU9FVeP5hUaTb0K/ZpyuXEewQsg6Gx25HgO36 w2St//RRhoCdOUVQBCdlZVlGuI9sufy3dKjOw88NvvP1pUR9jmYVOPOzATI8gheQkpe5 YgNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=yaPvghg+W6BTZZZeJsfRZf8rRxQSxmxFR8DnfEGY2dY=; b=wH0M4d6n3leX6Igs7ixxoUBqAJ7htuQm14ixdMv3RDZR7TF2IcpK4wri7036BV5fs5 b+Ow72uXgmdluYnlgJfn4vb/15U1lTL7mvVg14eBJ+WLt2EPQziq1pnOVKi9EPwALjWA sqjR6BmjfguBv0rPl7qRTepWGMCI6X5JArsOKmp8mlGeGqwudZl03etSZbs3n1XMNUPR ZJ6Pv9lE/brUs8JvHkxND6jjrJl9jcBYCfwQjeUcYNa10UYRqRhjd71HUjG36p3AjmH9 icUNOsHkIRASJt0gx1R0fAkvpSb9hVDcHsqg7IjoJrx5XNoTZSRrLtn3cr2t02iuwpAe lGIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c1si10710382pld.348.2019.08.22.03.28.24; Thu, 22 Aug 2019 03:28:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726319AbfHVISI (ORCPT + 99 others); Thu, 22 Aug 2019 04:18:08 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:46537 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726262AbfHVISI (ORCPT ); Thu, 22 Aug 2019 04:18:08 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from ayal@mellanox.com) with ESMTPS (AES256-SHA encrypted); 22 Aug 2019 11:18:02 +0300 Received: from dev-l-vrt-210.mtl.labs.mlnx (dev-l-vrt-210.mtl.labs.mlnx [10.134.210.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x7M8I2gV009936; Thu, 22 Aug 2019 11:18:02 +0300 Received: from dev-l-vrt-210.mtl.labs.mlnx (localhost [127.0.0.1]) by dev-l-vrt-210.mtl.labs.mlnx (8.15.2/8.15.2/Debian-8ubuntu1) with ESMTP id x7M8I2W6022032; Thu, 22 Aug 2019 11:18:02 +0300 Received: (from ayal@localhost) by dev-l-vrt-210.mtl.labs.mlnx (8.15.2/8.15.2/Submit) id x7M8I1Rv022031; Thu, 22 Aug 2019 11:18:01 +0300 From: Aya Levin To: "David S. Miller" Cc: Jiri Pirko , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Aya Levin Subject: [net] devlink: Add method for time-stamp on reporter's dump Date: Thu, 22 Aug 2019 11:17:51 +0300 Message-Id: <1566461871-21992-1-git-send-email-ayal@mellanox.com> X-Mailer: git-send-email 1.8.4.3 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Acked-by: Jiri Pirko --- 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