[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 04/19] block/nvme: Trace controller capabilities
From: |
Stefan Hajnoczi |
Subject: |
Re: [PATCH v2 04/19] block/nvme: Trace controller capabilities |
Date: |
Tue, 27 Oct 2020 09:41:54 +0000 |
On Mon, Oct 26, 2020 at 11:54:49AM +0100, Philippe Mathieu-Daudé wrote:
> Controllers have different capabilities and report them in the
> CAP register. We are particularly interested by the page size
> limits.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> block/nvme.c | 10 ++++++++++
> block/trace-events | 1 +
> 2 files changed, 11 insertions(+)
>
> diff --git a/block/nvme.c b/block/nvme.c
> index 5abd7257cac..3b6d3972ec2 100644
> --- a/block/nvme.c
> +++ b/block/nvme.c
> @@ -720,6 +720,16 @@ static int nvme_init(BlockDriverState *bs, const char
> *device, int namespace,
> * Initialization". */
>
> cap = le64_to_cpu(regs->cap);
> + trace_nvme_controller_capability("Maximum Queue Entries Supported",
> + NVME_CAP_MQES(cap));
> + trace_nvme_controller_capability("Contiguous Queues Required",
> + NVME_CAP_CQR(cap));
> + trace_nvme_controller_capability("Subsystem Reset Supported",
> + NVME_CAP_NSSRS(cap));
> + trace_nvme_controller_capability("Memory Page Size Minimum",
> + NVME_CAP_MPSMIN(cap));
> + trace_nvme_controller_capability("Memory Page Size Maximum",
> + NVME_CAP_MPSMAX(cap));
This works well for printf-style tracing but it can be tedious to
strcmp() or parse strings from SystemTap and other tracing scripts.
Another way of expressing these trace events is:
trace_nvme_controller_capabilities(NVME_CAP_MQES(cap),
NVME_CAP_CQR(cap),
...);
Or:
trace_nvme_controller_capability_mqes(NVME_CAP_MQES(cap));
trace_nvme_controller_capability_cqr(NVME_CAP_CQR(cap));
One view is that tracing is like printf (the style used in this patch).
Another view is that tracing produces records that scripts can process
(the style I showed). Trace events defined in one style may be hard to
use in the other style (i.e. less human-readable vs harder to process in
a script).
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
signature.asc
Description: PGP signature
- [PATCH v2 01/19] block/nvme: Correct minimum device page size, (continued)
- [PATCH v2 01/19] block/nvme: Correct minimum device page size, Philippe Mathieu-Daudé, 2020/10/26
- [PATCH v2 02/19] block/nvme: Set request_alignment at initialization, Philippe Mathieu-Daudé, 2020/10/26
- [PATCH v2 03/19] block/nvme: Introduce device/iommu 'page_size_min' variables, Philippe Mathieu-Daudé, 2020/10/26
- [PATCH v2 04/19] block/nvme: Trace controller capabilities, Philippe Mathieu-Daudé, 2020/10/26
- [PATCH v2 05/19] util/vfio-helpers: Improve reporting unsupported IOMMU type, Philippe Mathieu-Daudé, 2020/10/26
- [PATCH v2 07/19] util/vfio-helpers: Trace PCI BAR region info, Philippe Mathieu-Daudé, 2020/10/26
- [PATCH v2 06/19] util/vfio-helpers: Trace PCI I/O config accesses, Philippe Mathieu-Daudé, 2020/10/26
- [PATCH v2 08/19] util/vfio-helpers: Trace where BARs are mapped, Philippe Mathieu-Daudé, 2020/10/26
- [PATCH v2 09/19] util/vfio-helpers: Improve DMA trace events, Philippe Mathieu-Daudé, 2020/10/26
- [PATCH v2 10/19] util/vfio-helpers: Convert vfio_dump_mapping to trace events, Philippe Mathieu-Daudé, 2020/10/26
- [PATCH v2 11/19] util/vfio-helpers: Let qemu_vfio_dma_map() propagate Error, Philippe Mathieu-Daudé, 2020/10/26