All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cristian Marussi <cristian.marussi@arm.com>
To: Elif Topuz <elif.topuz@arm.com>
Cc: Cristian Marussi <cristian.marussi@arm.com>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, arm-scmi@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, sudeep.holla@arm.com,
	james.quinlan@broadcom.com, f.fainelli@gmail.com,
	vincent.guittot@linaro.org, etienne.carriere@st.com,
	peng.fan@oss.nxp.com, michal.simek@amd.com,
	dan.carpenter@linaro.org, d-gole@ti.com,
	jonathan.cameron@huawei.com, lukasz.luba@arm.com,
	philip.radford@arm.com, souvik.chakravarty@arm.com
Subject: Re: [PATCH v2 07/17] firmware: arm_scmi: Use new Telemetry traces
Date: Thu, 26 Mar 2026 15:35:42 +0000	[thread overview]
Message-ID: <acVSTu5oqeZ6jA9f@pluto> (raw)
In-Reply-To: <3c6bddfd-a674-486c-add4-35ef93ec88c4@arm.com>

On Fri, Jan 23, 2026 at 11:43:37AM +0000, Elif Topuz wrote:
> 
> Hi Cristian,

Hi Elif,

> 
> On 14/01/2026 11:46, Cristian Marussi wrote:
> > Track failed SHMTI accesses and received notifications.
> > 
> > Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
> > ---
> >  drivers/firmware/arm_scmi/telemetry.c | 57 ++++++++++++++++++++++-----
> >  1 file changed, 48 insertions(+), 9 deletions(-)
> > 
> > diff --git a/drivers/firmware/arm_scmi/telemetry.c b/drivers/firmware/arm_scmi/telemetry.c
> > index 16bcdcdc1dc3..443e032a3553 100644
> > --- a/drivers/firmware/arm_scmi/telemetry.c
> > +++ b/drivers/firmware/arm_scmi/telemetry.c
> > @@ -25,6 +25,8 @@
> >  #include "protocols.h"
> >  #include "notify.h"
> >  
> > +#include <trace/events/scmi.h>
> > +
> >  /* Updated only after ALL the mandatory features for that version are merged */
> >  #define SCMI_PROTOCOL_SUPPORTED_VERSION		0x10000
> >  
> > @@ -1366,8 +1368,10 @@ static void scmi_telemetry_tdcf_blkts_parse(struct telemetry_info *ti,
> >  
> >  	/* Check for spec compliance */
> >  	if (USE_LINE_TS(payld) || USE_BLK_TS(payld) ||
> > -	    DATA_INVALID(payld) || (PAYLD_ID(payld) != 0))
> > +	    DATA_INVALID(payld) || (PAYLD_ID(payld) != 0)) {
> > +		trace_scmi_tlm_access(0, "BLK_TS_INVALID", 0, 0);
> >  		return;
> > +	}
> >  
> >  	/* A BLK_TS descriptor MUST be returned: it is found or it is crated */
> >  	bts = scmi_telemetry_blkts_lookup(ti->ph->dev, &ti->xa_bts, payld);
> > @@ -1376,6 +1380,9 @@ static void scmi_telemetry_tdcf_blkts_parse(struct telemetry_info *ti,
> >  
> >  	/* Update the descriptor with the lastest TS*/
> >  	scmi_telemetry_blkts_update(shmti->last_magic, bts);
> > +
> > +	trace_scmi_tlm_collect(bts->last_ts, (u64)payld,
> > +			       bts->last_magic, "SHMTI_BLK_TS");
> >  }
> >  
> >  static void scmi_telemetry_tdcf_data_parse(struct telemetry_info *ti,
> > @@ -1393,8 +1400,10 @@ static void scmi_telemetry_tdcf_data_parse(struct telemetry_info *ti,
> >  	/* Is thi DE ID know ? */
> >  	tde = scmi_telemetry_tde_lookup(ti, de_id);
> >  	if (!tde) {
> > -		if (mode != SCAN_DISCOVERY)
> > +		if (mode != SCAN_DISCOVERY) {
> > +			trace_scmi_tlm_access(de_id, "DE_INVALID", 0, 0);
> >  			return;
> > +		}
> >  
> >  		/* In SCAN_DISCOVERY mode we allocate new DEs for unknown IDs */
> >  		tde = scmi_telemetry_tde_get(ti, de_id);
> > @@ -1462,6 +1471,8 @@ static void scmi_telemetry_tdcf_data_parse(struct telemetry_info *ti,
> >  		tde->last_ts = tstamp;
> >  	else
> >  		tde->last_ts = 0;
> > +
> > +	trace_scmi_tlm_collect(0, tde->de.info->id, tde->last_val, "SHMTI_DE_UPDT");
> 
> tde->last_ts instead of 0?
>

Yes, but I have reworked a lot the code so the traces also are moved
around a lot with different tags...also I move the trace definitions
before the protocol series in V3 and scattered the trace calls all
across the protocol patches, which I split a lot.
 
I tried anyway to follow your advice...well..anyway I doubt V3 will be
the last one :P, so you're welcome to complain...

> >  }
> >  
> >  static int scmi_telemetry_tdcf_line_parse(struct telemetry_info *ti,
> > @@ -1507,8 +1518,10 @@ static int scmi_telemetry_shmti_scan(struct telemetry_info *ti,
> >  		fsleep((SCMI_TLM_TDCF_MAX_RETRIES - retries) * 1000);
> >  
> >  		startm = TDCF_START_SEQ_GET(tdcf);
> > -		if (IS_BAD_START_SEQ(startm))
> > +		if (IS_BAD_START_SEQ(startm)) {
> > +			trace_scmi_tlm_access(0, "MSEQ_BADSTART", startm, 0);
> >  			continue;
> > +		}
> >  
> >  		/* On a BAD_SEQ this will be updated on the next attempt */
> >  		shmti->last_magic = startm;
> > @@ -1520,18 +1533,25 @@ static int scmi_telemetry_shmti_scan(struct telemetry_info *ti,
> >  
> >  			used_qwords = scmi_telemetry_tdcf_line_parse(ti, next,
> >  								     shmti, mode);
> > -			if (qwords < used_qwords)
> > +			if (qwords < used_qwords) {
> > +				trace_scmi_tlm_access(PAYLD_ID(next),
> > +						      "BAD_QWORDS", startm, 0);
> >  				return -EINVAL;
> > +			}
> >  
> >  			next += used_qwords * 8;
> >  			qwords -= used_qwords;
> >  		}
> >  
> >  		endm = TDCF_END_SEQ_GET(eplg);
> > +		if (startm != endm)
> > +			trace_scmi_tlm_access(0, "MSEQ_MISMATCH", startm, endm);
> >  	} while (startm != endm && --retries);
> >  
> > -	if (startm != endm)
> > +	if (startm != endm) {
> > +		trace_scmi_tlm_access(0, "TDCF_SCAN_FAIL", startm, endm);
> >  		return -EPROTO;
> > +	}
> >  
> >  	return 0;
> >  }
> > @@ -1923,6 +1943,8 @@ static void scmi_telemetry_scan_update(struct telemetry_info *ti, u64 ts)
> >  			tde->last_ts = tstamp;
> >  		else
> >  			tde->last_ts = 0;
> > +
> > +		trace_scmi_tlm_collect(ts, tde->de.info->id, tde->last_val, "FC_UPDATE");
> 
> tde->last_ts instead of ts?

Yes...but a lot of rework as said above...

> 
> >  	}
> >  }
> >  
> > @@ -2001,8 +2023,11 @@ static int scmi_telemetry_tdcf_de_parse(struct telemetry_de *tde,
> >  		fsleep((SCMI_TLM_TDCF_MAX_RETRIES - retries) * 1000);
> >  
> >  		startm = TDCF_START_SEQ_GET(tdcf);
> > -		if (IS_BAD_START_SEQ(startm))
> > +		if (IS_BAD_START_SEQ(startm)) {
> > +			trace_scmi_tlm_access(tde->de.info->id, "MSEQ_BADSTART",
> > +					      startm, 0);
> >  			continue;
> > +		}
> >  
> >  		/* Has anything changed at all at the SHMTI level ? */
> >  		scoped_guard(mutex, &tde->mtx) {
> > @@ -2018,11 +2043,16 @@ static int scmi_telemetry_tdcf_de_parse(struct telemetry_de *tde,
> >  		if (DATA_INVALID(payld))
> >  			return -EINVAL;
> >  
> > -		if (IS_BLK_TS(payld))
> > +		if (IS_BLK_TS(payld)) {
> > +			trace_scmi_tlm_access(tde->de.info->id,
> > +					      "BAD_DE_META", 0, 0);
> >  			return -EINVAL;
> > +		}
> >  
> > -		if (PAYLD_ID(payld) != tde->de.info->id)
> > +		if (PAYLD_ID(payld) != tde->de.info->id) {
> > +			trace_scmi_tlm_access(tde->de.info->id, "DE_INVALID", 0, 0);
> >  			return -EINVAL;
> > +		}
> >  
> >  		/* Data is always valid since NOT handling BLK TS lines here */
> >  		*val = LINE_DATA_GET(&payld->l);
> > @@ -2046,10 +2076,16 @@ static int scmi_telemetry_tdcf_de_parse(struct telemetry_de *tde,
> >  		}
> >  
> >  		endm = TDCF_END_SEQ_GET(tde->eplg);
> > +		if (startm != endm)
> > +			trace_scmi_tlm_access(tde->de.info->id, "MSEQ_MISMATCH",
> > +					      startm, endm);
> >  	} while (startm != endm && --retries);
> >  
> > -	if (startm != endm)
> > +	if (startm != endm) {
> > +		trace_scmi_tlm_access(tde->de.info->id, "TDCF_DE_FAIL",
> > +				      startm, endm);
> >  		return -EPROTO;
> > +	}
> >  
> >  	guard(mutex)(&tde->mtx);
> >  	tde->last_magic = startm;
> > @@ -2230,6 +2266,9 @@ scmi_telemetry_msg_payld_process(struct telemetry_info *ti,
> >  			tde->last_ts = LINE_TSTAMP_GET(&payld->tsl);
> >  		else
> >  			tde->last_ts = 0;
> > +
> > +		trace_scmi_tlm_collect(timestamp, tde->de.info->id, tde->last_val,
> > +				       "MESSAGE");
> 
> tde->last_ts instead of timestamp? If I understand correctly, tde->last_ts
> corresponds to the time coming from the platform. We have kernel time anyway
> coming from ftrace format.

Yes good point...timestamp is the time of arrival of the
notification...I can also drop that parameter at this point...

Thanks a lot for reviewing !
Cristian

  reply	other threads:[~2026-03-26 15:35 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-14 11:46 [PATCH v2 00/17] Introduce SCMI Telemetry FS support Cristian Marussi
2026-01-14 11:46 ` [PATCH v2 01/17] firmware: arm_scmi: Define a common SCMI_MAX_PROTOCOLS value Cristian Marussi
2026-01-19 11:18   ` Jonathan Cameron
2026-01-19 15:43     ` Cristian Marussi
2026-01-20  6:44     ` Dhruva Gole
2026-01-20 10:55       ` Cristian Marussi
2026-01-14 11:46 ` [PATCH v2 02/17] firmware: arm_scmi: Reduce the scope of protocols mutex Cristian Marussi
2026-01-19 11:21   ` Jonathan Cameron
2026-01-19 15:45     ` Cristian Marussi
2026-01-14 11:46 ` [PATCH v2 03/17] firmware: arm_scmi: Allow protocols to register for notifications Cristian Marussi
2026-01-19 11:33   ` Jonathan Cameron
2026-01-19 15:49     ` Cristian Marussi
2026-01-14 11:46 ` [PATCH v2 04/17] uapi: Add ARM SCMI definitions Cristian Marussi
2026-01-19 11:43   ` Jonathan Cameron
2026-01-19 15:51     ` Cristian Marussi
2026-01-14 11:46 ` [PATCH v2 05/17] firmware: arm_scmi: Add Telemetry protocol support Cristian Marussi
2026-01-19 16:29   ` Jonathan Cameron
2026-01-19 18:25     ` Cristian Marussi
2026-01-23 11:00   ` Elif Topuz
2026-03-26 13:32     ` Cristian Marussi
2026-01-14 11:46 ` [PATCH v2 06/17] include: trace: Add Telemetry trace events Cristian Marussi
2026-01-14 11:46 ` [PATCH v2 07/17] firmware: arm_scmi: Use new Telemetry traces Cristian Marussi
2026-01-16 20:01   ` kernel test robot
2026-01-23 11:43   ` Elif Topuz
2026-03-26 15:35     ` Cristian Marussi [this message]
2026-01-14 11:46 ` [PATCH v2 08/17] firmware: arm_scmi: Add System Telemetry driver Cristian Marussi
2026-01-14 11:46 ` [PATCH v2 09/17] fs/stlmfs: Document ARM SCMI Telemetry filesystem Cristian Marussi
2026-01-14 11:46 ` [PATCH v2 10/17] firmware: arm_scmi: Add System Telemetry ioctls support Cristian Marussi
2026-01-14 11:46 ` [PATCH v2 11/17] fs/stlmfs: Document alternative ioctl based binary interface Cristian Marussi
2026-01-14 11:46 ` [PATCH v2 12/17] firmware: arm_scmi: Add Telemetry components view Cristian Marussi
2026-01-16 13:35   ` Elif Topuz
2026-01-19 15:42     ` Cristian Marussi
2026-01-16 22:02   ` kernel test robot
2026-01-19  6:39     ` Dan Carpenter
2026-01-19 16:07     ` Cristian Marussi
2026-01-14 11:46 ` [PATCH v2 13/17] fs/stlmfs: Document alternative topological view Cristian Marussi
2026-01-14 11:46 ` [PATCH v2 14/17] [RFC] docs: stlmfs: Document ARM SCMI Telemetry FS ABI Cristian Marussi
2026-01-14 11:46 ` [PATCH v2 15/17] [RFC] firmware: arm_scmi: Add lazy population support to Telemetry FS Cristian Marussi
2026-01-14 11:46 ` [PATCH v2 16/17] fs/stlmfs: Document lazy mode and related mount option Cristian Marussi
2026-01-14 11:46 ` [PATCH v2 17/17] [RFC] tools/scmi: Add SCMI Telemetry testing tool Cristian Marussi

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=acVSTu5oqeZ6jA9f@pluto \
    --to=cristian.marussi@arm.com \
    --cc=arm-scmi@vger.kernel.org \
    --cc=d-gole@ti.com \
    --cc=dan.carpenter@linaro.org \
    --cc=elif.topuz@arm.com \
    --cc=etienne.carriere@st.com \
    --cc=f.fainelli@gmail.com \
    --cc=james.quinlan@broadcom.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=michal.simek@amd.com \
    --cc=peng.fan@oss.nxp.com \
    --cc=philip.radford@arm.com \
    --cc=souvik.chakravarty@arm.com \
    --cc=sudeep.holla@arm.com \
    --cc=vincent.guittot@linaro.org \
    /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 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.