Re: [PATCH v7 14/23] firmware: arm_scmi: Add Telemetry generation counter event
Fayssal Benmlih <[email protected]> Mon, 3 Aug 2026 22:56:19 +0000
| Newsgroups | gmane.linux.kernel,gmane.linux.ports.arm.kernel,gmane.linux.documentation |
|---|---|
| Message-ID | <[email protected]> |
Hi Cristian,
One concurrency issue with the generation update inline.
> static inline void
> scmi_telemetry_generation_update(struct telemetry_info *ti)
> {
> unsigned int next;
>
> /* Wrap around skipping invalid generation 0 */
> next = (atomic_read(&ti->info.generation) + 1) ?:
> SCMI_TLM_GENERATION_ONE;
>
> __scmi_telemetry_generation_set(ti, next);
> }
The read and update are separate atomic operations. Concurrent
configuration changes can both read the same generation and store the same
next value, losing an increment.
The addition is also performed on the signed value returned by
atomic_read() before conversion to unsigned, making the INT_MAX transition
problematic even though the intended counter is effectively u32.
Please use an atomic update operation or a cmpxchg loop with explicit
zero-skipping and wrap semantics.
Thanks,
Fayçal