Subject: Re: [PATCH v3 08/20] coresight: allow etm4x to be built as a module

From: Sai Prakash Ranjan <[email-masked]>
Date: Mon, 20 Jul 2020 12:28:05 +0530

Hi Tingwei,

On 2020-07-17 11:15, Tingwei Zhang wrote:
> From: Kim Phillips <[email-masked]>
> 
> Allow to build coresight-etm4x as a module, for ease of development.
> 
> - Kconfig becomes a tristate, to allow =m
> - append -core to source file name to allow module to
>   be called coresight-etm4x by the Makefile
> - add an etm4_remove function, for module unload
> - add a MODULE_DEVICE_TABLE for autoloading on boot
> 
> Cc: Mathieu Poirier <[email-masked]>
> Cc: Leo Yan <[email-masked]>
> Cc: Alexander Shishkin <[email-masked]>
> Cc: Randy Dunlap <[email-masked]>
> Cc: Suzuki K Poulose <[email-masked]>
> Cc: Greg Kroah-Hartman <[email-masked]>
> Cc: Russell King <[email-masked]>
> Signed-off-by: Kim Phillips <[email-masked]>
> Signed-off-by: Tingwei Zhang <[email-masked]>
> ---
>  drivers/hwtracing/coresight/Kconfig           |  5 ++-
>  drivers/hwtracing/coresight/Makefile          |  4 +--
>  ...resight-etm4x.c => coresight-etm4x-core.c} | 31 ++++++++++++++++++-
>  3 files changed, 36 insertions(+), 4 deletions(-)
>  rename drivers/hwtracing/coresight/{coresight-etm4x.c =>
> coresight-etm4x-core.c} (98%)
> 

<snip>...

Thanks for adding this support. etm4_cpu_pm_unregister() is dropped now 
with change to ETM PM code.
You can base the patches on coresight-next - 
https://git.linaro.org/kernel/coresight.git/log/?h=next

Also I am trying this series on SDM845 MTP (5.8.0-rc5) with Debian 
distribution,
I see below warning when trying to disable ETM, logs below:

root@linaro-developer:~# lsmod
Module                  Size  Used by
cpufreq_powersave      16384  0
cpufreq_conservative    16384  0
msm                   856064  1
coresight_stm          24576  0
crct10dif_ce           20480  1
stm_core               28672  1 coresight_stm
i2c_qcom_geni          24576  0
qcom_rng               16384  0
coresight_tmc          40960  0
coresight_funnel       20480  0
coresight_etm4x        61440  0
coresight_replicator    20480  0
camcc_sdm845           49152  0
ath10k_snoc            53248  0
socinfo                20480  0
ip_tables              32768  0
x_tables               45056  1 ip_tables
ipv6                  458752  26
nf_defrag_ipv6         24576  1 ipv6
root@linaro-developer:~#
root@linaro-developer:~# echo 1 > 
/sys/bus/coresight/devices/tmc_etr0/enable_sink
root@linaro-developer:~# echo 1 > 
/sys/bus/coresight/devices/etm0/enable_source
root@linaro-developer:~# echo 0 > 
/sys/bus/coresight/devices/etm0/enable_source
[  332.855363] ------------[ cut here ]------------
[  332.860175] WARNING: CPU: 0 PID: 0 at 
drivers/hwtracing/coresight/coresight-core.c:227 
coresight_disclaim_device_unlocked+0x28/0x50
[  332.872177] Modules linked in: cpufreq_powersave cpufreq_conservative 
msm(+) coresight_stm crct10dif_ce stm_core i2c_qcom_geni qcom_rng coresi
ght_tmc coresight_funnel coresight_etm4x coresight_replicator 
camcc_sdm845 ath10k_snoc socinfo ip_tables x_tables ipv6 nf_defrag_ipv6
[  332.897043] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G      D W         
5.8.0-rc5-next-20200716-00040-g50ad3222c13f-dirty #80
[  332.908330] Hardware name: Qualcomm Technologies, Inc. SDM845 MTP 
(DT)
[  332.914969] pstate: 80400085 (Nzcv daIf +PAN -UAO BTYPE=--)
[  332.920643] pc : coresight_disclaim_device_unlocked+0x28/0x50
[  332.926543] lr : etm4_disable_hw+0xd8/0x128 [coresight_etm4x]
[  332.932391] sp : ffff800010003ed0
[  332.935775] x29: ffff800010003ed0 x28: ffffb05e1bd13980
[  332.941193] x27: 0000004d7fb06ef3 x26: ffff800010004000
[  332.946606] x25: 0000000000000000 x24: ffffb05e1bd03cc0
[  332.952022] x23: 0000000000000000 x22: 0000000000000000
[  332.957436] x21: ffff800010c73c00 x20: ffff000175547400
[  332.962851] x19: ffff8000103af000 x18: 0000000000000005
[  332.968267] x17: 0000000000000000 x16: ffffb05e1a875f38
[  332.973678] x15: 0000000000000000 x14: ffffb05e1bd13980
[  332.979093] x13: ffff4fa361082000 x12: 000000003474591d
[  332.984507] x11: 0000000000000000 x10: 0000000000001000
[  332.989920] x9 : ffffb05e19a81800 x8 : 000001b2b5503510
[  332.995336] x7 : 000000b2b5503510 x6 : 000000003fd5ea33
[  333.000749] x5 : 00ffffffffffffff x4 : 000000000000b2be
[  333.006162] x3 : ffff0001725c8150 x2 : ffff8000103af168
[  333.011574] x1 : 0000000000000000 x0 : ffff8000103affa4
[  333.016993] Call trace:
[  333.019516]  coresight_disclaim_device_unlocked+0x28/0x50
[  333.025035]  etm4_disable_hw+0xd8/0x128 [coresight_etm4x]
[  333.030552]  flush_smp_call_function_queue+0x154/0x250
[  333.035795]  generic_smp_call_function_single_interrupt+0x18/0x20
[  333.041999]  handle_IPI+0x32c/0x390
[  333.045569]  gic_handle_irq+0x15c/0x160
[  333.049489]  el1_irq+0xb8/0x180
[  333.052709]  cpuidle_enter_state+0xac/0x4e8
[  333.056983]  cpuidle_enter+0x3c/0x50
[  333.060646]  call_cpuidle+0x40/0x70
[  333.064210]  do_idle+0x20c/0x290
[  333.067516]  cpu_startup_entry+0x28/0x70
[  333.071528]  rest_init+0xdc/0xe8
[  333.074847]  arch_call_rest_init+0x14/0x1c
[  333.079027]  start_kernel+0x4e0/0x518
[  333.082764] ---[ end trace 162d5cef8c2b863b ]---
root@linaro-developer:~#

Thanks,
Sai

-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a 
member
of Code Aurora Forum, hosted by The Linux Foundation

_______________________________________________
linux-arm-kernel mailing list
[email-masked]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel