Uploaded image for project: 'OASIS Virtual I/O Device (VIRTIO) TC'
  1. OASIS Virtual I/O Device (VIRTIO) TC
  2. VIRTIO-36

balloon: align val in virtio_balloon_stat

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Deferred
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: virtio 1.0 csprd03
    • Labels:
      None
    • Proposal:
      Hide

      let's add padding so val can be
      naturally aligned to 8 bytes.

      Show
      let's add padding so val can be naturally aligned to 8 bytes.

      Description

      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.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              mstsirkin Michael S. Tsirkin
            • Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: