[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251119180447.GG8204@e132581.arm.com>
Date: Wed, 19 Nov 2025 18:04:47 +0000
From: Leo Yan <leo.yan@....com>
To: Suzuki K Poulose <suzuki.poulose@....com>
Cc: Junhao He <hejunhao3@...artners.com>, james.clark@...aro.org,
anshuman.khandual@....com, yeoreum.yun@....com,
mike.leach@...aro.org, coresight@...ts.linaro.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linuxarm@...wei.com, jonathan.cameron@...wei.com
Subject: Re: [PATCH v4 2/3] coresight: tmc: refactor the tmc-etr mode setting
to avoid race conditions
On Thu, Nov 13, 2025 at 03:02:45PM +0000, Suzuki Kuruppassery Poulose wrote:
> Hi Junhao,
>
> While your patch fixes the problem it introduces imbalance in the
> way perf vs sysfs modes are handled.
Previously, I suggested setting the mode in a unified way in
tmc_enable_etr_sink() [1]. After looking into the code again, it seems
that both my suggestion and this patch set the perf mode is too late.
Maybe we need to set the sink's device mode once a session starts to use
it. So we should set the perf mode when allocating sink's buffer
(tmc_alloc_etr_buffer()), as this is the first callback invoked for a
perf session.
As a result, we can keep to set the sysfs mode in
tmc_enable_etr_sink_sysfs().
A side topic is we need to refactor the tmc_etr_get_sysfs_buffer()
function, ideally this function is purely for allocating buffer without
any locking. We can defer to assign "drvdata->sysfs_buf" until
acquired spin lock in tmc_enable_etr_sink_sysfs(). Essetionally, we
can enable sink in one go rather than acquire-release lock for several
times.
Thanks,
Leo
[1] https://lore.kernel.org/linux-arm-kernel/20251020143718.GH281971@e132581.arm.com/
Powered by blists - more mailing lists