Hi Tomasz,
[...]
The ETF buffer is a pretty small one. As such it may be wrapping around and all you get is the user space part. Do you have an ETR on the platform? If so I suggest to download the latest coresight next branch [1] and try with a bigger buffer.
Yes, I have tried ETR with the same results. But it turns out ETMv4 driver enables EL1_NS for kernel tracing which is not true for VHE enabled system where kernel is running on EL2_NS. Bellow patch helps to fix this for me:
diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index f79b0ea85d76..dc22c1d6c7f3 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -28,6 +28,7 @@ #include <linux/pm_runtime.h> #include <asm/sections.h> #include <asm/local.h> +#include <asm/virt.h>
#include "coresight-etm4x.h" #include "coresight-etm-perf.h" @@ -617,13 +618,11 @@ static u64 etm4_get_access_type(struct etmv4_config *config) * Bit[13] Exception level 1 - OS * Bit[14] Exception level 2 - Hypervisor * Bit[15] Never implemented
*
* Always stay away from hypervisor mode. */
access_type = ETM_EXLEVEL_NS_HYP; if (config->mode & ETM_MODE_EXCL_KERN)
access_type |= ETM_EXLEVEL_NS_OS;
access_type |= is_kernel_in_hyp_mode ?
Did you send me code that doesn't compile cleanly?
ETM_EXLEVEL_NS_HYP : ETM_EXLEVEL_NS_OS; if (config->mode & ETM_MODE_EXCL_USER) access_type |= ETM_EXLEVEL_NS_APP;
@@ -881,7 +880,8 @@ void etm4_config_trace_mode(struct etmv4_config *config)
addr_acc = config->addr_acc[ETM_DEFAULT_ADDR_COMP]; /* clear default config */
addr_acc &= ~(ETM_EXLEVEL_NS_APP | ETM_EXLEVEL_NS_OS);
addr_acc &= ~(ETM_EXLEVEL_NS_APP | ETM_EXLEVEL_NS_OS |
ETM_EXLEVEL_NS_HYP); /* * EXLEVEL_NS, bits[15:12]
@@ -892,7 +892,8 @@ void etm4_config_trace_mode(struct etmv4_config *config) * Bit[15] Never implemented */ if (mode & ETM_MODE_EXCL_KERN)
addr_acc |= ETM_EXLEVEL_NS_OS;
addr_acc |= is_kernel_in_hyp_mode ?
ETM_EXLEVEL_NS_HYP : ETM_EXLEVEL_NS_OS; else addr_acc |= ETM_EXLEVEL_NS_APP;
Thanks, Tomasz