Re: [PATCH] KVM: arm64: Fix TRFCR_EL1/PMSCR_EL1 access in hVHE mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 29, 2024 at 06:24:37PM +0000, Marc Zyngier wrote:
> On Thu, 29 Feb 2024 17:37:08 +0000, Oliver Upton <oliver.upton@xxxxxxxxx> wrote:
> > I was wondering if there was a way to surface these screw-ups at compile
> > time, but there's nothing elegant that comes to mind. Guess we need to
> > be very careful reviewing "nVHE" changes going forward.
> 
> My take on this is that there should hardly be any read_sysreg_s() in
> the KVM code at all. We should always use read_sysreg_el*() so that
> there is no ambiguity about the state we're dealing with (that's, of
> course, only valid for registers that have both an EL1 and an EL2
> counterpart -- registers that are shared across ELs must still use the
> read_sysreg_s() accessor).

Agreed, I was thinking something along the lines of an accessor that
expresses our intent to access EL2 state, but you can't really add
compile-time assertions behind that.

Perhaps it makes the code slightly more readable, but at that point
we're just rolling a turd in glitter.

> It would also free the drive-by hacker from having to understand the
> subtleties of the E2H redirection. The macros do the right thing
> everywhere (they are context aware), and they should be the first port
> of call.

Right, I think the mechanism for poking at true EL1 state achieves a
good abstraction.

> > Reviewed-by: Oliver Upton <oliver.upton@xxxxxxxxx>
> 
> Thanks. What should we do about it? Fix for 6.8, or part of the 6.9
> drop? hVHE+tracing is a pretty niche thing, and I don't have any other
> fix for the time being...

Ah, we are pretty late in the cycle, I should've asked :) Happy to pick
this up for 6.9 then.

-- 
Thanks,
Oliver




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux