linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Radim Krčmář" <rkrcmar@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Gleb Natapov <gleb@kernel.org>,
	Raghavendra KT <raghavendra.kt@linux.vnet.ibm.com>,
	Vinod Chegu <chegu_vinod@hp.com>, Hui-Zhi <hui-zhi.zhao@hp.com>
Subject: Re: [PATCH 9/9] KVM: VMX: automatic PLE window maximum
Date: Wed, 20 Aug 2014 18:26:54 +0200	[thread overview]
Message-ID: <20140820162653.GC20453@potion.brq.redhat.com> (raw)
In-Reply-To: <53F4C6D2.9050209@redhat.com>

2014-08-20 18:03+0200, Paolo Bonzini:
> Il 20/08/2014 18:01, Radim Krčmář ha scritto:
> > 2014-08-20 17:34+0200, Paolo Bonzini:
> >> Il 20/08/2014 17:31, Radim Krčmář ha scritto:
> >>> Btw. without extra code, we are still going to overflow on races when
> >>> changing PW_grow, should they be covered as well?
> >>
> >> You mean because there is no spinlock or similar protecting the changes?
> >>  I guess you could use a seqlock.
> > 
> > Yes, for example between a modification of ple_window
> >   new = min(old, PW_actual_max) * PW_grow
> > which gets compiled into something like this:
> >   1) tmp = min(old, PW_actual_max)
> >   2) new = tmp * PW_grow
> > and a write to increase PW_grow
> >   3) PW_actual_max = min(PW_max / new_PW_grow, PW_actual_max)
> >   4) PW_grow = new_PW_grow
> >   5) PW_actual_max = PW_max / new_PW_grow
> > 
> > 3 and 4 can exectute between 1 and 2, which could overflow.
> > 
> > I don't think they are important enough to warrant a significant
> > performance hit of locking.
> 
> A seqlock just costs two memory accesses to the same (shared) cache line
> as the PW data, and a non-taken branch.

Oh, seqlock readers do not have to write to shared memory, so it is
acceptable ...

>                                         I don't like code that is
> unsafe by design...

I wouldn't say it is unsafe, because VCPU's PW is always greater than
module's PW. We are just going to PLE exit sooner than expected.

  reply	other threads:[~2014-08-20 16:27 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-19 20:35 [PATCH 0/9] Dynamic Pause Loop Exiting window Radim Krčmář
2014-08-19 20:35 ` [PATCH 1/9] KVM: add kvm_arch_sched_in Radim Krčmář
2014-08-20  7:47   ` Christian Borntraeger
2014-08-20 12:56     ` Radim Krčmář
2014-08-19 20:35 ` [PATCH 2/9] KVM: x86: introduce sched_in to kvm_x86_ops Radim Krčmář
2014-08-19 20:35 ` [PATCH 3/9] KVM: VMX: make PLE window per-vcpu Radim Krčmář
2014-08-20  7:13   ` Paolo Bonzini
2014-08-20 12:26     ` Radim Krčmář
2014-08-19 20:35 ` [PATCH 4/9] KVM: VMX: dynamise PLE window Radim Krčmář
2014-08-19 20:35 ` [PATCH 5/9] KVM: VMX: clamp " Radim Krčmář
2014-08-20  7:18   ` Paolo Bonzini
2014-08-20 12:46     ` Radim Krčmář
2014-08-19 20:35 ` [PATCH 6/9] KVM: trace kvm_ple_window grow/shrink Radim Krčmář
2014-08-19 20:35 ` [PATCH 7/9] KVM: VMX: abstract ple_window modifiers Radim Krčmář
2014-08-20  7:02   ` Paolo Bonzini
2014-08-20 12:25     ` Radim Krčmář
2014-08-19 20:35 ` [PATCH 8/9] KVM: VMX: runtime knobs for dynamic PLE window Radim Krčmář
2014-08-19 20:35 ` [PATCH 9/9] KVM: VMX: automatic PLE window maximum Radim Krčmář
2014-08-20  7:16   ` Paolo Bonzini
2014-08-20  7:18     ` Paolo Bonzini
2014-08-20 12:41     ` Radim Krčmář
2014-08-20 13:15       ` Paolo Bonzini
2014-08-20 15:31         ` Radim Krčmář
2014-08-20 15:34           ` Paolo Bonzini
2014-08-20 16:01             ` Radim Krčmář
2014-08-20 16:03               ` Paolo Bonzini
2014-08-20 16:26                 ` Radim Krčmář [this message]
2014-08-21  6:48 ` [PATCH 0/9] Dynamic Pause Loop Exiting window Zhao, Hui-Zhi (Steven, HPservers-Core-OE-PSC)

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=20140820162653.GC20453@potion.brq.redhat.com \
    --to=rkrcmar@redhat.com \
    --cc=chegu_vinod@hp.com \
    --cc=gleb@kernel.org \
    --cc=hui-zhi.zhao@hp.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=raghavendra.kt@linux.vnet.ibm.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).