From: Paolo Bonzini <pbonzini@redhat.com>
To: Sunil Muthuswamy <sunilmut@microsoft.com>,
Richard Henderson <rth@twiddle.net>,
Eduardo Habkost <ehabkost@redhat.com>
Cc: Stefan Weil <sw@weilnetz.de>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"Justin Terry \(SF\)" <juterry@microsoft.com>
Subject: Re: [PATCH] WHPX: Use proper synchronization primitives while processing
Date: Tue, 3 Mar 2020 11:17:43 +0100 [thread overview]
Message-ID: <55f40d1a-0a08-e34b-dd48-527cb77a5c48@redhat.com> (raw)
In-Reply-To: <SN4PR2101MB0880A1C19D64131DE3D261B5C0EC0@SN4PR2101MB0880.namprd21.prod.outlook.com>
On 24/02/20 20:27, Sunil Muthuswamy wrote:
> WHPX wasn't using the proper synchronization primitives while
> processing async events, which can cause issues with SMP.
>
> Signed-off-by: Sunil Muthuswamy <sunilmut@microsoft.com>
> ---
> target/i386/whpx-all.c | 17 +++++++----------
> 1 file changed, 7 insertions(+), 10 deletions(-)
>
> diff --git a/target/i386/whpx-all.c b/target/i386/whpx-all.c
> index 35601b8176..868ade5fd0 100644
> --- a/target/i386/whpx-all.c
> +++ b/target/i386/whpx-all.c
> @@ -841,9 +841,8 @@ static void whpx_vcpu_process_async_events(CPUState *cpu)
>
> if ((cpu->interrupt_request & CPU_INTERRUPT_INIT) &&
> !(env->hflags & HF_SMM_MASK)) {
> -
> + whpx_cpu_synchronize_state(cpu);
> do_cpu_init(x86_cpu);
> - cpu->vcpu_dirty = true;
> vcpu->interruptable = true;
> }
>
> @@ -859,17 +858,13 @@ static void whpx_vcpu_process_async_events(CPUState *cpu)
> }
>
> if (cpu->interrupt_request & CPU_INTERRUPT_SIPI) {
> - if (!cpu->vcpu_dirty) {
> - whpx_get_registers(cpu);
> - }
> + whpx_cpu_synchronize_state(cpu);
> do_cpu_sipi(x86_cpu);
> }
>
> if (cpu->interrupt_request & CPU_INTERRUPT_TPR) {
> cpu->interrupt_request &= ~CPU_INTERRUPT_TPR;
> - if (!cpu->vcpu_dirty) {
> - whpx_get_registers(cpu);
> - }
> + whpx_cpu_synchronize_state(cpu);
> apic_handle_tpr_access_report(x86_cpu->apic_state, env->eip,
> env->tpr_access_type);
> }
> @@ -1067,8 +1062,10 @@ static int whpx_vcpu_run(CPUState *cpu)
>
> static void do_whpx_cpu_synchronize_state(CPUState *cpu, run_on_cpu_data arg)
> {
> - whpx_get_registers(cpu);
> - cpu->vcpu_dirty = true;
> + if (!cpu->vcpu_dirty) {
> + whpx_get_registers(cpu);
> + cpu->vcpu_dirty = true;
> + }
> }
>
> static void do_whpx_cpu_synchronize_post_reset(CPUState *cpu,
>
Queued, thanks.
Paolo
prev parent reply other threads:[~2020-03-03 10:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-24 19:27 [PATCH] WHPX: Use proper synchronization primitives while processing Sunil Muthuswamy
2020-03-02 20:03 ` Sunil Muthuswamy
2020-03-03 10:17 ` Paolo Bonzini [this message]
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=55f40d1a-0a08-e34b-dd48-527cb77a5c48@redhat.com \
--to=pbonzini@redhat.com \
--cc=ehabkost@redhat.com \
--cc=juterry@microsoft.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--cc=sunilmut@microsoft.com \
--cc=sw@weilnetz.de \
/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).