From patchwork Fri Mar 20 23:14:05 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 13412 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n2KNGDUp012918 for ; Fri, 20 Mar 2009 23:16:13 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760603AbZCTXO1 (ORCPT ); Fri, 20 Mar 2009 19:14:27 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1760509AbZCTXO0 (ORCPT ); Fri, 20 Mar 2009 19:14:26 -0400 Received: from mx2.redhat.com ([66.187.237.31]:39008 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759174AbZCTXOY (ORCPT ); Fri, 20 Mar 2009 19:14:24 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n2KNEHPx004852; Fri, 20 Mar 2009 19:14:17 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n2KNEEXp022349; Fri, 20 Mar 2009 19:14:14 -0400 Received: from amt.cnet (vpn-10-55.str.redhat.com [10.32.10.55]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n2KNEEcp007858; Fri, 20 Mar 2009 19:14:16 -0400 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id A46B8550004; Fri, 20 Mar 2009 20:14:07 -0300 (BRT) Received: (from marcelo@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id n2KNE5u6026587; Fri, 20 Mar 2009 20:14:05 -0300 Date: Fri, 20 Mar 2009 20:14:05 -0300 From: Marcelo Tosatti To: Aurelien Jarno Cc: kvm@vger.kernel.org Subject: Re: cr3 OOS optimisation breaks 32-bit GNU/kFreeBSD guest Message-ID: <20090320231405.GA26415@amt.cnet> References: <20090223003305.GW12976@hall.aurel32.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20090223003305.GW12976@hall.aurel32.net> User-Agent: Mutt/1.5.18 (2008-05-17) X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Mon, Feb 23, 2009 at 01:33:05AM +0100, Aurelien Jarno wrote: > Hi, > > Since kvm-81, I have noticed that GNU/kFreeBSD 32-bit guest are crashing > under high load (during a compilation for example) with the following > error message: > > | Fatal trap 12: page fault while in kernel mode > | fault virtual address = 0x4 > | fault code = supervisor read, page not present > | instruction pointer = 0x20:0xc0a4fc00 > | stack pointer = 0x28:0xe66d7a70 > | frame pointer = 0x28:0xe66d7a80 > | code segment = base 0x0, limit 0xfffff, type 0x1b > | = DPL 0, pres 1, def32 1, gran 1 > | processor eflags = interrupt enabled, resume, IOPL = 0 > | current process = 24037 (bash) > | trap number = 12 > | panic: page fault > | Uptime: 4m7s > | Cannot dump. No dump device defined. > | Automatic reboot in 15 seconds - press a key on the console to abort Aurelien, Can you try this patch please. ------- KVM: MMU: do not allow unsync global pages to become unreachable Section 5.1 of the Intel TLB doc: "• INVLPG. This instruction takes a single operand, which is a linear address. The instruction invalidates any TLB entries for the page number of that linear address including those for global pages (see Section 7). INVLPG also invalidates all entries in all paging-structure caches regardless of the linear addresses to which they correspond." Section 7: "The following items detail the invalidation of global TLB entries: • An execution of INVLPG invalidates any TLB entries for the page number of the linear address that is its operand, even if the entries are global." If an unsync global page becomes unreachable via the shadow tree, which can happen if one its parent pages is zapped, invlpg will fail to invalidate translations for gvas contained in such unreachable pages. So invalidate all unsync global entries when zapping a page. Another possibility would be to cover global pages in the unsync bitmaps, but that would increase overhead for mmu_sync_roots. --- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: kvm/arch/x86/kvm/mmu.c =================================================================== --- kvm.orig/arch/x86/kvm/mmu.c +++ kvm/arch/x86/kvm/mmu.c @@ -1362,6 +1362,16 @@ static void kvm_mmu_unlink_parents(struc } } +static void mmu_invalidate_unsync_global(struct kvm *kvm) +{ + struct kvm_mmu_page *sp, *n; + + list_for_each_entry_safe(sp, n, &kvm->arch.oos_global_pages, oos_link) { + kvm_mmu_page_unlink_children(kvm, sp); + kvm_unlink_unsync_page(kvm, sp); + } +} + static int mmu_zap_unsync_children(struct kvm *kvm, struct kvm_mmu_page *parent) { @@ -1384,6 +1394,8 @@ static int mmu_zap_unsync_children(struc kvm_mmu_pages_init(parent, &parents, &pages); } + mmu_invalidate_unsync_global(kvm); + return zapped; }