public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Radim Krčmář" <rkrcmar@redhat.com>
To: Denis Plotnikov <dplotnikov@virtuozzo.com>
Cc: rkagan@virtuozzo.com, den@virtuozzo.com, pbonzini@redhat.com,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] KVM: x86: avoid redundant REQ_EVENT
Date: Wed, 14 Dec 2016 22:36:29 +0100	[thread overview]
Message-ID: <20161214213628.GB6667@potion> (raw)
In-Reply-To: <20161214105908.322638-1-dplotnikov@virtuozzo.com>

2016-12-14 13:59+0300, Denis Plotnikov:
> When processing KVM_REQ_EVENT, apic_update_ppr is called which may set
> KVM_REQ_EVENT again if the recalculated value of PPR becomes smaller
> than the previous one. This results in cancelling the guest entry and
> reiterating in vcpu_enter_guest.
> 
> However this is unnecessary because at this point KVM_REQ_EVENT is
> already being processed and there are no other changes in the lapic
> that may require full-fledged state recalculation.
> 
> This situation is often hit on systems with TPR shadow, where the
> TPR can be updated by the guest without a vmexit, so that the first
> apic_update_ppr to notice it is exactly the one called while
> processing KVM_REQ_EVENT.
> 
> To avoid it, introduce a parameter in apic_update_ppr allowing to
> suppress setting of KVM_REQ_EVENT, and use it on the paths called from
> KVM_REQ_EVENT processing.
> Also add the parameter to kvm_cpu_get_interrupt to be passed through
> to apic_update_ppr to make sure the supression of KVM_REQ_EVENT is done
> in the KVM_REQ_EVENT processing path only.
> 
> This microoptimization gives 10% performance increase on a synthetic
> test doing a lot of IPC in Windows using window messages.
> 
> Reviewed-by: Roman Kagan <rkagan@virtuozzo.com>
> Signed-off-by: Denis Plotnikov <dplotnikov@virtuozzo.com>
> ---

It is not pretty, but desirable,

Reviewed-by: Radim Krčmář <rkrcmar@redhat.com>

Thanks.

  reply	other threads:[~2016-12-14 21:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-14 10:59 [PATCH v2] KVM: x86: avoid redundant REQ_EVENT Denis Plotnikov
2016-12-14 21:36 ` Radim Krčmář [this message]
2016-12-14 22:29 ` Paolo Bonzini
     [not found]   ` <20161215071840.GB7704@rkaganb.sw.ru>
2016-12-15 14:30     ` Radim Krčmář
2016-12-15 14:32       ` Paolo Bonzini
2016-12-15 14:56         ` Roman Kagan
2016-12-18 21:03           ` 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=20161214213628.GB6667@potion \
    --to=rkrcmar@redhat.com \
    --cc=den@virtuozzo.com \
    --cc=dplotnikov@virtuozzo.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rkagan@virtuozzo.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