Date: Mon, 8 Jun 2009 16:56:46 +0400 From: Stanislav Sedov <stas@FreeBSD.org> To: Rafal Jaworowski <raj@FreeBSD.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r193712 - head/sys/arm/arm Message-ID: <20090608165646.95bb577e.stas@FreeBSD.org> In-Reply-To: <200906081215.n58CFdOl029049@svn.freebsd.org> References: <200906081215.n58CFdOl029049@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--Signature=_Mon__8_Jun_2009_16_56_46_+0400_63+6TJOT9B58s=SZ Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, 8 Jun 2009 12:15:39 +0000 (UTC) Rafal Jaworowski <raj@FreeBSD.org> mentioned: > Author: raj > Date: Mon Jun 8 12:15:39 2009 > New Revision: 193712 > URL: http://svn.freebsd.org/changeset/base/193712 >=20 > Log: > Invalidate cache in pmap_remove_all() on ARM. > =20 > When pages are removed from virtual address space by calling pmap_remov= e_all() > CPU caches were not invalidated, which led to read corruption when anot= her > page got mapped at this same virtual address at later time (the CPU was > retrieving stale contents). > =20 > Submitted by: Piotr Ziecik > Obtained from: Semihalf >=20 > Modified: > head/sys/arm/arm/pmap.c >=20 > Modified: head/sys/arm/arm/pmap.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/arm/arm/pmap.c Mon Jun 8 12:10:42 2009 (r193711) > +++ head/sys/arm/arm/pmap.c Mon Jun 8 12:15:39 2009 (r193712) > @@ -3124,7 +3124,19 @@ pmap_remove_all(vm_page_t m) > if (flush =3D=3D FALSE && (pv->pv_pmap =3D=3D curpm || > pv->pv_pmap =3D=3D pmap_kernel())) > flush =3D TRUE; > + > PMAP_LOCK(pv->pv_pmap); > + /* > + * Cached contents were written-back in pmap_remove_write(), > + * but we still have to invalidate the cache entry to make > + * sure stale data are not retrieved when another page will be > + * mapped under this virtual address. > + */ > + if (pmap_is_current(pv->pv_pmap)) { > + cpu_dcache_inv_range(pv->pv_va, PAGE_SIZE); > + cpu_l2cache_inv_range(pv->pv_va, PAGE_SIZE); > + } > + Hi, Rafal! What about calling the pmap_dcache_wb_range function for each mapping in the cycle instead of calling cpu_XXX_inv_range functions directly? I think something like this would do the trick: % pmap_dcache_wb_range(pv->pv_pmap, pv->pv_va, PAGE_SIZE, FALSE, % (pv->pv_flags & PVF_WRITE) =3D=3D 0) This will also take care of the writeback cache. I don't know if it is rea= lly needed, though. --=20 Stanislav Sedov ST4096-RIPE --Signature=_Mon__8_Jun_2009_16_56_46_+0400_63+6TJOT9B58s=SZ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- iQIcBAEBAgAGBQJKLQqTAAoJEKN82nOYvCd01lgP+wTnTAivy40PR/53O7dOtThv BOnvAKhJ+mLZbTiCdcBBMvXlSZ7CK6+wjGcvEEb2cSwz1unEhvf7aB9FL+J6zo3z lCF6jKJukA8gQUei2nRr7UfBuqiAiRr6zcQAajKMmQsfBKR4LUZaL55iXBrsR7Tu 33a9pGbAenSiQs+kSt/5dKaTb6zlWCbSx5EznNMQYsYNUl1mY6c4vvYF8UXDQACC WHQQgxQVNWWNzwKOqSQzXyeVZu6hD3CLuxnKeJy6USbfBa+gMIjrgQDdgGsl06W3 oK9NzdqVgTtOReWga/y8/tRzM1nZbQHEXXYSS6Iwd9Uf8Jf8tlHoMUP/1ja8vB5o qkF0tuEkEae5Og4sHuODDnB9TpXxRSUiiBQ+8glRQsGc6gTnuktudhcnqszUHSYn h/aDkx2waGuOgVmpLcvyfQVpU52HEw1ZxbMo0+fR/T9qkeJxRs746qYBGDuTwdER ZGNlr90gbjdv4YJuwSCxBhhK30Az4RPPdNGeIta6Y/tlU7X4M5ShLw6/Sf/QnwCI 2290bPza9V6z3en97g02YVRhnNe2ziILSIr8jxGTeqI97DAuvnQCGCdKpTsoIvHt AG1HsP845CWnNBK6b+8emXZb+NolgcmNkveGJtUICu9tT3cL6g/Zbx+B7fGmo/jO L1E2UiuyM/pv3d5JVXjM =bmU6 -----END PGP SIGNATURE----- --Signature=_Mon__8_Jun_2009_16_56_46_+0400_63+6TJOT9B58s=SZ--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090608165646.95bb577e.stas>