On Friday 08 February 2008, Christian Borntraeger wrote:

> Currently the virtio_ring structure are not declared packed, but they 
> describe an hardware like interface. We should not allow compilers to make 
> alignments and optimizations that can be different between the guest and 
> host compiler.
> 
> I propose to declare all structures that are in shared memory as packed.
> 
> Does anybody see a problem with packed?

Packed structures can lead to unoptimized object code when the compiler
cannot assume natural alingment and does all accesses in single bytes.
It may even produce incorrect code if the host interface requires
larger-than-byte accesses.

I'm not aware of any version of gcc that introduces padding when all
struct members are naturally aligned as they are in the structures
you propose to change, so I'd think we're better off not having them
declared as packed.

Also, if someone does find a compelling reason to make them packed
indeed, the way to express that now should be '__packed', not 
'__attribute__((packed))'.

        Arnd <><

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to