Re: [PATCH] coresight: etm4x: Add config to exclude kernel mode tracing

From: Suzuki Poulose
Date: Fri Oct 16 2020 - 07:38:54 EST


On 10/16/20 10:24 AM, Leo Yan wrote:
Hi Sai,

On Fri, Oct 16, 2020 at 02:10:47PM +0530, Sai Prakash Ranjan wrote:
Hi Leo,

On 2020-10-16 12:54, Leo Yan wrote:
On Thu, Oct 15, 2020 at 11:40:05PM -0700, Denis Nikitin wrote:
Hi Mathieu,

I think one of the use cases could be VMs.
Is there isolation between EL1 guest kernels which we can control
from perf
in a system wide mode?

Sorry for suddenly jumping in.

For KVM, I think we need to implement mechanism for saving/restoring
CoreSight context for every guest OS, the CPU PMUs has implemented
related features [1].

Thanks,
Leo

[1]
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/kvm/pmu.c


Its not as easy as the CPU PMU for virtualizing the ETMs (with memory
mapped access only), i.e supporting ETMs from VMs.
We could definitely stop/resume on guest entry/exit, to support attr.exclude_guest.


What happens to the sysfs mode of tracing? For that we would still
need a config right to exclude kernel mode tracing completely.

IIUC, sysfs mode and perf mode both can apply the same approach, the
guest OS runs a thread context for the host, so when a guest OS is
switched in or out, the hypervisor can save/restore the context for
the guest OS; thus every guest OS will have its dedicated context and
trace data ideally.

I don't think Guest Context is something we can support as mentioned
above, at least for systems without sysreg access for ETMs (and virtualizing ETRs is a different story !)

Cheers
Suzuki