lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <864jkjfp40.wl-maz@kernel.org>
Date:   Mon, 28 Aug 2023 11:17:03 +0100
From:   Marc Zyngier <maz@...nel.org>
To:     Ganapatrao Kulkarni <gankulkarni@...amperecomputing.com>
Cc:     linux-kernel@...r.kernel.org, kvmarm@...ts.linux.dev,
        linux-arm-kernel@...ts.infradead.org, eauger@...hat.com,
        miguel.luis@...cle.com, darren@...amperecomputing.com,
        scott@...amperecomputing.com,
        Christoffer Dall <Christoffer.Dall@....com>
Subject: Re: [PATCH 2/2] KVM: arm64: timers: Adjust CVAL of a ptimer across guest entry and exits

On Thu, 24 Aug 2023 07:37:42 +0100,
Ganapatrao Kulkarni <gankulkarni@...amperecomputing.com> wrote:
> 
> >> Now, to the actual patch: I think the way you offset CVAL isn't
> >> great. You should never have to change it on entry, and you should
> >> instead read the correct value from memory. Then, save/restore of CVAL
> >> must be amended to always apply the offset. Can you give the hack
> >> below a go on your HW?
> 
> I tried this and seems not working, this is due to timer save/restore
> are not called for some of the kvm_exit and entry paths(lighter
> switches).

Can you point me to such paths? Are you referring to the ECV handling
of the physical timer registers?

> 
> I tried changing this patch like, Removed cval adjust from the
> kvm_entry and still cval is adjusted on kvm_exit and in
> timer_restore_state function, reduced cval by offset.
> 
> Please let me know, if this is not you intended to try?
> If possible, please share the steps or pseudo code.

What I want to get to is that:

- on entry (TGE having been flipped to 0), the guest's CVAL is always
  reload from memory, because that's the absolute reference. We should
  never load anything else on the CPU.

- on exit (TGE having been flipped to 1), the guest's CVAL is stored
  as the one true value to memory, and the CPU's view is offset by the
  offset.

- the high-level save/restore helpers apply the offsets back and forth
  as if CNTPOFF didn't exist (because that's exactly the case if
  TGE=1).

Now, I'm pretty sure I'm still missing something, but the above is
roughly the scheme I'm trying to follow?

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ