Skip to content
  • Thomas Huth's avatar
    01310e2a
    hw/virtio/balloon: Replace TARGET_PAGE_SIZE with BALLOON_PAGE_SIZE · 01310e2a
    Thomas Huth authored
    
    
    The balloon code currently calls madvise() with TARGET_PAGE_SIZE as
    length parameter. Since the virtio-balloon protocol is always based
    on 4k pages, no matter what the host and guest are using as page size,
    this could cause problems: If TARGET_PAGE_SIZE is bigger than 4k, the
    madvise call also destroys the 4k areas after the current one - which
    might be wrong since the guest did not want free that area yet (in
    case the guest used as smaller MMU page size than the hard-coded
    TARGET_PAGE_SIZE). So to fix this issue, introduce a proper define
    called BALLOON_PAGE_SIZE (which is 4096) to use this as the size
    parameter for the madvise() call instead.
    
    Signed-off-by: default avatarThomas Huth <thuth@redhat.com>
    Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
    Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
    01310e2a
    hw/virtio/balloon: Replace TARGET_PAGE_SIZE with BALLOON_PAGE_SIZE
    Thomas Huth authored
    
    
    The balloon code currently calls madvise() with TARGET_PAGE_SIZE as
    length parameter. Since the virtio-balloon protocol is always based
    on 4k pages, no matter what the host and guest are using as page size,
    this could cause problems: If TARGET_PAGE_SIZE is bigger than 4k, the
    madvise call also destroys the 4k areas after the current one - which
    might be wrong since the guest did not want free that area yet (in
    case the guest used as smaller MMU page size than the hard-coded
    TARGET_PAGE_SIZE). So to fix this issue, introduce a proper define
    called BALLOON_PAGE_SIZE (which is 4096) to use this as the size
    parameter for the madvise() call instead.
    
    Signed-off-by: default avatarThomas Huth <thuth@redhat.com>
    Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
    Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Loading