From owner-svn-src-all@freebsd.org Tue Aug 23 16:17:33 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E8400BC2A1B; Tue, 23 Aug 2016 16:17:33 +0000 (UTC) (envelope-from alc@rice.edu) Received: from pp2.rice.edu (proofpoint2.mail.rice.edu [128.42.201.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C819412E8; Tue, 23 Aug 2016 16:17:33 +0000 (UTC) (envelope-from alc@rice.edu) Received: from pps.filterd (pp2.rice.edu [127.0.0.1]) by pp2.rice.edu (8.15.0.59/8.15.0.59) with SMTP id u7NGELLM007769; Tue, 23 Aug 2016 11:17:25 -0500 Received: from mh3.mail.rice.edu (mh3.mail.rice.edu [128.42.199.10]) by pp2.rice.edu with ESMTP id 25067p8khs-1; Tue, 23 Aug 2016 11:17:25 -0500 X-Virus-Scanned: by amavis-2.7.0 at mh3.mail.rice.edu, auth channel Received: from 108-254-203-201.lightspeed.hstntx.sbcglobal.net (108-254-203-205.lightspeed.hstntx.sbcglobal.net [108.254.203.205]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (Authenticated sender: alc) by mh3.mail.rice.edu (Postfix) with ESMTPSA id 3ED9A40412; Tue, 23 Aug 2016 11:17:25 -0500 (CDT) Subject: Re: svn commit: r304685 - head/sys/arm64/arm64 To: Andrew Turner , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201608231548.u7NFmRuP041148@repo.freebsd.org> From: Alan Cox Message-ID: <89eccc71-ec8a-545b-c212-387580b10965@rice.edu> Date: Tue, 23 Aug 2016 11:17:24 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <201608231548.u7NFmRuP041148@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=3 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1608230161 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2016 16:17:34 -0000 On 08/23/2016 10:48, Andrew Turner wrote: > Author: andrew > Date: Tue Aug 23 15:48:27 2016 > New Revision: 304685 > URL: https://svnweb.freebsd.org/changeset/base/304685 > > Log: > Include the offset the virtual address is within an L1 or L2 block wh= en > finding the vm_page_t in pmap_extract_and_hold. Previously it would r= eturn > the vm_page_t of the first page in a block. This would cause issues w= hen, > for example, fsck reads from a device into the middle of a superpage.= In > this case the read call would write to the start of the block, and no= t to > the buffer passed in. > =20 > Obtained from: ABT Systems Ltd > MFC after: 1 month > Sponsored by: The FreeBSD Foundation > > Modified: > head/sys/arm64/arm64/pmap.c > > Modified: head/sys/arm64/arm64/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/arm64/arm64/pmap.c Tue Aug 23 15:46:20 2016 (r304684) > +++ head/sys/arm64/arm64/pmap.c Tue Aug 23 15:48:27 2016 (r304685) > @@ -995,6 +995,7 @@ vm_page_t > pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_prot_t prot) > { > pt_entry_t *pte, tpte; > + vm_offset_t off; > vm_paddr_t pa; > vm_page_t m; > int lvl; > @@ -1016,9 +1017,20 @@ retry: > tpte & ATTR_DESCR_MASK)); > if (((tpte & ATTR_AP_RW_BIT) =3D=3D ATTR_AP(ATTR_AP_RW)) || > ((prot & VM_PROT_WRITE) =3D=3D 0)) { > + switch(lvl) { > + case 1: > + off =3D va & L1_OFFSET; > + break; > + case 2: > + off =3D va & L2_OFFSET; > + break; > + case 3: > + default: > + off =3D 0; > + } I would strongly suggest that you also include the page offset in the value passed to vm_page_pa_tryrelock(). Otherwise, if we ever change the mapping from physical addresses to page locks, this code will be acquiring the wrong lock. Other pmap implementations, e.g., amd64, do include the offset. > if (vm_page_pa_tryrelock(pmap, tpte & ~ATTR_MASK, &pa)) > goto retry; > - m =3D PHYS_TO_VM_PAGE(tpte & ~ATTR_MASK); > + m =3D PHYS_TO_VM_PAGE((tpte & ~ATTR_MASK) | off); > vm_page_hold(m); > } > } > >