From: Paolo Bonzini <pbonzini@redhat.com>
To: Roman Bolshakov <r.bolshakov@yadro.com>, qemu-devel@nongnu.org
Cc: Eduardo Habkost <ehabkost@redhat.com>,
Claudio Fontana <cfontana@suse.de>,
Cameron Esfahani <dirty@apple.com>,
Richard Henderson <rth@twiddle.net>
Subject: Re: [PATCH v2 1/9] i386: hvf: Set env->eip in macvm_set_rip()
Date: Tue, 30 Jun 2020 14:35:00 +0200 [thread overview]
Message-ID: <6a498ea9-2c9f-58be-5afc-3704db8af9d3@redhat.com> (raw)
In-Reply-To: <20200630102824.77604-2-r.bolshakov@yadro.com>
On 30/06/20 12:28, Roman Bolshakov wrote:
> cpu_synchronize_state() is currently no-op for hvf but BIOS will hang in
> vAPIC option ROM when cpu_synchronize_state() is wired to
> hvf_cpu_synchronize_state().
>
> cpu_synchronize_state() state is called from vapic_write() during option
> ROM initialization. It sets dirty flag on the cpu. macvm_set_rip() is
> then invoked to advance IP after the I/O write to vAPIC port.
>
> macvm_set_rip() only modifies VMCS, it doesn't change env->eip.
> Therefore on the next iteration of vCPU loop, vcpu_dirty flag is checked
> and hvf_put_registers() overwrites correct RIP in VMCS with the value of
> env->eip that points to the I/O write instruction. Execution of the CPU
> gets stuck on the instruction.
>
> The issue can be avoided if eip doesn't contain stale value when dirty
> flag is set on cpu.
>
> Cc: Cameron Esfahani <dirty@apple.com>
> Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
> ---
> target/i386/hvf/vmx.h | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/target/i386/hvf/vmx.h b/target/i386/hvf/vmx.h
> index ce2a1532d5..1e8b29bf7d 100644
> --- a/target/i386/hvf/vmx.h
> +++ b/target/i386/hvf/vmx.h
> @@ -173,6 +173,7 @@ static inline void macvm_set_rip(CPUState *cpu, uint64_t rip)
>
> /* BUG, should take considering overlap.. */
> wreg(cpu->hvf_fd, HV_X86_RIP, rip);
> + env->eip = rip;
>
> /* after moving forward in rip, we need to clean INTERRUPTABILITY */
> val = rvmcs(cpu->hvf_fd, VMCS_GUEST_INTERRUPTIBILITY);
>
Queued except for patch 4.
Paolo
next prev parent reply other threads:[~2020-06-30 12:36 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-30 10:28 [PATCH v2 0/9] Improve synchronization between QEMU and HVF Roman Bolshakov
2020-06-30 10:28 ` [PATCH v2 1/9] i386: hvf: Set env->eip in macvm_set_rip() Roman Bolshakov
2020-06-30 12:35 ` Paolo Bonzini [this message]
2020-06-30 10:28 ` [PATCH v2 2/9] i386: hvf: Move synchronize functions to sysemu Roman Bolshakov
2020-06-30 10:28 ` [PATCH v2 3/9] i386: hvf: Add hvf_cpu_synchronize_pre_loadvm() Roman Bolshakov
2020-06-30 10:28 ` [PATCH v2 4/9] i386: hvf: Implement CPU kick Roman Bolshakov
2020-06-30 12:33 ` Paolo Bonzini
2020-06-30 15:50 ` Roman Bolshakov
2020-06-30 16:04 ` Paolo Bonzini
2020-07-01 18:36 ` Roman Bolshakov
2020-07-01 18:50 ` Paolo Bonzini
2020-06-30 10:28 ` [PATCH v2 5/9] i386: hvf: Make long mode enter and exit clearer Roman Bolshakov
2020-06-30 10:28 ` [PATCH v2 6/9] i386: hvf: Move Guest LMA reset to macvm_set_cr0() Roman Bolshakov
2020-06-30 10:28 ` [PATCH v2 7/9] i386: hvf: Don't duplicate register reset Roman Bolshakov
2020-06-30 10:28 ` [PATCH v2 8/9] i386: hvf: Clean up synchronize functions Roman Bolshakov
2020-06-30 10:28 ` [PATCH v2 9/9] MAINTAINERS: Add Cameron as HVF co-maintainer Roman Bolshakov
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=6a498ea9-2c9f-58be-5afc-3704db8af9d3@redhat.com \
--to=pbonzini@redhat.com \
--cc=cfontana@suse.de \
--cc=dirty@apple.com \
--cc=ehabkost@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=r.bolshakov@yadro.com \
--cc=rth@twiddle.net \
/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).