From patchwork Thu Jun 20 08:59:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takuya Yoshikawa X-Patchwork-Id: 2753851 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 02EE8C0AB1 for ; Thu, 20 Jun 2013 09:11:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4910E203A3 for ; Thu, 20 Jun 2013 09:11:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8892A2039A for ; Thu, 20 Jun 2013 09:11:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755509Ab3FTJLi (ORCPT ); Thu, 20 Jun 2013 05:11:38 -0400 Received: from tama50.ecl.ntt.co.jp ([129.60.39.147]:34060 "EHLO tama50.ecl.ntt.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754182Ab3FTJLh (ORCPT ); Thu, 20 Jun 2013 05:11:37 -0400 X-Greylist: delayed 817 seconds by postgrey-1.27 at vger.kernel.org; Thu, 20 Jun 2013 05:11:37 EDT Received: from mfs5.rdh.ecl.ntt.co.jp (mfs5.rdh.ecl.ntt.co.jp [129.60.39.144]) by tama50.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id r5K8vta3004730; Thu, 20 Jun 2013 17:57:55 +0900 Received: from mfs5.rdh.ecl.ntt.co.jp (localhost.localdomain [127.0.0.1]) by mfs5.rdh.ecl.ntt.co.jp (Postfix) with ESMTP id 0D10EE0128; Thu, 20 Jun 2013 17:57:55 +0900 (JST) Received: from imail2.m.ecl.ntt.co.jp (imail2.m.ecl.ntt.co.jp [129.60.5.247]) by mfs5.rdh.ecl.ntt.co.jp (Postfix) with ESMTP id EC15EE0124; Thu, 20 Jun 2013 17:57:54 +0900 (JST) Received: from yshpad ([129.60.241.168]) by imail2.m.ecl.ntt.co.jp (8.13.8/8.13.8) with SMTP id r5K8vsJr005698; Thu, 20 Jun 2013 17:57:54 +0900 Date: Thu, 20 Jun 2013 17:59:14 +0900 From: Takuya Yoshikawa To: gleb@redhat.com, pbonzini@redhat.com Cc: kvm@vger.kernel.org, xiaoguangrong@linux.vnet.ibm.com Subject: [PATCH] KVM: MMU: Inform users of mmio generation wraparound Message-Id: <20130620175914.4e4f9eb3.yoshikawa_takuya_b1@lab.ntt.co.jp> X-Mailer: Sylpheed 3.1.0 (GTK+ 2.24.4; x86_64-pc-linux-gnu) Mime-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Without this information, users will just see unexpected performance problems and there is little chance we will get good reports from them: note that mmio generation is increased even when we just start, or stop, dirty logging for some memory slot, in which case users should never expect all shadow pages to be zapped. Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/mmu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index c60c5da..bc8302f 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -4385,8 +4385,10 @@ void kvm_mmu_invalidate_mmio_sptes(struct kvm *kvm) * The max value is MMIO_MAX_GEN - 1 since it is not called * when mark memslot invalid. */ - if (unlikely(kvm_current_mmio_generation(kvm) >= (MMIO_MAX_GEN - 1))) + if (unlikely(kvm_current_mmio_generation(kvm) >= (MMIO_MAX_GEN - 1))) { + printk(KERN_INFO "kvm: zapping shadow pages for mmio generation wraparound"); kvm_mmu_invalidate_zap_all_pages(kvm); + } } static int mmu_shrink(struct shrinker *shrink, struct shrink_control *sc)