2024-01-31 23:56:43

by Ira Weiny

[permalink] [raw]
Subject: [PATCH 2/2] cxl/trace: Remove unnecessary memcpy's

CPER events don't have UUIDs. Therefore UUIDs were removed from the
records passed to trace events and replaced with hard coded values.

As pointed out by Jonathan, the new defines for the UUIDs present a more
efficient way to assign UUID in trace records.[1]

Replace memcpy's with the use of static data.

[1] https://lore.kernel.org/all/[email protected]/

Suggested-by: Jonathan Cameron <[email protected]>
Signed-off-by: Ira Weiny <[email protected]>
---
drivers/cxl/core/trace.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/cxl/core/trace.h b/drivers/cxl/core/trace.h
index 89445435303a..bdf117a33744 100644
--- a/drivers/cxl/core/trace.h
+++ b/drivers/cxl/core/trace.h
@@ -338,7 +338,7 @@ TRACE_EVENT(cxl_general_media,

TP_fast_assign(
CXL_EVT_TP_fast_assign(cxlmd, log, rec->hdr);
- memcpy(&__entry->hdr_uuid, &CXL_EVENT_GEN_MEDIA_UUID, sizeof(uuid_t));
+ __entry->hdr_uuid = CXL_EVENT_GEN_MEDIA_UUID;

/* General Media */
__entry->dpa = le64_to_cpu(rec->phys_addr);
@@ -425,7 +425,7 @@ TRACE_EVENT(cxl_dram,

TP_fast_assign(
CXL_EVT_TP_fast_assign(cxlmd, log, rec->hdr);
- memcpy(&__entry->hdr_uuid, &CXL_EVENT_DRAM_UUID, sizeof(uuid_t));
+ __entry->hdr_uuid = CXL_EVENT_DRAM_UUID;

/* DRAM */
__entry->dpa = le64_to_cpu(rec->phys_addr);
@@ -573,7 +573,7 @@ TRACE_EVENT(cxl_memory_module,

TP_fast_assign(
CXL_EVT_TP_fast_assign(cxlmd, log, rec->hdr);
- memcpy(&__entry->hdr_uuid, &CXL_EVENT_MEM_MODULE_UUID, sizeof(uuid_t));
+ __entry->hdr_uuid = CXL_EVENT_MEM_MODULE_UUID;

/* Memory Module Event */
__entry->event_type = rec->event_type;

--
2.43.0



2024-02-01 01:18:09

by Alison Schofield

[permalink] [raw]
Subject: Re: [PATCH 2/2] cxl/trace: Remove unnecessary memcpy's

On Wed, Jan 31, 2024 at 03:55:39PM -0800, Ira Weiny wrote:
> CPER events don't have UUIDs. Therefore UUIDs were removed from the
> records passed to trace events and replaced with hard coded values.
>
> As pointed out by Jonathan, the new defines for the UUIDs present a more
> efficient way to assign UUID in trace records.[1]
>
> Replace memcpy's with the use of static data.

Reviewed-by: Alison Schofield <[email protected]>


>
> [1] https://lore.kernel.org/all/[email protected]/
>
> Suggested-by: Jonathan Cameron <[email protected]>
> Signed-off-by: Ira Weiny <[email protected]>
> ---
> drivers/cxl/core/trace.h | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/cxl/core/trace.h b/drivers/cxl/core/trace.h
> index 89445435303a..bdf117a33744 100644
> --- a/drivers/cxl/core/trace.h
> +++ b/drivers/cxl/core/trace.h
> @@ -338,7 +338,7 @@ TRACE_EVENT(cxl_general_media,
>
> TP_fast_assign(
> CXL_EVT_TP_fast_assign(cxlmd, log, rec->hdr);
> - memcpy(&__entry->hdr_uuid, &CXL_EVENT_GEN_MEDIA_UUID, sizeof(uuid_t));
> + __entry->hdr_uuid = CXL_EVENT_GEN_MEDIA_UUID;
>
> /* General Media */
> __entry->dpa = le64_to_cpu(rec->phys_addr);
> @@ -425,7 +425,7 @@ TRACE_EVENT(cxl_dram,
>
> TP_fast_assign(
> CXL_EVT_TP_fast_assign(cxlmd, log, rec->hdr);
> - memcpy(&__entry->hdr_uuid, &CXL_EVENT_DRAM_UUID, sizeof(uuid_t));
> + __entry->hdr_uuid = CXL_EVENT_DRAM_UUID;
>
> /* DRAM */
> __entry->dpa = le64_to_cpu(rec->phys_addr);
> @@ -573,7 +573,7 @@ TRACE_EVENT(cxl_memory_module,
>
> TP_fast_assign(
> CXL_EVT_TP_fast_assign(cxlmd, log, rec->hdr);
> - memcpy(&__entry->hdr_uuid, &CXL_EVENT_MEM_MODULE_UUID, sizeof(uuid_t));
> + __entry->hdr_uuid = CXL_EVENT_MEM_MODULE_UUID;
>
> /* Memory Module Event */
> __entry->event_type = rec->event_type;
>
> --
> 2.43.0
>

2024-02-01 11:29:04

by Jonathan Cameron

[permalink] [raw]
Subject: Re: [PATCH 2/2] cxl/trace: Remove unnecessary memcpy's

On Wed, 31 Jan 2024 17:17:55 -0800
Alison Schofield <[email protected]> wrote:

> On Wed, Jan 31, 2024 at 03:55:39PM -0800, Ira Weiny wrote:
> > CPER events don't have UUIDs. Therefore UUIDs were removed from the
> > records passed to trace events and replaced with hard coded values.
> >
> > As pointed out by Jonathan, the new defines for the UUIDs present a more
> > efficient way to assign UUID in trace records.[1]
> >
> > Replace memcpy's with the use of static data.
>
> Reviewed-by: Alison Schofield <[email protected]>

Reviewed-by: Jonathan Cameron <[email protected]>

>
>
> >
> > [1] https://lore.kernel.org/all/[email protected]/
> >
> > Suggested-by: Jonathan Cameron <[email protected]>
> > Signed-off-by: Ira Weiny <[email protected]>
> > ---
> > drivers/cxl/core/trace.h | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/cxl/core/trace.h b/drivers/cxl/core/trace.h
> > index 89445435303a..bdf117a33744 100644
> > --- a/drivers/cxl/core/trace.h
> > +++ b/drivers/cxl/core/trace.h
> > @@ -338,7 +338,7 @@ TRACE_EVENT(cxl_general_media,
> >
> > TP_fast_assign(
> > CXL_EVT_TP_fast_assign(cxlmd, log, rec->hdr);
> > - memcpy(&__entry->hdr_uuid, &CXL_EVENT_GEN_MEDIA_UUID, sizeof(uuid_t));
> > + __entry->hdr_uuid = CXL_EVENT_GEN_MEDIA_UUID;
> >
> > /* General Media */
> > __entry->dpa = le64_to_cpu(rec->phys_addr);
> > @@ -425,7 +425,7 @@ TRACE_EVENT(cxl_dram,
> >
> > TP_fast_assign(
> > CXL_EVT_TP_fast_assign(cxlmd, log, rec->hdr);
> > - memcpy(&__entry->hdr_uuid, &CXL_EVENT_DRAM_UUID, sizeof(uuid_t));
> > + __entry->hdr_uuid = CXL_EVENT_DRAM_UUID;
> >
> > /* DRAM */
> > __entry->dpa = le64_to_cpu(rec->phys_addr);
> > @@ -573,7 +573,7 @@ TRACE_EVENT(cxl_memory_module,
> >
> > TP_fast_assign(
> > CXL_EVT_TP_fast_assign(cxlmd, log, rec->hdr);
> > - memcpy(&__entry->hdr_uuid, &CXL_EVENT_MEM_MODULE_UUID, sizeof(uuid_t));
> > + __entry->hdr_uuid = CXL_EVENT_MEM_MODULE_UUID;
> >
> > /* Memory Module Event */
> > __entry->event_type = rec->event_type;
> >
> > --
> > 2.43.0
> >
>


2024-02-01 16:23:05

by Dave Jiang

[permalink] [raw]
Subject: Re: [PATCH 2/2] cxl/trace: Remove unnecessary memcpy's



On 1/31/24 16:55, Ira Weiny wrote:
> CPER events don't have UUIDs. Therefore UUIDs were removed from the
> records passed to trace events and replaced with hard coded values.
>
> As pointed out by Jonathan, the new defines for the UUIDs present a more
> efficient way to assign UUID in trace records.[1]
>
> Replace memcpy's with the use of static data.
>
> [1] https://lore.kernel.org/all/[email protected]/
>
> Suggested-by: Jonathan Cameron <[email protected]>
> Signed-off-by: Ira Weiny <[email protected]>

Reviewed-by: Dave Jiang <[email protected]>
> ---
> drivers/cxl/core/trace.h | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/cxl/core/trace.h b/drivers/cxl/core/trace.h
> index 89445435303a..bdf117a33744 100644
> --- a/drivers/cxl/core/trace.h
> +++ b/drivers/cxl/core/trace.h
> @@ -338,7 +338,7 @@ TRACE_EVENT(cxl_general_media,
>
> TP_fast_assign(
> CXL_EVT_TP_fast_assign(cxlmd, log, rec->hdr);
> - memcpy(&__entry->hdr_uuid, &CXL_EVENT_GEN_MEDIA_UUID, sizeof(uuid_t));
> + __entry->hdr_uuid = CXL_EVENT_GEN_MEDIA_UUID;
>
> /* General Media */
> __entry->dpa = le64_to_cpu(rec->phys_addr);
> @@ -425,7 +425,7 @@ TRACE_EVENT(cxl_dram,
>
> TP_fast_assign(
> CXL_EVT_TP_fast_assign(cxlmd, log, rec->hdr);
> - memcpy(&__entry->hdr_uuid, &CXL_EVENT_DRAM_UUID, sizeof(uuid_t));
> + __entry->hdr_uuid = CXL_EVENT_DRAM_UUID;
>
> /* DRAM */
> __entry->dpa = le64_to_cpu(rec->phys_addr);
> @@ -573,7 +573,7 @@ TRACE_EVENT(cxl_memory_module,
>
> TP_fast_assign(
> CXL_EVT_TP_fast_assign(cxlmd, log, rec->hdr);
> - memcpy(&__entry->hdr_uuid, &CXL_EVENT_MEM_MODULE_UUID, sizeof(uuid_t));
> + __entry->hdr_uuid = CXL_EVENT_MEM_MODULE_UUID;
>
> /* Memory Module Event */
> __entry->event_type = rec->event_type;
>