mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alison Schofield <alison.schofield@intel.com>
To: Anisa Su <anisa.su887@gmail.com>
Cc: <linux-cxl@vger.kernel.org>, <nvdimm@lists.linux.dev>,
	<linux-kernel@vger.kernel.org>, Dave Jiang <dave.jiang@intel.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	Davidlohr Bueso <dave@stgolabs.net>,
	Ira Weiny <iweiny@kernel.org>,
	Vishal Verma <vishal.l.verma@intel.com>,
	Fan Ni <nifan.cxl@gmail.com>, Li Ming <ming.li@zohomail.com>,
	Benjamin Cheatham <benjamin.cheatham@amd.com>,
	Gregory Price <gourry@gourry.net>,
	Richard Cheng <icheng@nvidia.com>,
	Anisa Su <anisa.su@samsung.com>
Subject: Re: [PATCH v1 13/14] cxl/mem: Trace Dynamic capacity Event Record
Date: Mon, 30 Nov 2026 14:29:38 -0800	[thread overview]
Message-ID: <aw340jP4CUdEWisT@aschofie-mobl2.lan> (raw)
In-Reply-To: <20261104230445.66625-14-anisa.su@samsung.com>

On Thu, Nov 05, 2026 at 08:02:37AM +0900, Anisa Su wrote:
> From: Ira Weiny <iweiny@kernel.org>
> 
> CXL r4.0 section 8.2.10.2.1.6 defines the Dynamic Capacity Event Record.
> User space can use trace events for debugging of DC capacity changes.

'DC capacity' expands to 'Dynamic Capacity capacity', just write
dynamic capacity changes.

snip


> 
> Add DC trace points to the trace log.
> 
> Based on an original patch by Navneet Singh.
> 
> Signed-off-by: Ira Weiny <iweiny@kernel.org>
> Co-developed-by: Anisa Su <anisa.su@samsung.com>
> Signed-off-by: Anisa Su <anisa.su@samsung.com>
> Tested-by: Wonjae Lee <wj28.lee@samsung.com>
> Tested-by: Junhee Park <jh9934.park@samsung.com>
> Tested-by: Heesoo Kim <habil.kim@samsung.com>
> ---
>  drivers/cxl/core/mbox.c  |  4 +++
>  drivers/cxl/core/trace.h | 76 ++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 80 insertions(+)
> 
> diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
> index a18b41ff5d23..c60c10d7bd31 100644
> --- a/drivers/cxl/core/mbox.c
> +++ b/drivers/cxl/core/mbox.c
> @@ -1041,6 +1041,10 @@ static void __cxl_event_trace_record(struct cxl_memdev *cxlmd,
>  		ev_type = CXL_CPER_EVENT_MEM_MODULE;
>  	else if (uuid_equal(uuid, &CXL_EVENT_MEM_SPARING_UUID))
>  		ev_type = CXL_CPER_EVENT_MEM_SPARING;
> +	else if (uuid_equal(uuid, &CXL_EVENT_DC_EVENT_UUID)) {
> +		trace_cxl_dynamic_capacity(cxlmd, type, &record->event.dcd);
> +		return;
> +	}
>  
>  	cxl_event_trace_record(cxlmd, type, ev_type, uuid, &record->event);
>  }
> diff --git a/drivers/cxl/core/trace.h b/drivers/cxl/core/trace.h
> index 64c6ce0878e2..d7b237203bb5 100644
> --- a/drivers/cxl/core/trace.h
> +++ b/drivers/cxl/core/trace.h
> @@ -1108,6 +1108,82 @@ TRACE_EVENT(cxl_poison,
>  	)
>  );
>  
> +/*
> + * Dynamic Capacity Event Record - DER


"DER" in this comment is the DRAM Event Record's acronym; the other
records use their own initials (GMER, MMER, MSER).  DCER?


> + *
> + * CXL r4.0 section 8.2.10.2.1.6 Table 8-229
> + */
> +
> +TRACE_DEFINE_ENUM(DCD_ADD_CAPACITY);
> +TRACE_DEFINE_ENUM(DCD_RELEASE_CAPACITY);
> +TRACE_DEFINE_ENUM(DCD_FORCED_CAPACITY_RELEASE);
> +TRACE_DEFINE_ENUM(DCD_REGION_CONFIGURATION_UPDATED);
> +
> +#define show_dc_evt_type(type)	__print_symbolic(type,				\
> +	{ DCD_ADD_CAPACITY,			"Add capacity" },		\
> +	{ DCD_RELEASE_CAPACITY,			"Release capacity" },		\
> +	{ DCD_FORCED_CAPACITY_RELEASE,		"Forced capacity release" },	\
> +	{ DCD_REGION_CONFIGURATION_UPDATED,	"Region Configuration Updated" } \
> +)

Inconsistent strings, suggest
s/Region Configuration Updated/Region configuration updated


> +
> +TRACE_EVENT(cxl_dynamic_capacity,
> +
> +	TP_PROTO(const struct cxl_memdev *cxlmd, enum cxl_event_log_type log,
> +		 struct cxl_event_dcd *rec),
> +
> +	TP_ARGS(cxlmd, log, rec),
> +
> +	TP_STRUCT__entry(
> +		CXL_EVT_TP_entry
> +
> +		/* Dynamic capacity Event */
> +		__field(u8, event_type)
> +		__field(u16, hostid)

Is Host ID ever valid in any record the host receives. Table 8-229
defines it only for Add Capacity Response and Capacity Released, and
those are reported only to the FM. Drop field?

> +		__field(u8, updated_region_index)
> +		__field(u64, dpa_start)
> +		__field(u64, length)
> +		__array(u8, uuid, UUID_SIZE)
> +		__field(u16, sh_extent_seq)
> +	),


flags byte is missing above. That's where MORE bit is.
Other record tracepoints in this file record validity_flags.


> +
> +	TP_fast_assign(
> +		CXL_EVT_TP_fast_assign(cxlmd, log, rec->hdr);
> +		__entry->hdr_uuid = CXL_EVENT_DC_EVENT_UUID;
> +
> +		/* Dynamic_capacity Event */
> +		__entry->event_type = rec->event_type;
> +
> +		/* DCD event record data */
> +		__entry->hostid = le16_to_cpu(rec->host_id);
> +		/*
> +		 * The Updated Region Index is only defined for Region
> +		 * Configuration Updated events (Table 8-229); report U8_MAX
> +		 * (not a valid index) for other event types where the field
> +		 * is reserved.
> +		 */
> +		if (rec->event_type == DCD_REGION_CONFIGURATION_UPDATED)
> +			__entry->updated_region_index = rec->updated_region_index;
> +		else
> +			__entry->updated_region_index = U8_MAX;
> +		__entry->dpa_start = le64_to_cpu(rec->extent.start_dpa);
> +		__entry->length = le64_to_cpu(rec->extent.length);
> +		memcpy(__entry->uuid, &rec->extent.uuid, UUID_SIZE);
> +		__entry->sh_extent_seq = le16_to_cpu(rec->extent.shared_extn_seq);
> +	),
> +
> +	CXL_EVT_TP_printk("event_type='%s' host_id='%d' updated_region_index='%d' " \
> +		"starting_dpa=%llx length=%llx tag=%pU " \
> +		"shared_extent_sequence=%d",
> +		show_dc_evt_type(__entry->event_type),
> +		__entry->hostid,
> +		__entry->updated_region_index,
> +		__entry->dpa_start,
> +		__entry->length,
> +		__entry->uuid,
> +		__entry->sh_extent_seq
> +	)

Tidy up namings...
sh_extent_seq in the entry, shared_extent_sequence in the output and
shared_extn_seq in struct cxl_extent. Make the entry fields match the
record fields?


> +);
> +
>  #endif /* _CXL_EVENTS_H */
>  
>  #define TRACE_INCLUDE_FILE trace
> -- 
> 2.43.0
> 

  reply	other threads:[~2026-11-30 22:29 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04 23:02 [PATCH v1 00/14] DCD CXL Series: Dynamic Capacity extent handling Anisa Su
2026-11-04 23:02 ` [PATCH v1 01/14] cxl/core: Return endpoint decoder information from region search Anisa Su
2026-11-24 18:31   ` Alison Schofield
2026-11-04 23:02 ` [PATCH v1 02/14] cxl/port: Add dynamic capacity options to endpoint decoder mode Anisa Su
2026-11-17  2:22   ` Jonathan Cameron
2026-11-24 18:36   ` Alison Schofield
2026-11-04 23:02 ` [PATCH v1 03/14] cxl/region: Add dynamic DAX region support Anisa Su
2026-11-17  2:32   ` Jonathan Cameron
2026-11-24 18:55   ` Alison Schofield
2026-11-04 23:02 ` [PATCH v1 04/14] cxl/mem: Introduce DC event handlers Anisa Su
2026-11-17  2:54   ` Jonathan Cameron
2026-11-24 19:29   ` Alison Schofield
2026-11-04 23:02 ` [PATCH v1 05/14] cxl/mem: Add 20 second timeout for stalled DC event chains Anisa Su
2026-11-17  3:00   ` Jonathan Cameron
2026-11-20 20:47     ` Anisa Su
2026-11-24 19:30   ` Alison Schofield
2026-11-04 23:02 ` [PATCH v1 06/14] cxl/extent: Handle DC Add Capacity events Anisa Su
2026-11-12  3:34   ` Richard Cheng
2026-11-16 21:53     ` Anisa Su
2026-11-30 19:54   ` Alison Schofield
2026-11-04 23:02 ` [PATCH v1 07/14] cxl/mem: Drop misaligned DCD extent groups Anisa Su
2026-11-30 19:58   ` Alison Schofield
2026-11-04 23:02 ` [PATCH v1 08/14] cxl/extent: Validate DC extent partition Anisa Su
2026-11-30 20:13   ` Alison Schofield
2026-11-04 23:02 ` [PATCH v1 09/14] cxl/mem: Enforce tag-group semantics Anisa Su
2026-11-30 20:45   ` Alison Schofield
2026-11-04 23:02 ` [PATCH v1 10/14] cxl/extent: Enforce cross-region tag uniqueness Anisa Su
2026-11-30 21:01   ` Alison Schofield
2026-11-04 23:02 ` [PATCH v1 11/14] cxl/extent: Handle DC Release Capacity events Anisa Su
2026-11-12  7:34   ` Richard Cheng
2026-11-30 21:31   ` Alison Schofield
2026-11-04 23:02 ` [PATCH v1 12/14] cxl/region: Read existing extents on region creation Anisa Su
2026-11-30 22:07   ` Alison Schofield
2026-11-04 23:02 ` [PATCH v1 13/14] cxl/mem: Trace Dynamic capacity Event Record Anisa Su
2026-11-30 22:29   ` Alison Schofield [this message]
2026-11-04 23:02 ` [PATCH v1 14/14] Documentation/cxl: Document DCD extent handling Anisa Su

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aw340jP4CUdEWisT@aschofie-mobl2.lan \
    --to=alison.schofield@intel.com \
    --cc=anisa.su887@gmail.com \
    --cc=anisa.su@samsung.com \
    --cc=benjamin.cheatham@amd.com \
    --cc=dave.jiang@intel.com \
    --cc=dave@stgolabs.net \
    --cc=gourry@gourry.net \
    --cc=icheng@nvidia.com \
    --cc=iweiny@kernel.org \
    --cc=jic23@kernel.org \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.li@zohomail.com \
    --cc=nifan.cxl@gmail.com \
    --cc=nvdimm@lists.linux.dev \
    --cc=vishal.l.verma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®