Re: [PATCH v10 14/24] firmware: arm_scmi: Add Telemetry generation counter event

Fayssal Benmlih <[email protected]>
Newsgroups org.kernel.vger.arm-scmi,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Hi Cristian,

The generation update issue reported on V7 appears unchanged in V10.

scmi_telemetry_generation_update() still performs:

        next = (atomic_read(&ti->info.generation) + 1) ?:
                SCMI_TLM_GENERATION_ONE;

followed by a separate atomic_set_release().

The read and update are not one atomic operation, so concurrent callers can
read the same generation and both store the same next value. The addition
is also evaluated using the signed value returned by atomic_read(), making
the INT_MAX transition problematic even though the intended counter has
u32 wrap semantics.

Serializing system-driver ioctls reduces some callers, but this helper is
part of the protocol implementation and should be correct independently of
that consumer.

Please use an atomic update or cmpxchg loop with explicit unsigned wrap and
zero-skipping semantics.

Thanks,
Fayçal
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.