OASIS Virtual I/O Device (VIRTIO) TC

Expand all | Collapse all

[OASIS Issue Tracker] Created: (VIRTIO-36) balloon: align val in virtio_balloon_stat

  • 1.  [OASIS Issue Tracker] Created: (VIRTIO-36) balloon: align val in virtio_balloon_stat

    Posted 09-23-2013 06:50
    balloon: align val in virtio_balloon_stat ----------------------------------------- Key: VIRTIO-36 URL: http://tools.oasis-open.org/issues/browse/VIRTIO-36 Project: OASIS Virtual I/O Device (VIRTIO) TC Issue Type: Improvement Reporter: Michael Tsirkin we have: struct virtio_balloon_stat { #define VIRTIO_BALLOON_S_SWAP_IN 0 #define VIRTIO_BALLOON_S_SWAP_OUT 1 #define VIRTIO_BALLOON_S_MAJFLT 2 #define VIRTIO_BALLOON_S_MINFLT 3 #define VIRTIO_BALLOON_S_MEMFREE 4 #define VIRTIO_BALLOON_S_MEMTOT 5 u16 tag; u64 val; } __attribute__((packed)); val is 8 bytes but aligned at a 2 byte boundary. this is ugly and unusual, and requires implementations to use packed structures for access, which is error-prone. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://tools.oasis-open.org/issues/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira


  • 2.  Re: [virtio] [OASIS Issue Tracker] Created: (VIRTIO-36) balloon: align val in virtio_balloon_stat

    Posted 09-24-2013 12:04
    OASIS Issues Tracker <workgroup_mailer@lists.oasis-open.org> writes: > balloon: align val in virtio_balloon_stat > ----------------------------------------- > > Key: VIRTIO-36 > URL: http://tools.oasis-open.org/issues/browse/VIRTIO-36 > Project: OASIS Virtual I/O Device (VIRTIO) TC > Issue Type: Improvement > Reporter: Michael Tsirkin > > > we have: > struct virtio_balloon_stat { > #define VIRTIO_BALLOON_S_SWAP_IN 0 > #define VIRTIO_BALLOON_S_SWAP_OUT 1 > #define VIRTIO_BALLOON_S_MAJFLT 2 > #define VIRTIO_BALLOON_S_MINFLT 3 > #define VIRTIO_BALLOON_S_MEMFREE 4 > #define VIRTIO_BALLOON_S_MEMTOT 5 > u16 tag; > u64 val; > } __attribute__((packed)); > > val is 8 bytes but aligned at a 2 byte boundary. > this is ugly and unusual, and requires implementations > to use packed structures for access, which is error-prone. Yeah, I think we fix this by creating a new, clean virtio-balloon device. See VIRTIO-28: Implement new balloon device (ID 13) Cheers, Rusty.