Re: [PATCH V9 00/10] arm64/perf: Enable branch stack sampling

From: Mark Brown
Date: Fri Mar 24 2023 - 07:40:57 EST


On Fri, Mar 24, 2023 at 08:50:32AM +0530, Anshuman Khandual wrote:
> On 3/23/23 18:24, Mark Brown wrote:
> > On Thu, Mar 23, 2023 at 09:55:47AM +0530, Anshuman Khandual wrote:

> >> By default entire SYS_HFGITR_EL2 is set as cleared during init and that would
> >> prevent a guest from using BRBE.

> > It should prevent the host as well shouldn't it?

> In a EL2 host environment, BRBE is being enabled either in EL2 (kernel/hv) or
> in EL0 (user space), it never gets enabled on EL1. Moreover BRBIALL/BRBINJ
> instructions are always executed while being inside EL2 (kernel/hv). Hence how
> could these instructions cause trap in EL2 ?

Ah, I see - I didn't realise this couldn't run at EL1.

> > Yes, looks roughly what I'd expect.

> I could send an stand alone patch after your latest series [1], which disables
> BRBINJ/BRBIALL instruction trap in EL2 to enable BRBE usage in the guest.

Sounds resaonable enough to me.

Attachment: signature.asc
Description: PGP signature