From nobody Mon Feb 9 17:25:08 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 152207176458457.43247474889017; Mon, 26 Mar 2018 06:42:44 -0700 (PDT) Received: from localhost ([::1]:56824 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0SOZ-00034T-OR for importer@patchew.org; Mon, 26 Mar 2018 09:42:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57096) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0SIw-0006U6-95 for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:36:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0SIu-0006us-U6 for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:36:54 -0400 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:45087) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f0SIu-0006tl-NZ for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:36:52 -0400 Received: by mail-wr0-x241.google.com with SMTP id u11so6644474wri.12 for ; Mon, 26 Mar 2018 06:36:52 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id g186sm6710105wmd.41.2018.03.26.06.36.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Mar 2018 06:36:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=4ELb+We8NVDSV4gdoXiNpvFWWTtOg/ieCG6QkY/NApc=; b=GxCIZJH+YVy5J0wjLj2EMELrg/dwI3bAvYk1chfBT3AWZTC6uteQg9fswKI7blhmnz kSBy3tbnXtEMXoDHzqWhdqk+XhBuDyhEFQEuvUMPS1B7qqmz2oQYyjWbAT0rs9rvU9lj +CY+1wzC6CBCLNWCaZnAdobKxQv9Glo0/T/pkF8MjcwIgTdRbQiowvRIa+YRTbKDW2pi 6K859H77d+Nx7JSSr4RXMkzd6RBRwZFJA+1BbbaFrFo7ufCYS9YzV5U5qbWE/KvkV5q+ oWmSSMh9bPM/ICB/aOdZVl5CUb5obS06a98x3KmueksztghZK40wUPB7vhULhgp5Qlku Y3sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=4ELb+We8NVDSV4gdoXiNpvFWWTtOg/ieCG6QkY/NApc=; b=awhBAbyZrcl/yF0ZMRjEqlyPcAWFKs8fsq0Heuh8fNowksKZNQOQQzti56HJ9mHq+p pTVQ/bWpNyC+ErDEvRzSY/OrdHWnO2JIkjbKOu52/PxYxmH7U0W2UYNrnUixYFDS4s/R YqpwORy124+T5/DFKh0NB3AE8AE3yWmyak/wfZtKHF8xutEfyl9taMmosFgZxp4U6MGC ZY6vFF3z1Q6x5wGt7KQfy57mJ5QFUeKHAqXeNaKRgZWFYkHX05ettqIQaCPYNz8KtP/k 0iwuXGl47HQf9laHazYyQkIsmLIAAYYyEJUSDs1P5rxSVFs9dX/co7IDCJ/5AM2x6g0Z Xi7g== X-Gm-Message-State: AElRT7HA6QrPC73XIM1b00lsKEjjsd3qw8ANFJ5B4nZiZP3Gp84RT0ES 4UNPp+Pnn26CYIeCZxygeG/K+i8m X-Google-Smtp-Source: AG47ELvVJn+trjZWN9OpPmkqhc+9C9XynANz9/+NXoubhgNAMcDZmWodL3LGMHm8SSBrIp0Ya3mCgA== X-Received: by 10.223.181.149 with SMTP id c21mr17621875wre.233.1522071411273; Mon, 26 Mar 2018 06:36:51 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 26 Mar 2018 15:36:31 +0200 Message-Id: <1522071403-52486-5-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1522071403-52486-1-git-send-email-pbonzini@redhat.com> References: <1522071403-52486-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::241 Subject: [Qemu-devel] [PULL 04/16] WHPX improve vcpu_post_run perf X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Justin Terry \(VM\)" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Justin Terry (VM)" This removes the additional call to WHvGetVirtualProcessorRegisters in whpx_vcpu_post_run now that the WHV_VP_EXIT_CONTEXT is returned in all WHV_RUN_VP_EXIT_CONTEXT structures. Signed-off-by: Justin Terry (VM) Message-Id: <1521039163-138-4-git-send-email-juterry@microsoft.com> Signed-off-by: Paolo Bonzini --- target/i386/whpx-all.c | 41 +++++++++++------------------------------ 1 file changed, 11 insertions(+), 30 deletions(-) diff --git a/target/i386/whpx-all.c b/target/i386/whpx-all.c index 63e6e1b..bf33d32 100644 --- a/target/i386/whpx-all.c +++ b/target/i386/whpx-all.c @@ -153,7 +153,7 @@ struct whpx_vcpu { bool interruptable; uint64_t tpr; uint64_t apic_base; - WHV_X64_PENDING_INTERRUPTION_REGISTER interrupt_in_flight; + bool interruption_pending; =20 /* Must be the last field as it may have a tail */ WHV_RUN_VP_EXIT_CONTEXT exit_ctx; @@ -695,7 +695,7 @@ static void whpx_vcpu_pre_run(CPUState *cpu) qemu_mutex_lock_iothread(); =20 /* Inject NMI */ - if (!vcpu->interrupt_in_flight.InterruptionPending && + if (!vcpu->interruption_pending && cpu->interrupt_request & (CPU_INTERRUPT_NMI | CPU_INTERRUPT_SMI)) { if (cpu->interrupt_request & CPU_INTERRUPT_NMI) { cpu->interrupt_request &=3D ~CPU_INTERRUPT_NMI; @@ -724,7 +724,7 @@ static void whpx_vcpu_pre_run(CPUState *cpu) } =20 /* Get pending hard interruption or replay one that was overwritten */ - if (!vcpu->interrupt_in_flight.InterruptionPending && + if (!vcpu->interruption_pending && vcpu->interruptable && (env->eflags & IF_MASK)) { assert(!new_int.InterruptionPending); if (cpu->interrupt_request & CPU_INTERRUPT_HARD) { @@ -781,44 +781,25 @@ static void whpx_vcpu_pre_run(CPUState *cpu) =20 static void whpx_vcpu_post_run(CPUState *cpu) { - HRESULT hr; - struct whpx_state *whpx =3D &whpx_global; struct whpx_vcpu *vcpu =3D get_whpx_vcpu(cpu); struct CPUX86State *env =3D (CPUArchState *)(cpu->env_ptr); X86CPU *x86_cpu =3D X86_CPU(cpu); - WHV_REGISTER_VALUE reg_values[4]; - const WHV_REGISTER_NAME reg_names[4] =3D { - WHvX64RegisterRflags, - WHvX64RegisterCr8, - WHvRegisterPendingInterruption, - WHvRegisterInterruptState, - }; =20 - hr =3D WHvGetVirtualProcessorRegisters(whpx->partition, cpu->cpu_index, - reg_names, 4, reg_values); - if (FAILED(hr)) { - error_report("WHPX: Failed to get interrupt state regusters," - " hr=3D%08lx", hr); - vcpu->interruptable =3D false; - return; - } + env->eflags =3D vcpu->exit_ctx.VpContext.Rflags; =20 - assert(reg_names[0] =3D=3D WHvX64RegisterRflags); - env->eflags =3D reg_values[0].Reg64; - - assert(reg_names[1] =3D=3D WHvX64RegisterCr8); - if (vcpu->tpr !=3D reg_values[1].Reg64) { - vcpu->tpr =3D reg_values[1].Reg64; + uint64_t tpr =3D vcpu->exit_ctx.VpContext.Cr8; + if (vcpu->tpr !=3D tpr) { + vcpu->tpr =3D tpr; qemu_mutex_lock_iothread(); cpu_set_apic_tpr(x86_cpu->apic_state, vcpu->tpr); qemu_mutex_unlock_iothread(); } =20 - assert(reg_names[2] =3D=3D WHvRegisterPendingInterruption); - vcpu->interrupt_in_flight =3D reg_values[2].PendingInterruption; + vcpu->interruption_pending =3D + vcpu->exit_ctx.VpContext.ExecutionState.InterruptionPending; =20 - assert(reg_names[3] =3D=3D WHvRegisterInterruptState); - vcpu->interruptable =3D !reg_values[3].InterruptState.InterruptShadow; + vcpu->interruptable =3D + !vcpu->exit_ctx.VpContext.ExecutionState.InterruptShadow; =20 return; } --=20 1.8.3.1