Re: [PATCH spice-streaming-agent v5 2/2] Implement handling of error messages from the server

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

 




> On 6 Mar 2018, at 09:37, Christophe Fergeau <cfergeau@xxxxxxxxxx> wrote:
> 
> On Mon, Mar 05, 2018 at 05:58:15PM +0100, Christophe de Dinechin wrote:
>>> Perhaps you lost the mails saying that the protocol structure don't and won't have internal padding.
>> 
>> Only on x86. It has padding on any ABI with a natural 64-bit alignment.
>> 
>> I don’t have an Itanium handy, but computing the offsetof(msg.msg) and
>> offsetof(msg.StreamNotifyError::msg) on a Raspberry Pi using
>> -mstructure-size-boundary=64 yields:
>> 
>> offsetof msg.msg=8
>> offsetof msg.StreamNotifyError::msg=4
> 
> For what it's worth, at the moment stream-device.h expects that its
> struct members are going to be "naturally aligned", ie that struct
> members are aligned to a multiple of their size in byte within the
> struct.
> This seems to be the case with the ABIs/arch we are interested
> in. If there is a real-world ABI which does not match this, then we'll
> indeed need to adapt stream-device.h assumptions.
> The rest of spice-protocol is using __attribute__("packed"). The
> disadvantage with that is that you have to do some manual handling of
> unaligned accesses on some arches (older 32 bits ARM come to mind).

Yes, but only if you did not naturally align your struct to start with. Also, on an arch like ARM. the packed attribute gives the compiler the opportunity to use special mis-aligned load and store instructions. So it’s a good thing, isn’t it?


> 
> Christophe
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/spice-devel

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]