[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <cdbd12fb-af91-4e22-ab19-4018bc88f6c7@arm.com>
Date: Thu, 20 Nov 2025 10:45:04 +0000
From: Suzuki K Poulose <suzuki.poulose@....com>
To: Leo Yan <leo.yan@....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 19/11/2025 18:04, Leo Yan wrote:
> 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.
Thats too early, in setup_aux(), when the event is not scheduled in. We
don't know when that would be.
>
> 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.
Patche welcome :-)
Cheers
Suzuki
>
> Thanks,
> Leo
>
> [1] https://lore.kernel.org/linux-arm-kernel/20251020143718.GH281971@e132581.arm.com/
Powered by blists - more mailing lists