qemu-arm
[Top][All Lists]
Advanced

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

Re: [PATCH v6 09/11] arm/hvf: Add a WFI handler


From: Alexander Graf
Subject: Re: [PATCH v6 09/11] arm/hvf: Add a WFI handler
Date: Sun, 21 Mar 2021 17:28:39 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:87.0) Gecko/20100101 Thunderbird/87.0


On 10.02.21 23:17, Peter Maydell wrote:
On Wed, 10 Feb 2021 at 20:25, Peter Collingbourne <pcc@google.com> wrote:
On Thu, Jan 28, 2021 at 8:25 AM Peter Maydell <peter.maydell@linaro.org> wrote:
On Wed, 20 Jan 2021 at 22:44, Alexander Graf <agraf@csgraf.de> wrote:
+                if (!seconds && nanos < 2000000) {
+                    break;
+                }
+
+                struct timespec ts = { seconds, nanos };
+                hvf_wait_for_ipi(cpu, &ts);
+            }
Why doesn't the timer timeout manifest as an IPI ? (Put another way,
why is the timer interrupt special?)
Timer timeouts result in an IPI (via HV_EXIT_REASON_VTIMER_ACTIVATED)
if they become due while in hv_vcpu_run(). But at this point we are
not in hv_vcpu_run() (due to the aforementioned difference in wait
behavior between x86 and ARM) so we need to "manually" wait for the
timer to become due, re-enter the guest, let it exit with
HV_EXIT_REASON_VTIMER_ACTIVATED and then trigger the IPI.
But WFI doesn't just wait for a timer interrupt, it waits for
any interrupt. So it doesn't seem right that the timer interrupt
in particular is being handled specially here.


It waits for either an external interrupt (vcpu_kick() -> IPI -> signal -> pselect exits) or a vtimer (kept in the CPU thread, handled by hvf natively when vCPU is running, handled through the pselect timeout when in WFI mode).

In hvf on ARM, the vtimer is handled specially. It is owned by the kernel code when we're inside the CPU loop. We don't even get vtimer MSR exits. However when user space decides to not return to the kernel CPU loop, it needs to handle the vtimer expiry itself. We really only have that case on WFI.


Alex





reply via email to

[Prev in Thread] Current Thread [Next in Thread]