mbox series

[RFC,0/3] coresight: Support exclude_guest with Feat_TRF and nVHE

Message ID 20230804101317.460697-1-james.clark@arm.com (mailing list archive)
Headers show
Series coresight: Support exclude_guest with Feat_TRF and nVHE | expand

Message

James Clark Aug. 4, 2023, 10:13 a.m. UTC
Hi,

I'm looking for help in testing this and for feedback on whether it's
useful to anyone. Testing it requires hardware that has Feat_TRF (v8.4)
but no TRBE. This is because TRBE usage is disabled in nVHE guests.

I don't currently have any access to any hardware, and the FVP model
can only do self hosted trace using TRBE.

Currently with nVHE you would always get trace from guests, and
filtering out isn't possible without this patchset. In comparison, with
VHE guests, they never generate guest trace without [1]. I think the
existence of trace rather than lack of could suggest that this change is
less useful than [1]. Also the restricted set of hardware that it works
on supports that too. 

Apart from compilation and checking that the exclude guest settings
are correctly programmed on guest switch, this is untested by me.

Applies to kvmarm/next (3b4e3afb2032)

[1]: https://lore.kernel.org/linux-arm-kernel/20230804085219.260790-3-james.clark@arm.com/

James Clark (3):
  arm64: KVM: Add support for exclude_guest and exclude_host for ETM
  arm64: KVM: Support exclude_guest for Coresight trace in nVHE
  coresight: Support exclude_guest with Feat_TRF and nVHE

 arch/arm64/include/asm/kvm_host.h             | 10 +++-
 arch/arm64/kvm/Makefile                       |  1 +
 arch/arm64/kvm/arm.c                          |  1 +
 arch/arm64/kvm/debug.c                        |  7 +++
 arch/arm64/kvm/etm.c                          | 48 ++++++++++++++++
 arch/arm64/kvm/hyp/nvhe/debug-sr.c            | 56 +++++++++++++++++--
 .../hwtracing/coresight/coresight-etm-perf.c  |  4 ++
 include/kvm/etm.h                             | 43 ++++++++++++++
 8 files changed, 165 insertions(+), 5 deletions(-)
 create mode 100644 arch/arm64/kvm/etm.c
 create mode 100644 include/kvm/etm.h

Comments

Marc Zyngier Aug. 4, 2023, 7:09 p.m. UTC | #1
On Fri, 04 Aug 2023 11:13:10 +0100,
James Clark <james.clark@arm.com> wrote:
> 
> Hi,
> 
> I'm looking for help in testing this and for feedback on whether it's
> useful to anyone. Testing it requires hardware that has Feat_TRF (v8.4)
> but no TRBE. This is because TRBE usage is disabled in nVHE guests.
>
> I don't currently have any access to any hardware, and the FVP model
> can only do self hosted trace using TRBE.
> 
> Currently with nVHE you would always get trace from guests, and
> filtering out isn't possible without this patchset. In comparison, with
> VHE guests, they never generate guest trace without [1]. I think the
> existence of trace rather than lack of could suggest that this change is
> less useful than [1]. Also the restricted set of hardware that it works
> on supports that too.

It'd be nice to have some sort of feature parity, but it seems like a
vanishingly small target of users having access to an ETM sink.

> 
> Apart from compilation and checking that the exclude guest settings
> are correctly programmed on guest switch, this is untested by me.

I'll have a look at the series, but none of my HW fits in this
description (my ARMv8.4+ boxes don't have any form of tracing).

Thanks,

	M.
Suzuki K Poulose Aug. 5, 2023, 10:14 a.m. UTC | #2
Cc: Ganpatrao, Steve, Tanmay

On 04/08/2023 11:13, James Clark wrote:
> Hi,
> 
> I'm looking for help in testing this and for feedback on whether it's
> useful to anyone. Testing it requires hardware that has Feat_TRF (v8.4)
> but no TRBE. This is because TRBE usage is disabled in nVHE guests.
> 
> I don't currently have any access to any hardware, and the FVP model
> can only do self hosted trace using TRBE.


If you have a v8.4+ (and not v9) HW, please could you give this a spin ?

Suzuki


> 
> Currently with nVHE you would always get trace from guests, and
> filtering out isn't possible without this patchset. In comparison, with
> VHE guests, they never generate guest trace without [1]. I think the
> existence of trace rather than lack of could suggest that this change is
> less useful than [1]. Also the restricted set of hardware that it works
> on supports that too.
> 
> Apart from compilation and checking that the exclude guest settings
> are correctly programmed on guest switch, this is untested by me.
> 
> Applies to kvmarm/next (3b4e3afb2032)
> 
> [1]: https://lore.kernel.org/linux-arm-kernel/20230804085219.260790-3-james.clark@arm.com/
> 
> James Clark (3):
>    arm64: KVM: Add support for exclude_guest and exclude_host for ETM
>    arm64: KVM: Support exclude_guest for Coresight trace in nVHE
>    coresight: Support exclude_guest with Feat_TRF and nVHE
> 
>   arch/arm64/include/asm/kvm_host.h             | 10 +++-
>   arch/arm64/kvm/Makefile                       |  1 +
>   arch/arm64/kvm/arm.c                          |  1 +
>   arch/arm64/kvm/debug.c                        |  7 +++
>   arch/arm64/kvm/etm.c                          | 48 ++++++++++++++++
>   arch/arm64/kvm/hyp/nvhe/debug-sr.c            | 56 +++++++++++++++++--
>   .../hwtracing/coresight/coresight-etm-perf.c  |  4 ++
>   include/kvm/etm.h                             | 43 ++++++++++++++
>   8 files changed, 165 insertions(+), 5 deletions(-)
>   create mode 100644 arch/arm64/kvm/etm.c
>   create mode 100644 include/kvm/etm.h
>
Suzuki K Poulose Aug. 5, 2023, 10:28 a.m. UTC | #3
Hi Marc

On 04/08/2023 20:09, Marc Zyngier wrote:
> On Fri, 04 Aug 2023 11:13:10 +0100,
> James Clark <james.clark@arm.com> wrote:
>>
>> Hi,
>>
>> I'm looking for help in testing this and for feedback on whether it's
>> useful to anyone. Testing it requires hardware that has Feat_TRF (v8.4)
>> but no TRBE. This is because TRBE usage is disabled in nVHE guests.
>>
>> I don't currently have any access to any hardware, and the FVP model
>> can only do self hosted trace using TRBE.
>>
>> Currently with nVHE you would always get trace from guests, and
>> filtering out isn't possible without this patchset. In comparison, with
>> VHE guests, they never generate guest trace without [1]. I think the
>> existence of trace rather than lack of could suggest that this change is
>> less useful than [1]. Also the restricted set of hardware that it works
>> on supports that too.
> 
> It'd be nice to have some sort of feature parity, but it seems like a
> vanishingly small target of users having access to an ETM sink.
> 
>>
>> Apart from compilation and checking that the exclude guest settings
>> are correctly programmed on guest switch, this is untested by me.
> 
> I'll have a look at the series, but none of my HW fits in this
> description (my ARMv8.4+ boxes don't have any form of tracing).

While I have your attention, we have another series that manages the
trace filtering for Guests on VHE, completely within the Coresight etm4x
driver here [0]. I personally think, it is good to have the guest
filtering for both nVHE and VHE under the KVM control, like we do
in this series. I would like your opinion on this.

[0] https://lkml.kernel.org/r/20230804085219.260790-1-james.clark@arm.com


Suzuki


> 
> Thanks,
> 
> 	M.
>
Marc Zyngier Aug. 8, 2023, 11:06 a.m. UTC | #4
On Sat, 05 Aug 2023 11:28:39 +0100,
Suzuki K Poulose <suzuki.poulose@arm.com> wrote:
> 
> Hi Marc
> 
> On 04/08/2023 20:09, Marc Zyngier wrote:
> > On Fri, 04 Aug 2023 11:13:10 +0100,
> > James Clark <james.clark@arm.com> wrote:
> >> 
> >> Hi,
> >> 
> >> I'm looking for help in testing this and for feedback on whether it's
> >> useful to anyone. Testing it requires hardware that has Feat_TRF (v8.4)
> >> but no TRBE. This is because TRBE usage is disabled in nVHE guests.
> >> 
> >> I don't currently have any access to any hardware, and the FVP model
> >> can only do self hosted trace using TRBE.
> >> 
> >> Currently with nVHE you would always get trace from guests, and
> >> filtering out isn't possible without this patchset. In comparison, with
> >> VHE guests, they never generate guest trace without [1]. I think the
> >> existence of trace rather than lack of could suggest that this change is
> >> less useful than [1]. Also the restricted set of hardware that it works
> >> on supports that too.
> > 
> > It'd be nice to have some sort of feature parity, but it seems like a
> > vanishingly small target of users having access to an ETM sink.
> > 
> >> 
> >> Apart from compilation and checking that the exclude guest settings
> >> are correctly programmed on guest switch, this is untested by me.
> > 
> > I'll have a look at the series, but none of my HW fits in this
> > description (my ARMv8.4+ boxes don't have any form of tracing).
> 
> While I have your attention, we have another series that manages the
> trace filtering for Guests on VHE, completely within the Coresight etm4x
> driver here [0]. I personally think, it is good to have the guest
> filtering for both nVHE and VHE under the KVM control, like we do
> in this series. I would like your opinion on this.

I just quickly reviewed the first two patches of the nVHE series, and
I think the shape is a bit wrong. I can absolutely see the interest of
preventing extra tracing when a guest is running, but the way this is
currently plugged makes it hard to reason about it.

> [0] https://lkml.kernel.org/r/20230804085219.260790-1-james.clark@arm.com

I'll try to have a look at that one later.

Thanks,

	M.