* Re: [PATCH] coresight: Disable MMIO logging for coresight stm driver
2025-04-30 11:03 [PATCH] coresight: Disable MMIO logging for coresight stm driver Mao Jinlong
@ 2025-04-30 12:55 ` Leo Yan
2025-04-30 13:51 ` Suzuki K Poulose
2025-05-06 3:57 ` Anshuman Khandual
2 siblings, 0 replies; 5+ messages in thread
From: Leo Yan @ 2025-04-30 12:55 UTC (permalink / raw)
To: Mao Jinlong
Cc: Suzuki K Poulose, Mike Leach, James Clark, Alexander Shishkin,
coresight, linux-arm-kernel, linux-kernel, linux-arm-msm
On Wed, Apr 30, 2025 at 04:03:47AM -0700, Mao Jinlong wrote:
> When read/write registers with readl_relaxed and writel_relaxed,
> log_read_mmio and log_write_mmio will be called. If mmio trace
> is enabled to STM, STM driver will write the register to send the
> trace and writel_relaxed will be called again. The circular call
> like callstack below will happen. Disable mmio logging for stm
> driver to avoid this issue.
>
> [] stm_source_write[stm_core]+0xc4
> [] stm_ftrace_write[stm_ftrace]+0x40
> [] trace_event_buffer_commit+0x238
> [] trace_event_raw_event_rwmmio_rw_template+0x8c
> [] log_post_write_mmio+0xb4
> [] writel_relaxed[coresight_stm]+0x80
> [] stm_generic_packet[coresight_stm]+0x1a8
> [] stm_data_write[stm_core]+0x78
> [] ost_write[stm_p_ost]+0xc8
> [] stm_source_write[stm_core]+0x7c
> [] stm_ftrace_write[stm_ftrace]+0x40
> [] trace_event_buffer_commit+0x238
> [] trace_event_raw_event_rwmmio_read+0x84
> [] log_read_mmio+0xac
> [] readl_relaxed[coresight_tmc]+0x50
>
> Signed-off-by: Mao Jinlong <quic_jinlmao@quicinc.com>
LGTM:
Reviewed-by: Leo Yan <leo.yan@arm.com>
> ---
> drivers/hwtracing/coresight/Makefile | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/hwtracing/coresight/Makefile b/drivers/hwtracing/coresight/Makefile
> index 4ba478211b31..f3158266f75e 100644
> --- a/drivers/hwtracing/coresight/Makefile
> +++ b/drivers/hwtracing/coresight/Makefile
> @@ -22,6 +22,8 @@ condflags := \
> $(call cc-option, -Wstringop-truncation)
> subdir-ccflags-y += $(condflags)
>
> +CFLAGS_coresight-stm.o := -D__DISABLE_TRACE_MMIO__
> +
> obj-$(CONFIG_CORESIGHT) += coresight.o
> coresight-y := coresight-core.o coresight-etm-perf.o coresight-platform.o \
> coresight-sysfs.o coresight-syscfg.o coresight-config.o \
> --
> 2.25.1
>
> _______________________________________________
> CoreSight mailing list -- coresight@lists.linaro.org
> To unsubscribe send an email to coresight-leave@lists.linaro.org
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] coresight: Disable MMIO logging for coresight stm driver
2025-04-30 11:03 [PATCH] coresight: Disable MMIO logging for coresight stm driver Mao Jinlong
2025-04-30 12:55 ` Leo Yan
@ 2025-04-30 13:51 ` Suzuki K Poulose
2025-05-06 3:13 ` Jinlong Mao
2025-05-06 3:57 ` Anshuman Khandual
2 siblings, 1 reply; 5+ messages in thread
From: Suzuki K Poulose @ 2025-04-30 13:51 UTC (permalink / raw)
To: Mao Jinlong, Mike Leach, James Clark, Alexander Shishkin
Cc: coresight, linux-arm-kernel, linux-kernel, linux-arm-msm
Hi,
On 30/04/2025 12:03, Mao Jinlong wrote:
> When read/write registers with readl_relaxed and writel_relaxed,
> log_read_mmio and log_write_mmio will be called. If mmio trace
> is enabled to STM, STM driver will write the register to send the
> trace and writel_relaxed will be called again. The circular call
> like callstack below will happen. Disable mmio logging for stm
> driver to avoid this issue.
>
Thanks for the fix, looks good to me. However, I think the commit
description is a bit cryptic. Could we say :
With MMIO logging enabled, the MMIO access are traced and could be
sent to an STM device. Thus, an STM driver MMIO access could create
circular call chain with MMIO logging. Disable it for STM driver.
Suzuki
> [] stm_source_write[stm_core]+0xc4
> [] stm_ftrace_write[stm_ftrace]+0x40
> [] trace_event_buffer_commit+0x238
> [] trace_event_raw_event_rwmmio_rw_template+0x8c
> [] log_post_write_mmio+0xb4
> [] writel_relaxed[coresight_stm]+0x80
> [] stm_generic_packet[coresight_stm]+0x1a8
> [] stm_data_write[stm_core]+0x78
> [] ost_write[stm_p_ost]+0xc8
> [] stm_source_write[stm_core]+0x7c
> [] stm_ftrace_write[stm_ftrace]+0x40
> [] trace_event_buffer_commit+0x238
> [] trace_event_raw_event_rwmmio_read+0x84
> [] log_read_mmio+0xac
> [] readl_relaxed[coresight_tmc]+0x50
>
> Signed-off-by: Mao Jinlong <quic_jinlmao@quicinc.com>
> ---
> drivers/hwtracing/coresight/Makefile | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/hwtracing/coresight/Makefile b/drivers/hwtracing/coresight/Makefile
> index 4ba478211b31..f3158266f75e 100644
> --- a/drivers/hwtracing/coresight/Makefile
> +++ b/drivers/hwtracing/coresight/Makefile
> @@ -22,6 +22,8 @@ condflags := \
> $(call cc-option, -Wstringop-truncation)
> subdir-ccflags-y += $(condflags)
>
> +CFLAGS_coresight-stm.o := -D__DISABLE_TRACE_MMIO__
> +
> obj-$(CONFIG_CORESIGHT) += coresight.o
> coresight-y := coresight-core.o coresight-etm-perf.o coresight-platform.o \
> coresight-sysfs.o coresight-syscfg.o coresight-config.o \
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] coresight: Disable MMIO logging for coresight stm driver
2025-04-30 13:51 ` Suzuki K Poulose
@ 2025-05-06 3:13 ` Jinlong Mao
0 siblings, 0 replies; 5+ messages in thread
From: Jinlong Mao @ 2025-05-06 3:13 UTC (permalink / raw)
To: Suzuki K Poulose, Mike Leach, James Clark, Alexander Shishkin
Cc: coresight, linux-arm-kernel, linux-kernel, linux-arm-msm
On 2025/4/30 21:51, Suzuki K Poulose wrote:
> Hi,
>
> On 30/04/2025 12:03, Mao Jinlong wrote:
>> When read/write registers with readl_relaxed and writel_relaxed,
>> log_read_mmio and log_write_mmio will be called. If mmio trace
>> is enabled to STM, STM driver will write the register to send the
>> trace and writel_relaxed will be called again. The circular call
>> like callstack below will happen. Disable mmio logging for stm
>> driver to avoid this issue.
>>
>
> Thanks for the fix, looks good to me. However, I think the commit
> description is a bit cryptic. Could we say :
>
> With MMIO logging enabled, the MMIO access are traced and could be
> sent to an STM device. Thus, an STM driver MMIO access could create
> circular call chain with MMIO logging. Disable it for STM driver.
>
> Suzuki
I will update it.
>
>> [] stm_source_write[stm_core]+0xc4
>> [] stm_ftrace_write[stm_ftrace]+0x40
>> [] trace_event_buffer_commit+0x238
>> [] trace_event_raw_event_rwmmio_rw_template+0x8c
>> [] log_post_write_mmio+0xb4
>> [] writel_relaxed[coresight_stm]+0x80
>> [] stm_generic_packet[coresight_stm]+0x1a8
>> [] stm_data_write[stm_core]+0x78
>> [] ost_write[stm_p_ost]+0xc8
>> [] stm_source_write[stm_core]+0x7c
>> [] stm_ftrace_write[stm_ftrace]+0x40
>> [] trace_event_buffer_commit+0x238
>> [] trace_event_raw_event_rwmmio_read+0x84
>> [] log_read_mmio+0xac
>> [] readl_relaxed[coresight_tmc]+0x50
>>
>> Signed-off-by: Mao Jinlong <quic_jinlmao@quicinc.com>
>> ---
>> drivers/hwtracing/coresight/Makefile | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/hwtracing/coresight/Makefile b/drivers/hwtracing/
>> coresight/Makefile
>> index 4ba478211b31..f3158266f75e 100644
>> --- a/drivers/hwtracing/coresight/Makefile
>> +++ b/drivers/hwtracing/coresight/Makefile
>> @@ -22,6 +22,8 @@ condflags := \
>> $(call cc-option, -Wstringop-truncation)
>> subdir-ccflags-y += $(condflags)
>> +CFLAGS_coresight-stm.o := -D__DISABLE_TRACE_MMIO__
>> +
>> obj-$(CONFIG_CORESIGHT) += coresight.o
>> coresight-y := coresight-core.o coresight-etm-perf.o coresight-
>> platform.o \
>> coresight-sysfs.o coresight-syscfg.o coresight-config.o \
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] coresight: Disable MMIO logging for coresight stm driver
2025-04-30 11:03 [PATCH] coresight: Disable MMIO logging for coresight stm driver Mao Jinlong
2025-04-30 12:55 ` Leo Yan
2025-04-30 13:51 ` Suzuki K Poulose
@ 2025-05-06 3:57 ` Anshuman Khandual
2 siblings, 0 replies; 5+ messages in thread
From: Anshuman Khandual @ 2025-05-06 3:57 UTC (permalink / raw)
To: Mao Jinlong, Suzuki K Poulose, Mike Leach, James Clark,
Alexander Shishkin
Cc: coresight, linux-arm-kernel, linux-kernel, linux-arm-msm
On 4/30/25 16:33, Mao Jinlong wrote:
> When read/write registers with readl_relaxed and writel_relaxed,
> log_read_mmio and log_write_mmio will be called. If mmio trace
> is enabled to STM, STM driver will write the register to send the
> trace and writel_relaxed will be called again. The circular call
> like callstack below will happen. Disable mmio logging for stm
> driver to avoid this issue.
>
> [] stm_source_write[stm_core]+0xc4
> [] stm_ftrace_write[stm_ftrace]+0x40
> [] trace_event_buffer_commit+0x238
> [] trace_event_raw_event_rwmmio_rw_template+0x8c
> [] log_post_write_mmio+0xb4
> [] writel_relaxed[coresight_stm]+0x80
> [] stm_generic_packet[coresight_stm]+0x1a8
> [] stm_data_write[stm_core]+0x78
> [] ost_write[stm_p_ost]+0xc8
> [] stm_source_write[stm_core]+0x7c
> [] stm_ftrace_write[stm_ftrace]+0x40
> [] trace_event_buffer_commit+0x238
> [] trace_event_raw_event_rwmmio_read+0x84
> [] log_read_mmio+0xac
> [] readl_relaxed[coresight_tmc]+0x50
>
> Signed-off-by: Mao Jinlong <quic_jinlmao@quicinc.com>
> ---
> drivers/hwtracing/coresight/Makefile | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/hwtracing/coresight/Makefile b/drivers/hwtracing/coresight/Makefile
> index 4ba478211b31..f3158266f75e 100644
> --- a/drivers/hwtracing/coresight/Makefile
> +++ b/drivers/hwtracing/coresight/Makefile
> @@ -22,6 +22,8 @@ condflags := \
> $(call cc-option, -Wstringop-truncation)
> subdir-ccflags-y += $(condflags)
>
> +CFLAGS_coresight-stm.o := -D__DISABLE_TRACE_MMIO__
> +
> obj-$(CONFIG_CORESIGHT) += coresight.o
> coresight-y := coresight-core.o coresight-etm-perf.o coresight-platform.o \
> coresight-sysfs.o coresight-syscfg.o coresight-config.o \
As Suzuki mentioned, please do update the commit message.
Otherwise LGTM.
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
^ permalink raw reply [flat|nested] 5+ messages in thread