From: Paolo Bonzini <pbonzini@redhat.com>
To: Gleb Natapov <gleb@redhat.com>
Cc: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>,
Takuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp>,
kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: x86: Avoid zapping mmio sptes twice for generation wraparound
Date: Wed, 03 Jul 2013 10:57:35 +0200 [thread overview]
Message-ID: <51D3E77F.2060805@redhat.com> (raw)
In-Reply-To: <20130703085310.GD18508@redhat.com>
Il 03/07/2013 10:53, Gleb Natapov ha scritto:
>>> > > Please wait a while. I can not understand it very clearly.
>>> > >
>>> > > This conditional check will cause caching a overflow value into mmio spte.
>>> > > The simple case is that kvm adds new slots for many times, the mmio-gen is easily
>>> > > more than MMIO_MAX_GEN.
>>> > >
>> >
>> > Actually, the double zapping can be avoided by moving kvm_mmu_invalidate_mmio_sptes to
>> > the end of install_new_memslots().
>> >
> Exactly. Why should we hide it in obscure functions?
Because kvm_mmu_invalidate_mmio_sptes is an x86-specific function, and
we already have a good arch API to hook into __kvm_set_memory_region.
Another possible implementation is to cache the last memslot generation,
check it in kvm_arch_prepare/commit_memory_region, and call
kvm_mmu_invalidate_mmio_sptes if it changed. This would avoid the need
to keep "((change == KVM_MR_DELETE) || (change == KVM_MR_MOVE))" in sync
between the two places. But I don't think it is a substantial improvement.
Paolo
next prev parent reply other threads:[~2013-07-03 8:57 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-03 8:18 [PATCH] KVM: x86: Avoid zapping mmio sptes twice for generation wraparound Takuya Yoshikawa
2013-07-03 8:28 ` Paolo Bonzini
2013-07-03 8:39 ` Xiao Guangrong
2013-07-03 8:50 ` Takuya Yoshikawa
2013-07-03 8:50 ` Xiao Guangrong
2013-07-03 8:50 ` Paolo Bonzini
2013-07-03 9:00 ` Xiao Guangrong
2013-07-03 8:50 ` Xiao Guangrong
2013-07-03 8:53 ` Gleb Natapov
2013-07-03 8:57 ` Paolo Bonzini [this message]
2013-07-03 9:03 ` Gleb Natapov
2013-07-03 8:53 ` Paolo Bonzini
2013-07-03 9:05 ` Takuya Yoshikawa
2013-07-03 9:05 ` Gleb Natapov
2013-07-03 9:08 ` Paolo Bonzini
2013-07-03 9:10 ` Gleb Natapov
2013-07-03 9:17 ` Takuya Yoshikawa
2013-07-03 9:18 ` 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=51D3E77F.2060805@redhat.com \
--to=pbonzini@redhat.com \
--cc=gleb@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=xiaoguangrong@linux.vnet.ibm.com \
--cc=yoshikawa_takuya_b1@lab.ntt.co.jp \
/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