Re: [PATCH 3/3] ARM Coresight: Add PID control support for ETMtracing
From: Greg Kroah-Hartman
Date: Wed Dec 04 2013 - 12:05:46 EST
On Tue, Dec 03, 2013 at 11:40:59PM -0500, Adrien Vergé wrote:
> In the same manner as for enabling tracing, an entry is created in
> sysfs to set the PID that triggers tracing. This change requires
> CONFIG_PID_IN_CONTEXTIDR to be set when using on-chip ETM.
>
> Signed-off-by: Adrien Vergé <adrienverge@xxxxxxxxx>
> Cc: Russell King <linux@xxxxxxxxxxxxxxxx>
> Cc: Ben Dooks <ben.dooks@xxxxxxxxxxxxxxx>
> Cc: Will Deacon <will.deacon@xxxxxxx>
> Cc: Dietmar Eggemann <dietmar.eggemann@xxxxxxx>
> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Cc: "zhangwei(Jovi)" <jovi.zhangwei@xxxxxxxxxx>
> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> Cc: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
> ---
> arch/arm/Kconfig.debug | 1 +
> arch/arm/include/asm/hardware/coresight.h | 3 ++
> arch/arm/kernel/etm.c | 73 ++++++++++++++++++++++++++++---
> 3 files changed, 70 insertions(+), 7 deletions(-)
>
> diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
> index 5765abf..fef32e15 100644
> --- a/arch/arm/Kconfig.debug
> +++ b/arch/arm/Kconfig.debug
> @@ -1130,6 +1130,7 @@ config EARLY_PRINTK
> config OC_ETM
> bool "On-chip ETM and ETB"
> depends on ARM_AMBA
> + select PID_IN_CONTEXTIDR
> help
> Enables the on-chip embedded trace macrocell and embedded trace
> buffer driver that will allow you to collect traces of the
> diff --git a/arch/arm/include/asm/hardware/coresight.h
> b/arch/arm/include/asm/hardware/coresight.h
> index 8c50cf6..009cdf9 100644
> --- a/arch/arm/include/asm/hardware/coresight.h
> +++ b/arch/arm/include/asm/hardware/coresight.h
> @@ -98,6 +98,9 @@
> #define ETMR_ADDRCOMP_VAL(x) (0x40 + (x) * 4)
> #define ETMR_ADDRCOMP_ACC_TYPE(x) (0x80 + (x) * 4)
>
> +#define ETMR_CTXIDCOMP_VAL(x) (0x1b0 + (x) * 4)
> +#define ETMR_CTXIDCOMP_MASK (0x1bc)
> +
> /* ETM status register, "ETM Architecture", 3.3.2 */
> #define ETMR_STATUS (0x10)
> #define ETMST_OVERFLOW BIT(0)
> diff --git a/arch/arm/kernel/etm.c b/arch/arm/kernel/etm.c
> index a72382b..18afed1 100644
> --- a/arch/arm/kernel/etm.c
> +++ b/arch/arm/kernel/etm.c
> @@ -40,12 +40,14 @@ struct tracectx {
> void __iomem *etm_regs;
> unsigned long flags;
> int naddrcmppairs;
> + int nctxidcmp;
> int etm_portsz;
> struct device *dev;
> struct clk *emu_clk;
> struct mutex mutex;
> unsigned long addrrange_start;
> unsigned long addrrange_end;
> + long pid;
pid is not a long, your code is totally broken for pid namespaces, and
really, I don't know how you would fix it given that you don't have a
way to specify the pid namespace with this interface.
sorry,
greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/