All of lore.kernel.org
 help / color / mirror / Atom feed
* [virtio-dev] [PATCH v5] Add lifetime metrics to virtio-blk
@ 2021-03-09 21:20 Enrico Granata
  2021-03-10 11:17 ` Stefan Hajnoczi
  2021-03-15 11:27 ` Cornelia Huck
  0 siblings, 2 replies; 4+ messages in thread
From: Enrico Granata @ 2021-03-09 21:20 UTC (permalink / raw)
  To: virtio-dev

In many embedded systems, virtio-blk implementations are
backed by eMMC or UFS storage devices, which are subject to
predictable and measurable wear over time due to repeated write
cycles.

For such systems, it can be important to be able to track
accurately the amount of wear imposed on the storage over
time and surface it to applications. In a native deployments
this is generally handled by the physical block device driver
but no such provision is made in virtio-blk to expose these
metrics for devices where it makes sense to do so.

This patch adds support to virtio-blk for lifetime and wear
metrics to be exposed to the guest when a deployment of
virtio-blk is done over compatible eMMC or UFS storage.

Signed-off-by: Enrico Granata <egranata@google.com>
Fixes: https://github.org/oasis-tcs/virtio-spec/issues/97
---
 content.tex | 35 +++++++++++++++++++++++++++++++++--
 1 file changed, 33 insertions(+), 2 deletions(-)

diff --git a/content.tex b/content.tex
index b72bad0..75631ba 100644
--- a/content.tex
+++ b/content.tex
@@ -4418,6 +4418,9 @@ \subsection{Feature bits}\label{sec:Device Types
/ Block Device / Feature bits}
 \item[VIRTIO_BLK_F_WRITE_ZEROES (14)] Device can support write zeroes command,
      maximum write zeroes sectors size in \field{max_write_zeroes_sectors} and
      maximum write zeroes segment number in \field{max_write_zeroes_seg}.
+
+\item[VIRTIO_BLK_F_LIFETIME (15)] Device supports providing storage lifetime
+     information.
 \end{description}

 \subsubsection{Legacy Interface: Feature bits}\label{sec:Device Types
/ Block Device / Feature bits / Legacy Interface: Feature bits}
@@ -4601,14 +4604,16 @@ \subsection{Device Operation}\label{sec:Device
Types / Block Device / Device Ope

 The type of the request is either a read (VIRTIO_BLK_T_IN), a write
 (VIRTIO_BLK_T_OUT), a discard (VIRTIO_BLK_T_DISCARD), a write zeroes
-(VIRTIO_BLK_T_WRITE_ZEROES), a flush (VIRTIO_BLK_T_FLUSH), or a get device ID
-string command (VIRTIO_BLK_T_GET_ID).
+(VIRTIO_BLK_T_WRITE_ZEROES), a flush (VIRTIO_BLK_T_FLUSH), a get device ID
+string command (VIRTIO_BLK_T_GET_ID), or a get device lifetime command
+(VIRTIO_BLK_T_GET_LIFETIME).

 \begin{lstlisting}
 #define VIRTIO_BLK_T_IN           0
 #define VIRTIO_BLK_T_OUT          1
 #define VIRTIO_BLK_T_FLUSH        4
 #define VIRTIO_BLK_T_GET_ID       8
+#define VIRTIO_BLK_T_GET_LIFETIME 10
 #define VIRTIO_BLK_T_DISCARD      11
 #define VIRTIO_BLK_T_WRITE_ZEROES 13
 \end{lstlisting}
@@ -4648,6 +4653,26 @@ \subsection{Device Operation}\label{sec:Device
Types / Block Device / Device Ope
 \field{data}.  The device ID string is a NUL-padded ASCII string up to 20 bytes
 long.  If the string is 20 bytes long then there is no NUL terminator.

+The \field{data} used for VIRTIO_BLK_T_GET_LIFETIME requests is populated
+by the device, and is of the form
+
+\begin{lstlisting}
+struct virtio_blk_lifetime {
+  le16 pre_eol_info;
+  le16 device_lifetime_est_typ_a;
+  le16 device_lifetime_est_typ_b;
+};
+\end{lstlisting}
+
+The device lifetime metrics \field{pre_eol_info}, \field{device_lifetime_est_a}
+and \field{device_lifetime_est_b} have the semantics described by the
JESD84-B50
+specification for the extended CSD register fields \field{PRE_EOL_INFO}
+\field{DEVICE_LIFETIME_EST_TYP_A} and \field{DEVICE_LIFETIME_EST_TYP_B}
+respectively.
+
+JESD84-B50 is available at the JEDEC website (https://www.jedec.org)
+pursuant to JEDEC's licensing terms and conditions.
+
 The final \field{status} byte is written by the device: either
 VIRTIO_BLK_S_OK for success, VIRTIO_BLK_S_IOERR for device or driver
 error or VIRTIO_BLK_S_UNSUPP for a request unsupported by device:
@@ -4779,6 +4804,12 @@ \subsection{Device Operation}\label{sec:Device
Types / Block Device / Device Ope
   for implementations that do not wish to be safe against such data losses.
 \end{note}

+If the device is backed by storage providing lifetime metrics (such as eMMC
+or UFS persistent storage), the device SHOULD offer the VIRTIO_BLK_F_LIFETIME
+flag. The flag MUST NOT be offered if the device is backed by storage for which
+the lifetime metrics described in this document cannot be obtained or for which
+such metrics have no useful meaning.
+
 \subsubsection{Legacy Interface: Device Operation}\label{sec:Device
Types / Block Device / Device Operation / Legacy Interface: Device
Operation}
 When using the legacy interface, transitional devices and drivers
 MUST format the fields in struct virtio_blk_req
--
2.30.1.766.gb4fecdf3b7-goog

---------------------------------------------------------------------
To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org


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

* Re: [virtio-dev] [PATCH v5] Add lifetime metrics to virtio-blk
  2021-03-09 21:20 [virtio-dev] [PATCH v5] Add lifetime metrics to virtio-blk Enrico Granata
@ 2021-03-10 11:17 ` Stefan Hajnoczi
  2021-03-15 11:27 ` Cornelia Huck
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2021-03-10 11:17 UTC (permalink / raw)
  To: Enrico Granata; +Cc: virtio-dev

[-- Attachment #1: Type: text/plain, Size: 1114 bytes --]

On Tue, Mar 09, 2021 at 02:20:14PM -0700, Enrico Granata wrote:
> In many embedded systems, virtio-blk implementations are
> backed by eMMC or UFS storage devices, which are subject to
> predictable and measurable wear over time due to repeated write
> cycles.
> 
> For such systems, it can be important to be able to track
> accurately the amount of wear imposed on the storage over
> time and surface it to applications. In a native deployments
> this is generally handled by the physical block device driver
> but no such provision is made in virtio-blk to expose these
> metrics for devices where it makes sense to do so.
> 
> This patch adds support to virtio-blk for lifetime and wear
> metrics to be exposed to the guest when a deployment of
> virtio-blk is done over compatible eMMC or UFS storage.
> 
> Signed-off-by: Enrico Granata <egranata@google.com>
> Fixes: https://github.org/oasis-tcs/virtio-spec/issues/97
> ---
>  content.tex | 35 +++++++++++++++++++++++++++++++++--
>  1 file changed, 33 insertions(+), 2 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [virtio-dev] [PATCH v5] Add lifetime metrics to virtio-blk
  2021-03-09 21:20 [virtio-dev] [PATCH v5] Add lifetime metrics to virtio-blk Enrico Granata
  2021-03-10 11:17 ` Stefan Hajnoczi
@ 2021-03-15 11:27 ` Cornelia Huck
  2021-03-16 16:40   ` Enrico Granata
  1 sibling, 1 reply; 4+ messages in thread
From: Cornelia Huck @ 2021-03-15 11:27 UTC (permalink / raw)
  To: Enrico Granata; +Cc: virtio-dev

On Tue, 9 Mar 2021 14:20:14 -0700
Enrico Granata <egranata@google.com> wrote:

> In many embedded systems, virtio-blk implementations are
> backed by eMMC or UFS storage devices, which are subject to
> predictable and measurable wear over time due to repeated write
> cycles.
> 
> For such systems, it can be important to be able to track
> accurately the amount of wear imposed on the storage over
> time and surface it to applications. In a native deployments
> this is generally handled by the physical block device driver
> but no such provision is made in virtio-blk to expose these
> metrics for devices where it makes sense to do so.
> 
> This patch adds support to virtio-blk for lifetime and wear
> metrics to be exposed to the guest when a deployment of
> virtio-blk is done over compatible eMMC or UFS storage.
> 
> Signed-off-by: Enrico Granata <egranata@google.com>
> Fixes: https://github.org/oasis-tcs/virtio-spec/issues/97
> ---
>  content.tex | 35 +++++++++++++++++++++++++++++++++--
>  1 file changed, 33 insertions(+), 2 deletions(-)
> 
> diff --git a/content.tex b/content.tex
> index b72bad0..75631ba 100644
> --- a/content.tex
> +++ b/content.tex
> @@ -4418,6 +4418,9 @@ \subsection{Feature bits}\label{sec:Device Types
> / Block Device / Feature bits}

There still seems to be something wrong with the line wrapping in this
patch (won't apply without manual massaging) -- can you please
double-check your setup?

That said, I think we can still vote on this patch; please add the link
to this version to the github issue if you think it's time for voting.


---------------------------------------------------------------------
To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org


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

* Re: [virtio-dev] [PATCH v5] Add lifetime metrics to virtio-blk
  2021-03-15 11:27 ` Cornelia Huck
@ 2021-03-16 16:40   ` Enrico Granata
  0 siblings, 0 replies; 4+ messages in thread
From: Enrico Granata @ 2021-03-16 16:40 UTC (permalink / raw)
  To: Cornelia Huck; +Cc: virtio-dev

Please do start a vote on this issue at your earliest convenience

Fixes: https://github.com/oasis-tcs/virtio-spec/issues/97

Thanks,
- Enrico

On Mon, Mar 15, 2021 at 5:27 AM Cornelia Huck <cohuck@redhat.com> wrote:
>
> On Tue, 9 Mar 2021 14:20:14 -0700
> Enrico Granata <egranata@google.com> wrote:
>
> > In many embedded systems, virtio-blk implementations are
> > backed by eMMC or UFS storage devices, which are subject to
> > predictable and measurable wear over time due to repeated write
> > cycles.
> >
> > For such systems, it can be important to be able to track
> > accurately the amount of wear imposed on the storage over
> > time and surface it to applications. In a native deployments
> > this is generally handled by the physical block device driver
> > but no such provision is made in virtio-blk to expose these
> > metrics for devices where it makes sense to do so.
> >
> > This patch adds support to virtio-blk for lifetime and wear
> > metrics to be exposed to the guest when a deployment of
> > virtio-blk is done over compatible eMMC or UFS storage.
> >
> > Signed-off-by: Enrico Granata <egranata@google.com>
> > Fixes: https://github.org/oasis-tcs/virtio-spec/issues/97
> > ---
> >  content.tex | 35 +++++++++++++++++++++++++++++++++--
> >  1 file changed, 33 insertions(+), 2 deletions(-)
> >
> > diff --git a/content.tex b/content.tex
> > index b72bad0..75631ba 100644
> > --- a/content.tex
> > +++ b/content.tex
> > @@ -4418,6 +4418,9 @@ \subsection{Feature bits}\label{sec:Device Types
> > / Block Device / Feature bits}
>
> There still seems to be something wrong with the line wrapping in this
> patch (won't apply without manual massaging) -- can you please
> double-check your setup?
>
> That said, I think we can still vote on this patch; please add the link
> to this version to the github issue if you think it's time for voting.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
> For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org


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

end of thread, other threads:[~2021-03-16 16:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-09 21:20 [virtio-dev] [PATCH v5] Add lifetime metrics to virtio-blk Enrico Granata
2021-03-10 11:17 ` Stefan Hajnoczi
2021-03-15 11:27 ` Cornelia Huck
2021-03-16 16:40   ` Enrico Granata

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.