From owner-svn-src-user@FreeBSD.ORG Sat Sep 4 17:04:35 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 491011065695; Sat, 4 Sep 2010 17:04:35 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1E8CD8FC0A; Sat, 4 Sep 2010 17:04:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o84H4ZXH024208; Sat, 4 Sep 2010 17:04:35 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o84H4ZOQ024206; Sat, 4 Sep 2010 17:04:35 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201009041704.o84H4ZOQ024206@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 4 Sep 2010 17:04:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212211 - user/nwhitehorn/ps3/powerpc/ps3 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Sep 2010 17:04:35 -0000 Author: nwhitehorn Date: Sat Sep 4 17:04:34 2010 New Revision: 212211 URL: http://svn.freebsd.org/changeset/base/212211 Log: Fix a bug where the passed PTEG index to mps3_pte_insert was taken as the PTEG index where the evicted PTE came from, although the evicted PTE may have come from the secondary PTEG. Fix this by using the page table slot of the inserted PTE to get the evicted PTE's PTEG. Modified: user/nwhitehorn/ps3/powerpc/ps3/mmu_ps3.c Modified: user/nwhitehorn/ps3/powerpc/ps3/mmu_ps3.c ============================================================================== --- user/nwhitehorn/ps3/powerpc/ps3/mmu_ps3.c Sat Sep 4 16:27:14 2010 (r212210) +++ user/nwhitehorn/ps3/powerpc/ps3/mmu_ps3.c Sat Sep 4 17:04:34 2010 (r212211) @@ -51,6 +51,7 @@ #include "ps3-hvcall.h" #define VSID_HASH_MASK 0x0000007fffffffffUL +#define PTESYNC() __asm __volatile("ptesync") extern int ps3fb_remap(void); @@ -198,6 +199,7 @@ mps3_pte_synch(struct lpte *pt, struct l uint64_t halfbucket[4], rcbits; uint64_t slot = (uint64_t)(pt)-1; + PTESYNC(); lv1_read_htab_entries(mps3_vas_id, slot & ~0x3UL, &halfbucket[0], &halfbucket[1], &halfbucket[2], &halfbucket[3], &rcbits); @@ -211,7 +213,6 @@ mps3_pte_synch(struct lpte *pt, struct l ("PTE upper word %#lx != %#lx\n", halfbucket[slot & 0x3], pvo_pt->pte_hi)); - pvo_pt->pte_lo &= ~(LPTE_CHG | LPTE_REF); pvo_pt->pte_lo |= (rcbits >> ((3 - (slot & 0x3))*16)) & (LPTE_CHG | LPTE_REF); } @@ -285,12 +286,16 @@ mps3_pte_insert(u_int ptegidx, struct lp * here after a fault. */ + ptegidx = index >> 3; /* Where the sacrifice PTE was found */ if (evicted.pte_hi & LPTE_HID) ptegidx ^= moea64_pteg_mask; /* PTEs indexed by primary */ + result = 0; LIST_FOREACH(pvo, &moea64_pvo_table[ptegidx], pvo_olink) { - if ((pvo->pvo_pte.lpte.pte_hi & LPTE_AVPN_MASK) - == (evicted.pte_hi & LPTE_AVPN_MASK)) { + if (!PVO_PTEGIDX_ISSET(pvo)) + continue; + + if (pvo->pvo_pte.lpte.pte_hi == (evicted.pte_hi | LPTE_VALID)) { KASSERT(pvo->pvo_pte.lpte.pte_hi & LPTE_VALID, ("Invalid PVO for valid PTE!")); pvo->pvo_pte.lpte.pte_hi &= ~LPTE_VALID; @@ -299,10 +304,13 @@ mps3_pte_insert(u_int ptegidx, struct lp PVO_PTEGIDX_CLR(pvo); moea64_pte_valid--; moea64_pte_overflow++; + result = 1; break; } } + KASSERT(result == 1, ("PVO for sacrifice PTE not found")); + return (index & 0x7); }