Date: Fri, 19 Mar 2010 17:05:41 +0000 (UTC) From: Nathan Whitehorn <nwhitehorn@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r205339 - projects/ppc64/sys/powerpc/aim Message-ID: <201003191705.o2JH5fCT011519@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: nwhitehorn Date: Fri Mar 19 17:05:41 2010 New Revision: 205339 URL: http://svn.freebsd.org/changeset/base/205339 Log: Fix some minor races during SLB spills, and correct a comment that no longer reflects the truth. Modified: projects/ppc64/sys/powerpc/aim/slb.c Modified: projects/ppc64/sys/powerpc/aim/slb.c ============================================================================== --- projects/ppc64/sys/powerpc/aim/slb.c Fri Mar 19 16:25:05 2010 (r205338) +++ projects/ppc64/sys/powerpc/aim/slb.c Fri Mar 19 17:05:41 2010 (r205339) @@ -174,10 +174,8 @@ slb_insert(pmap_t pm, struct slb *slbcac uint64_t slbe, slbv; int i, j, to_spill; - /* - * Note: no locking is necessary in this function because all slbcaches - * are either for the current thread or per-CPU. - */ + /* We don't want to be preempted while modifying the kernel map */ + critical_enter(); to_spill = -1; slbv = slb_entry->slbv; @@ -203,6 +201,11 @@ slb_insert(pmap_t pm, struct slb *slbcac panic("SLB spill on ESID %#lx, but no available candidates!\n", (slbe & SLBE_ESID_MASK) >> SLBE_ESID_SHIFT); + if (slbcache[to_spill].slbe & SLBE_VALID) { + /* Invalidate this first to avoid races */ + slbcache[to_spill].slbe = 0; + mb(); + } slbcache[to_spill].slbv = slbv; slbcache[to_spill].slbe = slbe | (uint64_t)to_spill; @@ -213,6 +216,8 @@ slb_insert(pmap_t pm, struct slb *slbcac "r"(slbcache[to_spill].slbv), "r"(slbcache[to_spill].slbe)); } + + critical_exit(); } int
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201003191705.o2JH5fCT011519>