Thank you, this was indeed the issue.

For anyone who is interested, i have disabled the power down on idle with these commands:
$ echo 1 > /sys/devices/system/cpu/cpu1/cpuidle/state1/disable
$ echo 1 > /sys/devices/system/cpu/cpu1/cpuidle/state0/disable

This disables the power down on IDLE on CPU1.

Thanks,
Mike.

On Mon, Apr 9, 2018 at 5:39 PM, Mathieu Poirier <mathieu.poirier@linaro.org> wrote:
On 9 April 2018 at 08:12, Mike Leach <Mike.Leach@arm.com> wrote:
> Hi,
>
> Ensure that you have disabled core power down on idle when using sysfs to manipulate etm devices.
> The ETM devices are on the same power/clock as the CPUs, so if the CPU powers down on idle then the ETM will be powered down too.
> Writing to a device that is unpowered will usually kill your system.

Mike is correct - you are facing a core power down problems.  When
vendors don't honour TRCPDCR.PU (as it is the case with the dragon
board) cpuIDLE must be disabled or core must be prevented from
reaching deep idle state.

Mathieu

>
> Regards
>
> Mike
>
> -----Original Message-----
> From: CoreSight <coresight-bounces@lists.linaro.org> On Behalf Of Mike Bazov
> Sent: 09 April 2018 14:24
> To: coresight@lists.linaro.org
> Subject: Using coresight via sysfs freezes my entire system.
>
> Greetings,
>
> I'm enabling a sink(ETR) via sysfs:
>
> $ echo "1"> /sys/bus/coresight/devices/826000.etr/enable_sink
>
>
> And the sink is enabled successfully.
>
> Now, i try to turn on a random ETMv4 source, so i just choose this one:
>
>
> $ echo "1" > /sys/bus/coresight/devices/85c000.etm/enable_source
>
>
> And this freezes my entire system. This ETMv4 is for CPU 0.. So i tried to turn on(after a reboot, and enabling a sink again) the next ETMv4(for CPU 1):
>
>
> $ echo "1" > /sys/bus/coresight/devices/85d000.etm/enable_source
>
>
> And i can see the kernel logs are happy, and tracing is(assuming the logs are true) enabled:
>
> [   61.495119] coresight-tmc 826000.etr: TMC-ETR enabled
> [   61.495150] coresight-dynamic-replicator 824000.replicator: REPLICATOR enabled
> [   61.499261] coresight-tmc 825000.etf: TMC-ETF enabled
> [   61.506468] coresight-funnel 821000.funnel: FUNNEL inport 4 enabled
> [   61.511438] coresight-funnel 841000.funnel: FUNNEL inport 1 enabled
> [   61.517635] coresight-etm4x 85d000.etm: ETM tracing enabled
>
>
>  But when i try to turn it off:
>
> $ echo "0" > /sys/bus/coresight/devices/85d000.etm/enable_source
>
>
>
> This freezes my entire system.. again.
>
>
> I'm using the perf-opencsd-master kernel(https://github.com/Linaro/perf-opencsd <https://github.com/Linaro/perf-opencsd> ), and the Dragonboard 410c.
>
>
> Any ideas, hints?
>
>
> Thank you.
>
> IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
> _______________________________________________
> CoreSight mailing list
> CoreSight@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/coresight