[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PULL V3 00/20] Net patches

From: Eric Blake
Subject: Re: [Qemu-devel] [PULL V3 00/20] Net patches
Date: Thu, 26 May 2016 09:20:51 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 05/26/2016 09:08 AM, Peter Maydell wrote:
> 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.

Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]