qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Phil Dennis-Jordan <phil@philjordan.eu>, qemu-devel@nongnu.org
Cc: dirty@apple.com, rbolshakov@ddn.com, lists@philjordan.eu
Subject: Re: [PATCH 0/3] hvf x86 correctness and efficiency improvements
Date: Mon, 16 Oct 2023 16:39:23 +0200	[thread overview]
Message-ID: <4319fcd1-981c-4ef0-b6b9-1f7f57c1c4ca@redhat.com> (raw)
In-Reply-To: <20230922140914.13906-1-phil@philjordan.eu>

On 9/22/23 16:09, Phil Dennis-Jordan wrote:
> Patch 1 enables the INVTSC CPUID bit when running with hvf. This can 
> enable some optimisations in the guest OS, and I've not found any reason 
> it shouldn't be allowed for hvf based hosts.

It can be enabled, but it should include a migration blocker.  In fact, 
probably HVF itself should include a migration blocker because QEMU 
doesn't support TSC scaling.

> Patch 2 fixes hvf_kick_vcpu_thread so it actually forces a VM exit instead of
> doing nothing. I guess this previously didn't cause any huge issues because
> hvf's hv_vcpu_run() would exit so extremely frequently on its own accord.

No, it's because signal delivery should already kick the vCPU out of 
guest mode.  I guess it does with hv_vcpu_run(), but not with 
hv_vcpu_run_until()?

hv_vcpu_interrupt() is a problematic API, in that it is not clear how it 
handles races with hv_vcpu_run().  In particular, whether this causes an 
immediate vmexit or not:

            thread 1                         thread 2
            -----------------------          -----------------------
                                             <CPU not in guest mode>
            hv_vcpu_interrupt()
                                             hv_vcpu_run() (or run_until)

Not that the current code is any better; there is no guarantee that the 
signal is delivered before hv_vcpu_run() is called.  However, if as you 
said hv_vcpu_run() will exit often on its own accord but 
hv_vcpu_run_until() does not, then this could cause difficult to 
reproduce bugs by switching to the latter.

> The temp variable is needed because the pointer expected by the hv_vcpu_interrupt()
> call doesn't match the fd field's type in the hvf accel's struct AccelCPUState.
> I'm unsure if it would be better to change that struct field to the relevant
> architecture's handle types, hv_vcpuid_t (x86, unsigned int) and hv_vcpu_t
> (aarch64, uint64_t), perhaps via an intermediate typedef?

I think fd and the HVF type should be placed in an anonymous union.

Thanks,

Paolo



  parent reply	other threads:[~2023-10-16 14:39 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-22 14:09 [PATCH 0/3] hvf x86 correctness and efficiency improvements Phil Dennis-Jordan
2023-09-22 14:09 ` [PATCH 1/3] i386: hvf: Adds support for INVTSC cpuid bit Phil Dennis-Jordan
2023-10-08 18:07   ` Roman Bolshakov
2023-09-22 14:09 ` [PATCH 2/3] i386: hvf: In kick_vcpu use hv_vcpu_interrupt to force exit Phil Dennis-Jordan
2023-10-08 18:23   ` Roman Bolshakov
2023-10-08 18:39     ` Phil Dennis-Jordan
2023-10-08 19:19       ` Roman Bolshakov
2023-10-08 19:29         ` Phil Dennis-Jordan
2023-10-16 14:19           ` Phil Dennis-Jordan
2023-10-20 15:12             ` Phil Dennis-Jordan
2023-11-05 15:21               ` Roman Bolshakov
2023-11-06 14:15                 ` Phil Dennis-Jordan
2023-09-22 14:09 ` [PATCH 3/3] i386: hvf: Updates API usage to use modern vCPU run function Phil Dennis-Jordan
2023-10-05 20:30 ` [PATCH 0/3] hvf x86 correctness and efficiency improvements Phil Dennis-Jordan
2023-10-16 14:39 ` Paolo Bonzini [this message]
2023-10-16 16:45   ` Phil Dennis-Jordan
2023-10-16 16:48     ` Paolo Bonzini
2023-10-16 20:05       ` Phil Dennis-Jordan
2023-10-16 21:08         ` Paolo Bonzini

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=4319fcd1-981c-4ef0-b6b9-1f7f57c1c4ca@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=dirty@apple.com \
    --cc=lists@philjordan.eu \
    --cc=phil@philjordan.eu \
    --cc=qemu-devel@nongnu.org \
    --cc=rbolshakov@ddn.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).