linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Ganapatrao Kulkarni <gankulkarni@os.amperecomputing.com>
Cc: linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org, eauger@redhat.com,
	miguel.luis@oracle.com, darren@os.amperecomputing.com,
	scott@os.amperecomputing.com,
	Christoffer Dall <Christoffer.Dall@arm.com>
Subject: Re: [PATCH 2/2] KVM: arm64: timers: Adjust CVAL of a ptimer across guest entry and exits
Date: Mon, 28 Aug 2023 11:17:03 +0100	[thread overview]
Message-ID: <864jkjfp40.wl-maz@kernel.org> (raw)
In-Reply-To: <80bce164-4fb9-0126-0ba0-02581be1a0a5@os.amperecomputing.com>

On Thu, 24 Aug 2023 07:37:42 +0100,
Ganapatrao Kulkarni <gankulkarni@os.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.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-08-28 10:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-17  6:03 [PATCH 0/2] Avoid spurious ptimer interrupts for non-zero cntpoff Ganapatrao Kulkarni
2023-08-17  6:03 ` [PATCH 1/2] KVM: arm64: timers: Move helper has_cntpoff to a header file Ganapatrao Kulkarni
2023-08-17  6:03 ` [PATCH 2/2] KVM: arm64: timers: Adjust CVAL of a ptimer across guest entry and exits Ganapatrao Kulkarni
2023-08-17  8:27   ` Marc Zyngier
2023-08-17  9:27     ` Ganapatrao Kulkarni
2023-08-17 10:04       ` Marc Zyngier
2023-08-22 12:16       ` Marc Zyngier
2023-08-22 14:57         ` Ganapatrao Kulkarni
2023-08-24  6:37           ` Ganapatrao Kulkarni
2023-08-28 10:17             ` Marc Zyngier [this message]
2023-09-01 12:15               ` Ganapatrao Kulkarni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=864jkjfp40.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=Christoffer.Dall@arm.com \
    --cc=darren@os.amperecomputing.com \
    --cc=eauger@redhat.com \
    --cc=gankulkarni@os.amperecomputing.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miguel.luis@oracle.com \
    --cc=scott@os.amperecomputing.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).