Linux Documentation
 help / color / mirror / Atom feed
From: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
To: Cristian Marussi <cristian.marussi@arm.com>
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, arm-scmi@vger.kernel.org,
	linux-doc@vger.kernel.org, sudeep.holla@kernel.org,
	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, d-gole@ti.com,
	elif.topuz@arm.com, lukasz.luba@arm.com, philip.radford@arm.com,
	david@kernel.org, souvik.chakravarty@arm.com, leitao@kernel.org,
	kas@kernel.org, puranjay@kernel.org, usama.arif@linux.dev,
	kernel-team@meta.com
Subject: Re: [PATCH v15 10/35] firmware: arm_scmi: Add Telemetry resources enumeration
Date: Wed, 18 Nov 2026 09:26:23 -0800	[thread overview]
Message-ID: <20261118092623.00000cc4@oss.qualcomm.com> (raw)
In-Reply-To: <av1rTY1cZjRbxzD6@pluto>

On Wed, 18 Nov 2026 09:09:33 +0000
Cristian Marussi <cristian.marussi@arm.com> wrote:

> On Mon, Nov 16, 2026 at 01:36:38PM -0800, Jonathan Cameron wrote:
> > On Thu, 12 Nov 2026 19:56:10 +0000
> > Cristian Marussi <cristian.marussi@arm.com> wrote:
> >   
> 
> Hi,
> 
> > > On Thu, Nov 12, 2026 at 10:01:45AM -0800, Jonathan Cameron wrote:  
> > > > On Mon,  9 Nov 2026 09:11:56 +0000
> > > > Cristian Marussi <cristian.marussi@arm.com> wrote:
> > > >     
> > > > > Add basic Telemetry allocation and initialization routines, introducing and
> > > > > wiring-up the logic needed to enumerate all the SCMI Telemetry resources
> > > > > optionally using a lazy on-demand scheme: this approach factors in the
> > > > > flexibility needed to minimize the amount of initialization work based on
> > > > > the effective access pattern used by the upper layer ABI.
> > > > > 
> > > > > Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>    
> > > > 
> > > > Hi Cristian,
> > > > 
> > > > This stretches across the patch set but first elements related to it are
> > > > in this patch.  How do we handle larger values of de_data_sz?
> > > >     
> > > 
> > > We dont. This was somethig that was on my todo list initially, but then
> > > I realized that there was NO FW-side plan to actually implement anything
> > > larger than 64bit.  
> > 
> > Understood, some set of firmware that you have isn't doing this. I don't
> > necessarily mind not supporting it initially but like the other features
> > it is very useful to have an implementation to make sure it doesn't break
> > the ABI. I don't want to go through a 'move to version 2 ABI if you want
> > this feature' path.
> >  
> 
> Agreed that it would be better if avoided.
>  
> > Let's just say I hit this for a reason. Whether that reason makes it into
> > a production firmware is an open question at the moment.
> > 
> > FWIW I have both QEMU based emulation (I'm working through the process to be
> > able to share that) and the changes to fit in via what I think is the
> > cleanest ABI change. Kernel / userspace change below.
> > I modified this from my original proposal to take into account the
> > desire to add it later (even if to me it smells like papering over a bug
> > rather than adding a feature!).  See below for what that required.
> > Not only shmti is tested.  The LLM found bugs in it's own fast channel
> > code, so take that with a pinch of salt!
> >  
> 
> I skimmed through your patch and it is mostly in line with what I was
> imagining (not even protyped though), i.e. in a nutshell
> 
>  - an ABI feature bit to add MUTIWORD support
>  - a flag bit to activate this feature on all _READ IOCTLs at will
>  - a repurpose of the pad field in scmi_tlm_sample
> 
> What I find awkward is the usage of pad as an index: that will expose
> a lot of duplicate data since all DEs multi-words are now scattered
> through a number of sample with the same ID and TS, and a bit cumbersome
> to handle in userspace to reconstruct the multi-word value.
> 
> My non-tested-nor-prototyped idea was instead to repurpose the pad field
> as a length, so as to pack all the multi-words payload as the trailing
> part of a flexible array member (an extrnal array really being an ABI)
> and use a single structure to read a complete DE.
> 
> In this case the problem would be to maintain backward compatibility
> with the current scmi_tlm_de_sample.

Indeed, that's what drove the just using an index approach.

> 
> At first I was thinking that we could simply introduce a new alternative
> scmi_tlm_de_multi_sample structure that is used in place of the current
> scmi_tlm_de_sample ONLY when feataure bits is available AND requested: so
> userspace knows that when sets flag.MULTIWORD it has to use the
> multi-word structure in input where pad is a length and there are multipe vals.
> 
> While this would work for all the bulk ops since they take a __u64 pointer
> to a payload structure really (so it does NOT really matter what they are
> carrying as long as it is consistent with the advertised feature bits and
> request flag),  it CANNOT work for DE_READ where scmi_tlm_de_sample is
> used directly...so a change in the current, not-merged, ABI would be
> needed anyway....
> 
> Then...I thought that maybe we dont even need this...and this part could be
> judged horrific maybe, so feel free to stop reading if your eyes starts
> bleeding :P
> 
> Currently we have
> 
> struct scmi_tlm_de_sample {                                                      
>         __u32 id;                                                                
>         __u32 pad;                                                               
>         __u64 tstamp;                                                            
>         __u64 val;                                                               
> };                     
> 
> with pad being unused and the whole structure that can be used alone
> or packed into a container struct.
> 
> WHAT IF... when MULTIWORD feature is enabled AND requested we repurpose
> the meaning NOT ONLY of <pad> but also of <val> and use this latter NOT
> as a payload for a single value returned but as a pointer to an external
> array of words counted by pad ?
> 
> The structure size remains the same, while its interpretation vary based
> on the requested flag when such feature is available.
> 
> It may be a bit cumbersome still on userspace for bulk requests since
> scmi_tlm_batch will contain a pointer to an array of possibly varied
> sized items, so item_sz represents the common basic scmi_tlm_de_sample
> size which in turn carries the sizing inside the repurposed <pad>
> field inside for each single sample item

Are they variable sized, or indirections?   Today I think
scmi_tlm_data_read() simply points to an array of scmi_tlm_de_sample.
In this scheme it continues to do that but some of those then have
pointers on to additional storage.  That's a more complex beast
to manage. 

> 
> ...so you can anyway check the provided user-input sizes it is just
> scattered all over and as a consequence also the user provided data
> would have to be a bit fragmented since 
> 
>  - batch points to an array of scmi_tlm_de_sample sized by items_sz
>  - each sample in turn points to its array of values sized by <pad>
I read this as implying they all do this including the small ones.

>  - you can really mix both kind of DEs in the same request: some
>    can carry the single word value embedded in val, multiwords can
>    point to teh <pad> sized external array.

But nope.  It is a grab bag of different types that happen to be
the same length.

> 
> ...mmm sort of start liking this hoorr...or I am missing something ?
> 
> ... O_o ... it would need a tad of documentation of course ...

Quite a bit!  And probably a helper library.

> 
> If you have not fainted in despair, I (and some LLM) could prototype
> something like this in one of the next series ... certainly not in V16.
> 
> ... thoughts ? insults ? :P

It's an option.  More compact than the index one, though overheads of
allocations might undo that unless they tend to be many line DEs
and does avoid duplication of the metadata and timestamp (if there) which
are guaranteed to match in every line.  Give we are trending towards
basically having this breaking ABI change (be it with an opt in)
it maybe comes down to invasiveness of changes in userspace that would
be needed to accommodate it.

Probably a case for a prototype and see what it looks like.

Anyhow, I guess now we have two options on the table we can conclude
it is 'probably' going to be a safe ABI extension to make in a follow
up series.  Not ideal, but I'd rather this didn't substantially slow
down the progress to getting to full feature set.

Jonathan


> 
> Thanks,
> Cristian


  reply	other threads:[~2026-11-18 17:26 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09  9:11 [PATCH v15 00/35] Introduce SCMI Telemetry support Cristian Marussi
2026-11-09  9:11 ` [PATCH v15 01/35] firmware: arm_scmi: Harden iterators state parsing Cristian Marussi
2026-11-09 21:57   ` Jonathan Cameron
2026-11-10  8:19     ` Cristian Marussi
2026-11-09  9:11 ` [PATCH v15 02/35] firmware: arm_scmi: Add new SCMIv4.0 error codes definitions Cristian Marussi
2026-11-09  9:11 ` [PATCH v15 03/35] firmware: arm_scmi: Introduce a dedicated SCMI Errors header Cristian Marussi
2026-11-09 22:01   ` Jonathan Cameron
2026-11-10  8:23     ` Cristian Marussi
2026-11-09  9:11 ` [PATCH v15 04/35] firmware: arm_scmi: Allow registration of unknown-size events/reports Cristian Marussi
2026-11-09 22:07   ` Jonathan Cameron
2026-11-10  8:27     ` Cristian Marussi
2026-11-09  9:11 ` [PATCH v15 05/35] firmware: arm_scmi: Refactor __scmi_event_handler_get_ops helper Cristian Marussi
2026-11-09  9:11 ` [PATCH v15 06/35] firmware: arm_scmi: Introduce protocol instance notifiers Cristian Marussi
2026-11-09 23:32   ` Jonathan Cameron
2026-11-09  9:11 ` [PATCH v15 07/35] dt-bindings: firmware: arm,scmi: Add support for telemetry protocol Cristian Marussi
2026-11-09  9:11 ` [PATCH v15 08/35] include: trace: Add Telemetry trace events Cristian Marussi
2026-11-09  9:11 ` [PATCH v15 09/35] firmware: arm_scmi: Add Telemetry basic attributes enumeration Cristian Marussi
2026-11-09 23:57   ` Jonathan Cameron
2026-11-09  9:11 ` [PATCH v15 10/35] firmware: arm_scmi: Add Telemetry resources enumeration Cristian Marussi
2026-11-10  1:36   ` Jonathan Cameron
2026-11-10 15:33     ` Cristian Marussi
2026-11-12 18:01   ` Jonathan Cameron
2026-11-12 19:56     ` Cristian Marussi
2026-11-16 21:36       ` Jonathan Cameron
2026-11-18  9:09         ` Cristian Marussi
2026-11-18 17:26           ` Jonathan Cameron [this message]
2026-11-09  9:11 ` [PATCH v15 11/35] firmware: arm_scmi: Add Telemetry groups initialization Cristian Marussi
2026-11-10  1:53   ` Jonathan Cameron
2026-11-09  9:11 ` [PATCH v15 12/35] firmware: arm_scmi: Add Telemetry update intervals enumeration Cristian Marussi
2026-11-10  2:07   ` Jonathan Cameron
2026-11-09  9:11 ` [PATCH v15 13/35] firmware: arm_scmi: Add Telemetry SHMTI areas enumeration Cristian Marussi
2026-11-10  2:26   ` Jonathan Cameron
2026-11-09  9:12 ` [PATCH v15 14/35] firmware: arm_scmi: Add Telemetry TDCF areas parsing support Cristian Marussi
2026-11-10 18:15   ` Jonathan Cameron
2026-11-09  9:12 ` [PATCH v15 15/35] firmware: arm_scmi: Add Telemetry TDCF parsing for BLK_TS lines Cristian Marussi
2026-11-10 18:33   ` Jonathan Cameron
2026-11-09  9:12 ` [PATCH v15 16/35] firmware: arm_scmi: Add Telemetry TDCF parsing for UUID lines Cristian Marussi
2026-11-10 18:49   ` Jonathan Cameron
2026-11-09  9:12 ` [PATCH v15 17/35] firmware: arm_scmi: Add Telemetry configuration operations Cristian Marussi
2026-11-10 20:07   ` Jonathan Cameron
2026-11-09  9:12 ` [PATCH v15 18/35] firmware: arm_scmi: Add Telemetry DataEvent read capabilities Cristian Marussi
2026-11-10 21:59   ` Jonathan Cameron
2026-11-12  4:30   ` Jonathan Cameron
2026-11-09  9:12 ` [PATCH v15 19/35] firmware: arm_scmi: Add Telemetry reset logic Cristian Marussi
2026-11-10 22:07   ` Jonathan Cameron
2026-11-09  9:12 ` [PATCH v15 20/35] firmware: arm_scmi: Add Telemetry notification support Cristian Marussi
2026-11-10 22:16   ` Jonathan Cameron
2026-11-09  9:12 ` [PATCH v15 21/35] firmware: arm_scmi: Add Telemetry boot-on support Cristian Marussi
2026-11-10 22:25   ` Jonathan Cameron
2026-11-09  9:12 ` [PATCH v15 22/35] firmware: arm-scmi: Add Telemetry generic event support Cristian Marussi
2026-11-10 22:33   ` Jonathan Cameron
2026-11-12 19:58     ` Cristian Marussi
2026-11-09  9:12 ` [PATCH v15 23/35] firmware: arm_scmi: Add Telemetry generation counter event Cristian Marussi
2026-11-10 22:46   ` Jonathan Cameron
2026-11-12 20:17     ` Cristian Marussi
2026-11-12 21:44       ` Jonathan Cameron
2026-11-09  9:12 ` [PATCH v15 24/35] firmware: arm_scmi: Add common per-protocol debugfs support Cristian Marussi
2026-11-10 22:50   ` Jonathan Cameron
2026-11-09  9:12 ` [PATCH v15 25/35] firmware: arm_scmi: Add Telemetry debugfs SHMTI dump support Cristian Marussi
2026-11-10 22:54   ` Jonathan Cameron
2026-11-09  9:12 ` [PATCH v15 26/35] firmware: arm_scmi: Add Telemetry debugfs ABI documentation Cristian Marussi
2026-11-10 22:55   ` Jonathan Cameron
2026-11-09  9:12 ` [PATCH v15 27/35] firmware: arm_scmi: Expose per-instance identifier Cristian Marussi
2026-11-10 22:57   ` Jonathan Cameron
2026-11-09  9:12 ` [PATCH v15 28/35] firmware: arm_scmi: Add un-managed methods to get/put protocols operations Cristian Marussi
2026-11-10 23:01   ` Jonathan Cameron
2026-11-10 23:18   ` Jonathan Cameron
2026-11-09  9:12 ` [PATCH v15 29/35] uapi: Add ARM SCMI Telemetry definitions Cristian Marussi
2026-11-10 23:13   ` Jonathan Cameron
2026-11-09  9:12 ` [PATCH v15 30/35] firmware: arm_scmi: Add System Telemetry driver Cristian Marussi
2026-11-10 23:46   ` Jonathan Cameron
2026-11-09  9:12 ` [PATCH v15 31/35] firmware: arm_scmi: Enable autoloading for " Cristian Marussi
2026-11-09  9:12 ` [PATCH v15 32/35] docs: ioctl-number: Add SCMI Ioctls Cristian Marussi
2026-11-09  9:12 ` [PATCH v15 33/35] Documentation: Add SCMI System Telemetry documentation Cristian Marussi
2026-11-10 23:54   ` Jonathan Cameron
2026-11-09  9:12 ` [PATCH v15 34/35] [RFC] kselftest/arm64: Add SCMI Telemetry UAPI compliance testcases Cristian Marussi
2026-11-11  0:13   ` Jonathan Cameron
2026-11-09  9:12 ` [PATCH v15 35/35] [RFC] tools/testing/scmi: Add SCMI Telemetry testing tool Cristian Marussi
2026-11-11  0:16   ` Jonathan Cameron
2026-11-11  0:38 ` [PATCH v15 00/35] Introduce SCMI Telemetry support Jonathan Cameron
2026-11-11  9:51   ` Sudeep Holla
2026-11-11 10:15   ` Cristian Marussi
2026-11-11 18:39     ` Jonathan Cameron
2026-11-17 12:43 ` Sudeep Holla
2026-11-17 13:10   ` Cristian Marussi
2026-11-18  1:07 ` Jonathan Cameron
2026-11-18  9:14   ` Cristian Marussi
2026-11-18  9:33   ` Sudeep Holla
2026-11-18 17:32     ` Jonathan Cameron

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=20261118092623.00000cc4@oss.qualcomm.com \
    --to=jonathan.cameron@oss.qualcomm.com \
    --cc=arm-scmi@vger.kernel.org \
    --cc=cristian.marussi@arm.com \
    --cc=d-gole@ti.com \
    --cc=david@kernel.org \
    --cc=elif.topuz@arm.com \
    --cc=etienne.carriere@st.com \
    --cc=f.fainelli@gmail.com \
    --cc=james.quinlan@broadcom.com \
    --cc=kas@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=leitao@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@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=puranjay@kernel.org \
    --cc=souvik.chakravarty@arm.com \
    --cc=sudeep.holla@kernel.org \
    --cc=usama.arif@linux.dev \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox