From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH] KVM: x86: Avoid zapping mmio sptes twice for generation wraparound Date: Wed, 3 Jul 2013 12:05:35 +0300 Message-ID: <20130703090535.GF18508@redhat.com> References: <20130703171804.89d6cc2c.yoshikawa_takuya_b1@lab.ntt.co.jp> <51D3E093.3020408@redhat.com> <51D3E33D.1090704@linux.vnet.ibm.com> <51D3E5DC.5020902@linux.vnet.ibm.com> <51D3E69F.2050104@redhat.com> <20130703180500.4b78ecdf.yoshikawa_takuya_b1@lab.ntt.co.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Paolo Bonzini , Xiao Guangrong , kvm@vger.kernel.org To: Takuya Yoshikawa Return-path: Received: from mx1.redhat.com ([209.132.183.28]:24407 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754542Ab3GCJFm (ORCPT ); Wed, 3 Jul 2013 05:05:42 -0400 Content-Disposition: inline In-Reply-To: <20130703180500.4b78ecdf.yoshikawa_takuya_b1@lab.ntt.co.jp> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Jul 03, 2013 at 06:05:00PM +0900, Takuya Yoshikawa wrote: > On Wed, 03 Jul 2013 10:53:51 +0200 > Paolo Bonzini wrote: > > > Il 03/07/2013 10:50, Xiao Guangrong 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(). > > > > > > > > > > Yes, the actual operation would be the same as this patch. You can > > rename kvm_mmu_invalidate_mmio_sptes to kvm_arch_memslots_installed, or > > something like that. But it would have to touch all architectures. > > I tried to avoid introducing x86-centric code into the generic one. > > If another arch can gain something by such function, I'm willing to > touch all arch code. > Please do. X86 is the most optimized one so it does things other arches do not yet. Slot generation update hook sounds generic enough. -- Gleb.