From owner-freebsd-arm@FreeBSD.ORG Sat Jan 10 06:56:35 2015 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2AEA025C for ; Sat, 10 Jan 2015 06:56:35 +0000 (UTC) Received: from vps.rulingia.com (vps.rulingia.com [103.243.244.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vps.rulingia.com", Issuer "CAcert Class 3 Root" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id B486AC74 for ; Sat, 10 Jan 2015 06:56:34 +0000 (UTC) Received: from server.rulingia.com (c220-239-242-83.belrs5.nsw.optusnet.com.au [220.239.242.83]) by vps.rulingia.com (8.14.9/8.14.9) with ESMTP id t0A64IFO051207 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sat, 10 Jan 2015 17:04:53 +1100 (AEDT) (envelope-from peter@rulingia.com) X-Bogosity: Ham, spamicity=0.000000 Received: from server.rulingia.com (localhost.rulingia.com [127.0.0.1]) by server.rulingia.com (8.14.9/8.14.9) with ESMTP id t0A64DMG026766 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Sat, 10 Jan 2015 17:04:13 +1100 (AEDT) (envelope-from peter@server.rulingia.com) Received: (from peter@localhost) by server.rulingia.com (8.14.9/8.14.9/Submit) id t0A64C4H026765 for freebsd-arm@freebsd.org; Sat, 10 Jan 2015 17:04:12 +1100 (AEDT) (envelope-from peter) Date: Sat, 10 Jan 2015 17:04:12 +1100 From: Peter Jeremy To: freebsd-arm@freebsd.org Subject: read(2) into some addresses doesn't return data on RPi Message-ID: <20150110060412.GE77914@server.rulingia.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="dc+cDN39EJAMEtIO" Content-Disposition: inline X-PGP-Key: http://www.rulingia.com/keys/peter.pgp User-Agent: Mutt/1.5.23 (2014-03-12) X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jan 2015 06:56:35 -0000 --dc+cDN39EJAMEtIO Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Trying to access the boot partition using mtools consistently fails on my RPi because the kernel is returning NULs for the first sector. The second sector is correct. If I use dd(2) then the expected data is returned. This is running 11-current r276818 (but ISTR seeing it on older kernels). I did some digging and found that read(2)s of the SD card device return successful but do not actually write anything to the buffer for some addresses (and they happen to contain all NULs in mtools). This doesn't appear to affect reads of normal files. Running the attached program on /dev/mmcsd0s1 gave me the following results: - There are no partial reads. Either all 512 bytes are updated or none are. - There are two blocks of addresses 0xbfff0e00 thru 0xbfff0e00 and 0xbfff2e= 00 thru 0xbfff2e00 where reads work on a 32-byte alignment but not otherwise. - Reads consistently fail between 0xbfff1e08 and 0xbfff1ff8 - Reads consistently fail between 0xbfff3e08 and 0xbfff3f?? (I got a hang). - The program never completes. In 3 runs, I've gotten: - panic: null_fetch_syscall_args - kernel hang - panic: malloc: bad malloc type magic I don't have a serial console and so can't debug kernel panics. Putting that together, it seems to related to accesses that aren't cache-li= ne aligned and cross page boundaries but I'm not sure why it behaves different= ly at different page boundaries. The hangs/panics suggest that it's writing to random other kernel addresses instead. Does this ring a bell for anyone? --=20 Peter Jeremy --dc+cDN39EJAMEtIO Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQJ8BAEBCgBmBQJUsMDcXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRFRUIyOTg2QzMwNjcxRTc0RTY1QzIyN0Ux NkE1OTdBMEU0QTIwQjM0AAoJEBall6Dkogs05dAP/igwOX4g8cQh0+wjk4CV2n4R qCLSA1ZUEV15Nwf5N7yx0CZWM2uuUmE/p5IzWXTa9JIorQB5Nj5212R0nKT29UDW Tv2u6yWD9Oyvhw4AQPqyXm8rRDq0CrIi+CWnSPIMTZ3weeiwRCkXU8Z3u5u0Gp96 7uJ0zU6wBMWbrO2f1M2iJGDpBMpdFd56LD/dWAHIp96/an9oWVYBEdTYvXNpdBkH FCRQ4gA3jxuKGI2MmrRcGscBj9aj/pSxOwJSo5xE5VRHjQyq0Y6RPUnAadQIYEjB N2nvquJytbiroXYmdfH6L+Y35lw/QtsDZX5TXBevk9yiFG6xoeJ+iQ8VBspnjKat yUzaUF5FdY8FwXXqhOh9Ku4UoamvDqOKRWy/i2Z5ARJwkt+CIQ2GeipsSSJsJf22 L4rxTUUvpT/kDadcM0F9b/n4/hGTacUkDypzw6uZMExBVIuJYa2HmF8sLj1nP467 hh1uN68k4bh2iH7hUb1oQU7eLrk2cFBLunvq8MX2EwZY4FLk42sEMTpTROjwwAJ1 9HkerOVdvbTUHzXFGETJlSgZt9YW1UCRaa/Nb3NIFhBx+SXuzKhWvMgPC/iAOmQn AeAtLWa+wJqKTvDjEKsmFi3Sr00hhVssIEnLJ54aJnEnL5u+3eBCrDYaceewVB76 pVh+mST8Q3aYZyM9uNuV =2LCF -----END PGP SIGNATURE----- --dc+cDN39EJAMEtIO--