[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200203115001.GE2260@nanopsycho>
Date: Mon, 3 Feb 2020 12:50:01 +0100
From: Jiri Pirko <jiri@...nulli.us>
To: Jacob Keller <jacob.e.keller@...el.com>
Cc: netdev@...r.kernel.org, valex@...lanox.com, linyunsheng@...wei.com,
lihong.yang@...el.com
Subject: Re: [PATCH 03/15] devlink: add operation to take an immediate
snapshot
Thu, Jan 30, 2020 at 11:58:58PM CET, jacob.e.keller@...el.com wrote:
>Add a new devlink command, DEVLINK_CMD_REGION_TAKE_SNAPSHOT. This
>command is intended to enable userspace to request an immediate snapshot
>of a region.
>
>Regions can enable support for requestable snapshots by implementing the
>snapshot callback function in the region's devlink_region_ops structure.
>
>Implementations of this function callback should capture an immediate
>copy of the data and return it and its destructor in the function
>parameters. The core devlink code will generate a snapshot ID and create
>the new snapshot while holding the devlink instance lock.
>
>Signed-off-by: Jacob Keller <jacob.e.keller@...el.com>
>---
> .../networking/devlink/devlink-region.rst | 9 +++-
> include/net/devlink.h | 7 +++
> include/uapi/linux/devlink.h | 2 +
> net/core/devlink.c | 46 +++++++++++++++++++
> 4 files changed, 62 insertions(+), 2 deletions(-)
>
>diff --git a/Documentation/networking/devlink/devlink-region.rst b/Documentation/networking/devlink/devlink-region.rst
>index 1a7683e7acb2..262249e6c3fc 100644
>--- a/Documentation/networking/devlink/devlink-region.rst
>+++ b/Documentation/networking/devlink/devlink-region.rst
>@@ -20,6 +20,11 @@ address regions that are otherwise inaccessible to the user.
> Regions may also be used to provide an additional way to debug complex error
> states, but see also :doc:`devlink-health`
>
>+Regions may optionally support capturing a snapshot on demand via the
>+``DEVLINK_CMD_REGION_TAKE_SNAPSHOT`` netlink message. A driver wishing to
>+allow requested snapshots must implement the ``.snapshot`` callback for the
>+region in its ``devlink_region_ops`` structure.
>+
> example usage
> -------------
>
>@@ -40,8 +45,8 @@ example usage
> # Delete a snapshot using:
> $ devlink region del pci/0000:00:05.0/cr-space snapshot 1
>
>- # Trigger (request) a snapshot be taken:
>- $ devlink region trigger pci/0000:00:05.0/cr-space
>+ # Request an immediate snapshot, if supported by the region
>+ $ devlink region snapshot pci/0000:00:05.0/cr-space
Hmm, the shapshot is now removed by user calling:
$ devlink region del DEV/REGION snapshot SNAPSHOT_ID
That is using DEVLINK_CMD_REGION_DEL netlink command calling
devlink_nl_cmd_region_del()
I think the creation should be symmetric. Something like:
$ devlink region add DEV/REGION snapshot SNAPSHOT_ID
SNAPSHOT_ID is either exact number or "any" if user does not care.
The benefit of using user-passed ID value is that you can use this
easily in scripts.
The existing unused netlink command DEVLINK_CMD_REGION_NEW would be used
for this.
>
> # Dump a snapshot:
> $ devlink region dump pci/0000:00:05.0/fw-health snapshot 1
[...]
Powered by blists - more mailing lists