From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58878) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5x5m-0004H7-Rz for qemu-devel@nongnu.org; Thu, 26 May 2016 11:21:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b5x5g-0003de-T8 for qemu-devel@nongnu.org; Thu, 26 May 2016 11:20:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52947) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5x5g-0003dT-ND for qemu-devel@nongnu.org; Thu, 26 May 2016 11:20:52 -0400 References: <1464228995-26657-1-git-send-email-jasowang@redhat.com> From: Eric Blake Message-ID: <57471453.40806@redhat.com> Date: Thu, 26 May 2016 09:20:51 -0600 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="6ngrNggf0TpftmKAsmNgqP0Q70IhFv2BW" Subject: Re: [Qemu-devel] [PULL V3 00/20] Net patches List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , Jason Wang Cc: QEMU Developers This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --6ngrNggf0TpftmKAsmNgqP0Q70IhFv2BW Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 05/26/2016 09:08 AM, Peter Maydell wrote: >=20 > Apologies for the lack of any backtraces in the output, but > this is almost certainly the result of trying to do le64_to_cpu() > or cpu_to_le64() on a buffer which isn't necessarily aligned > (usually some pointer into guest memory). Use the functions > ldq_le_p() and stq_le_p() instead, which will handle a > potentially misaligned pointer for you. (There are similar > functions for other access widths too.) Since these functions are constructed by ## token pasting, it's very hard to grep .h files to see what variations-on-a-theme are actually available, nor is the documentation clear on what they all do (in-place vs. copy, pass a value vs. a pointer, ...). It might be a nice bite-sized task to beef up the documentation and at least call out ALL of the endian-conversion functions in a nice comment (to make it greppable), along with this tidbit of information on which forms are optimized but require alignment, vs. work anywhere but potentially slower= =2E --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --6ngrNggf0TpftmKAsmNgqP0Q70IhFv2BW Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXRxRTAAoJEKeha0olJ0NqGBoH/3fsW9lEmdd4IWirjCmO+Sk6 4+RTm/m2q4umzchs9fdcx7DJ0SzDwr9l347FGEKF1WUEedJetQiTDGHoeeM4Zw6Y j3aPfCIQ4QqGeGIb/W57wD7HJ04tRLiMVlbP7Pg5LmOG4teF/mlQby747sC2LuoU Gs+OJknDyMrGvdgXCBMyronGtR8Vi0iGtUuHDJKkOlM4i4+7Sc1XQlFkGeI5bQyk l/dySBqnx60023bxV4tsa6kiDG2rM1Lw5XE+aGngKq2tyxFVo/U6/JkfP8IUCJw6 J+BYOBQPGLkZCgv3vSj6DppsliEnuqnt8o1E8oXRdgOkQHe7UdXAUXoyJJPLzAQ= =9GcG -----END PGP SIGNATURE----- --6ngrNggf0TpftmKAsmNgqP0Q70IhFv2BW--