qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2] linux-user: Pass through nanosecond timestam


From: Laurent Vivier
Subject: Re: [Qemu-devel] [PATCH v2] linux-user: Pass through nanosecond timestamp components for stat syscalls
Date: Wed, 22 May 2019 17:42:54 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

On 22/05/2019 17:36, Chen-Yu Tsai wrote:
From: Chen-Yu Tsai <address@hidden>

Since Linux 2.6 the stat syscalls have mostly supported nanosecond
components for each of the file-related timestamps.

QEMU user mode emulation currently does not pass through the nanosecond
portion of the timestamp, even when the host system fills in the value.
This results in a mismatch when run on subsecond resolution filesystems
such as ext4 or XFS.

An example of this leading to inconsistency is cross-debootstraping a
full desktop root filesystem of Debian Buster. Recent versions of
fontconfig store the full timestamp (instead of just the second portion)
of the directory in its per-directory cache file, and checks this against
the directory to see if the cache is up-to-date. With QEMU user mode
emulation, the timestamp stored is incorrect, and upon booting the rootfs
natively, fontconfig discovers the mismatch, and proceeds to rebuild the
cache on the comparatively slow machine (low-power ARM vs x86). This
stalls the first attempt to open whatever application that incorporates
fontconfig.

This patch renames the "unused" padding trailing each timestamp element
to its nanosecond counterpart name if such an element exists in the
kernel sources for the given platform. Not all do. Then have the syscall
wrapper fill in the nanosecond portion if the host supports it, as
specified by the _POSIX_C_SOURCE and _XOPEN_SOURCE feature macros.

Recent versions of glibc only use stat64 and newfstatat syscalls on
32-bit and 64-bit platforms respectively. The changes in this patch
were tested by directly calling the stat, stat64 and newfstatat syscalls
directly, in addition to the glibc wrapper, on arm and aarch64 little
endian targets.

Reviewed-by: Laurent Vivier <address@hidden>
Signed-off-by: Chen-Yu Tsai <address@hidden>

---

Changes since v1:

   - Define TARGET_STAT_HAS_NSEC for targets that have the *_nsec fields
     in their struct stat

   - Only copy the *_nsec fields in the stat (not stat64) code path if
     TARGET_STAT_HAS_NSEC is defined


Please use the same syntax as the kernel does, it helps for code review:

  TARGET_STAT_HAVE_NSEC

Thanks,
Laurent



reply via email to

[Prev in Thread] Current Thread [Next in Thread]