Bug 857881 - libvirt returns wrong memory size on uclibc
libvirt returns wrong memory size on uclibc
Product: Virtualization Tools
Classification: Community
Component: libvirt (Show other bugs)
Unspecified Linux
unspecified Severity high
: ---
: ---
Assigned To: Libvirt Maintainers
Depends On:
  Show dependency treegraph
Reported: 2012-09-17 07:52 EDT by Carlo Landmeter
Modified: 2014-04-22 03:19 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2014-04-22 03:19:53 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Carlo Landmeter 2012-09-17 07:52:21 EDT
Description of problem:

libvirt reports wrong "memory size"

Version-Release number of selected component (if applicable):

Latest stable (0.10.1)

How reproducible:

Install latest alpinelinux stable (uclibc based distribution) including libvirt

Exec: virsh nodeinfo
Actual results:

Memory size:         65536 KiB

Expected results:

Installed memory size is 4GB

Additional info:

on uclibc sysconf(_SC_PHYS_PAGES) returns -1
while _SC_PAGE_SIZE gives the correct value

found in: gnulib/lib/physmem.c
Comment 1 Ján Tomko 2014-04-22 03:19:53 EDT
This has been fixed in gnulib:
commit 22756d58aa46c291f7fa1c63d61c7c0483622c4e
Author:     Natanael Copa <ncopa@alpinelinux.org>
AuthorDate: 2014-04-18 09:16:27 +0000
Commit:     Pádraig Brady <P@draigBrady.com>
CommitDate: 2014-04-19 12:34:49 +0100

    physmem: use sysinfo if _SC_PHYS_PAGES unavailable
    * lib/physmem.c (physmem_total): Some systems like musl libc do not
    (yet) support _SC_PHYS_PAGES.  Use the linux syscall sysinfo as fallback
    if _SC_PHYS_PAGES or _SC_PAGESIZE fails.
    (physmem_available): Likewise for _SC_AVPHYS_PAGES.
    Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>

git describe: v0.1-119-g22756d5

Libvirt uses it since
commit 45e134d6fcb63e9fa052b3490120d51040f7cec4
Author:     Eric Blake <eblake@redhat.com>
CommitDate: 2014-04-21 14:52:28 -0600

    maint: update to latest gnulib
    Among other patches, Natanael Copa contributed a fix for
    pyshmem_available when using musl libc that directly affects
    * .gnulib: Update to latest, in part for musl libc compat.
    Signed-off-by: Eric Blake <eblake@redhat.com>

git describe: v1.2.3-142-g45e134d

Note You need to log in before you can comment on or make changes to this bug.