candidate fixes for 5.1-rc1 (testing, semihosting, OOM tcg, x86 fpu)
v2 cover candidate fixes for 5.1-rc1 (testing, semihosting, OOM tcg, x86 fpu)
Hi,
This is the current state of my candidate fixes for 5.1. Apart from the revisions following reviews I was only going to add one more fix (the pgd fallback code not using MAP_FIXED). But as is the usual way of things I found a few bits and pieces on the way.
I haven't been able to replicate the original failure so testing would be appreciated.
The following need review:
- tests/docker: add support for DEB_KEYRING
- tests/docker: fix binfmt_misc image building
- tests/docker: fix update command due to python3 str/bytes distinction
- linux-user: don't use MAP_FIXED in pgd_find_hole_fallback
- accel/tcg: better handle memory constrained systems
- util/oslib-win32: add qemu_get_host_physmem implementation
- util: add qemu_get_host_physmem utility function
Alex Bennée (8):
shippable: add one more qemu to registry url
util: add qemu_get_host_physmem utility function util/oslib-win32: add qemu_get_host_physmem implementation accel/tcg: better handle memory constrained systems
linux-user: don't use MAP_FIXED in pgd_find_hole_fallback tests/docker: fix update command due to python3 str/bytes distinction tests/docker: fix binfmt_misc image building
tests/docker: add support for DEB_KEYRING
KONRAD Frederic (2):
semihosting: defer connect_chardevs a little more to use serialx
semihosting: don't send the trailing '\0'
Laszlo Ersek (1):
target/i386: floatx80: avoid compound literals in static initializers
Laurent Vivier (1):
linux-user: fix clock_nanosleep()
include/fpu/softfloat.h | 1 + include/qemu/osdep.h | 15 + accel/tcg/translate-all.c | 7 +- hw/semihosting/console.c | 4 +- linux-user/elfload.c | 10 +- linux-user/syscall.c | 15 +- softmmu/vl.c | 5 +- target/i386/fpu_helper.c | 426 +++++++++--------- util/oslib-posix.c | 15 + util/oslib-win32.c | 17 + .shippable.yml | 2 +- tests/docker/Makefile.include | 2 +- tests/docker/docker.py | 13 +- tests/docker/dockerfiles/debian-bootstrap.pre | 7 + 14 files changed, 307 insertions(+), 232 deletions(-)
Signature · 1 line
2.20.1
PATCH v2 1/12 shippable: add one more qemu to registry url
The registry url is <project>/<repo>/qemu/<image>
Perhaps we should rationalise that some day but for now.
Message-Id: <[email protected]>
--- .shippable.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
.shippable.yml +1 -1
@@ -27,7 +27,7 @@ env: TARGET_LIST=ppc64-softmmu,ppc64-linux-user,ppc64abi32-linux-user build: pre_ci_boot: - image_name: registry.gitlab.com/qemu-project/qemu/${IMAGE} + image_name: registry.gitlab.com/qemu-project/qemu/qemu/${IMAGE} image_tag: latest pull: true options: "-e HOME=/root"
Signature · 1 line
2.20.1
PATCH v2 2/12 semihosting: defer connect_chardevs a little more to use serialx
In reply to Alex BennéeFrom: KONRAD Frederic <[email protected]>
With that we can just use -semihosting-config chardev=serial0.
[AJB: tweak commit message]
Message-Id: <[email protected]>
Message-Id: <[email protected]>
--- softmmu/vl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
softmmu/vl.c +3 -2
@@ -4131,8 +4131,6 @@ void qemu_init(int argc, char **argv, char **envp)qemu_opts_foreach (qemu_find_opts ("chardev" ), chardev_init_func,NULL , &error_fatal); -/* now chardevs have been created we may have semihosting to connect */ -qemu_semihosting_connect_chardevs ();#ifdef CONFIG_VIRTFS qemu_opts_foreach(qemu_find_opts("fsdev"),
@@ -4281,6 +4279,9 @@ void qemu_init(int argc, char **argv, char **envp)if (foreach_device_config (DEV_DEBUGCON , debugcon_parse) <0 )exit (1 ); +/* now chardevs have been created we may have semihosting to connect */ +qemu_semihosting_connect_chardevs (); +/* If no default VGA is requested, the default is "none". */ if (default_vga) { vga_model =get_default_vga_model (machine_class);
Signature · 1 line
2.20.1
PATCH v2 3/12 semihosting: don't send the trailing '\0'
In reply to Alex BennéeFrom: KONRAD Frederic <[email protected]>
Don't send the trailing 0 from the string.
Message-Id: <[email protected]>
Message-Id: <[email protected]>
--- hw/semihosting/console.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
hw/semihosting/console.c +3 -1
@@ -52,7 +52,9 @@ static GString *copy_user_string(CPUArchState *env, target_ulong addr) do { if (cpu_memory_rw_debug(cpu, addr++, &c, 1, 0) == 0) { - s = g_string_append_c(s, c); + if (c) { + s = g_string_append_c(s, c); + } } else { qemu_log_mask(LOG_GUEST_ERROR, "%s: passed inaccessible address " TARGET_FMT_lx,
Signature · 1 line
2.20.1
PATCH v2 4/12 util: add qemu_get_host_physmem utility function
In reply to Alex BennéeThis will be used in a future patch. For POSIX systems _SC_PHYS_PAGES isn't standardised but at least appears in the man pages for Open/FreeBSD. The result is advisory so any users of it shouldn't just fail if we can't work it out.
The win32 stub currently returns 0 until someone with a Windows system can develop and test a patch.
Message-Id: <[email protected]>
---
v2
- fix agnostic typo
- saturate to SIZE_MAX rather than overflow
--- include/qemu/osdep.h | 12 ++++++++++++ util/oslib-posix.c | 15 +++++++++++++++ util/oslib-win32.c | 6 ++++++ 3 files changed, 33 insertions(+)
include/qemu/osdep.h +12 -0
@@ -665,4 +665,16 @@ static inline void qemu_reset_optind(void)*/ char *qemu_get_host_name (Error **errp); +/** +* qemu_get_host_physmem: +* +* Operating system agnostic way of querying host memory. +* +* Returns amount of physical memory on the system. This is purely +* advisery and may return 0 if we can't work it out. At the other +* end we saturate to SIZE_MAX if you are lucky enough to have that +* much memory. +*/ +size_t qemu_get_host_physmem (void ); +#endif
util/oslib-posix.c +15 -0
@@ -841,3 +841,18 @@ char *qemu_get_host_name(Error **errp)return g_steal_pointer (&hostname); } + +size_t qemu_get_host_physmem (void ) +{ +#ifdef _SC_PHYS_PAGES +long pages =sysconf (_SC_PHYS_PAGES); +if (pages >0 ) { +if (pages >SIZE_MAX / qemu_real_host_page_size) { +return SIZE_MAX ; + }else { +return pages * qemu_real_host_page_size; + } + } +#endif +return 0 ; +}
util/oslib-win32.c +6 -0
@@ -828,3 +828,9 @@ char *qemu_get_host_name(Error **errp)return g_utf16_to_utf8 (tmp, size,NULL ,NULL ,NULL ); } + +size_t qemu_get_host_physmem (void ) +{ +/* currently unimplemented */ +return 0 ; +}
Signature · 1 line
2.20.1
Re: [PATCH v2 04/12] util: add qemu_get_host_physmem utility function
Quoted 5 lines · Alex Bennée
This will be used in a future patch. For POSIX systems
_SC_PHYS_PAGESisn't standardised but at least appears in the man pages for Open/FreeBSD. The result is advisory so any users of it shouldn't just fail if we can't work it out.
Quoted 7 lines
The win32 stub currently returns 0 until someone with a Windows system can develop and test a patch.
Signed-off-by Alex Bennée <[email protected]>Cc BALATON Zoltan <[email protected]>Cc Christian Ehrhardt <[email protected]>Message-Id: <[email protected]>
r~
PATCH v2 5/12 util/oslib-win32: add qemu_get_host_physmem implementation
In reply to Alex BennéeIt seems GetPhysicallyInstalledSystemMemory isn't available in the MinGW headers so we have to declare it ourselves. Compile tested only.
--- util/oslib-win32.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
util/oslib-win32.c +13 -2
@@ -43,6 +43,8 @@/* this must come after including "trace.h" */ #include <shlobj.h> +WINBASEAPI BOOL WINAPI GetPhysicallyInstalledSystemMemory (PULONGLONG); +void *qemu_oom_check (void *ptr) {if (ptr ==NULL ) {
@@ -831,6 +833,15 @@ char *qemu_get_host_name(Error **errp)size_t qemu_get_host_physmem (void ) { -/* currently unimplemented */ -return 0 ; +ULONGLONG mem; + +if (GetPhysicallyInstalledSystemMemory (&mem)) { +if (mem >SIZE_MAX ) { +return SIZE_MAX ; + }else { +return mem; + } + }else { +return 0 ; + } }
Signature · 1 line
2.20.1
Re: [PATCH v2 05/12] util/oslib-win32: add qemu_get_host_physmem implementation
Quoted 5 lines · Alex Bennée
It seems GetPhysicallyInstalledSystemMemory isn't available in the MinGW headers so we have to declare it ourselves. Compile tested only.
Cc Stefan Weil <[email protected]>Signed-off-by Alex Bennée <[email protected]>
Quoted 36 lines
--- util/oslib-win32.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)util/oslib-win32.c +13
-2@@ -43,6 +43,8 @@/* this must come after including "trace.h" */ #include <shlobj.h> +WINBASEAPI BOOL WINAPI GetPhysicallyInstalledSystemMemory (PULONGLONG); +void *qemu_oom_check (void *ptr) {if (ptr ==NULL ) {@@ -831,6 +833,15 @@ char *qemu_get_host_name(Error **errp)size_t qemu_get_host_physmem (void ) { -/* currently unimplemented */ -return 0 ; +ULONGLONG mem; + +if (GetPhysicallyInstalledSystemMemory (&mem)) { +if (mem >SIZE_MAX ) { +return SIZE_MAX ; + }else { +return mem; + } + }else { +return 0 ; + } }
Re: [PATCH v2 05/12] util/oslib-win32: add qemu_get_host_physmem implementation
In reply to Alex BennéeAm 22.07.20 um 08:28 schrieb Alex Bennée:
Quoted 2 lines
It seems GetPhysicallyInstalledSystemMemory isn't available in the MinGW headers so we have to declare it ourselves. Compile tested only.
It is available, at least for Mingw-w64 which I also use for cross builds on Debian, but is only included with _WIN32_WINNT >= 0x0601.
Currently we set _WIN32_WINNT to 0x0600.
Regards,
Stefan
Re: [PATCH v2 05/12] util/oslib-win32: add qemu_get_host_physmem implementation
Quoted 8 lines · Stefan Weil
Am 22.07.20 um 08:28 schrieb Alex Bennée:
Quoted 2 lines
It seems GetPhysicallyInstalledSystemMemory isn't available in the MinGW headers so we have to declare it ourselves. Compile tested only.
It is available, at least for Mingw-w64 which I also use for cross builds on Debian, but is only included with
_WIN32_WINNT>=0x0601.
This would be equiv to requiring Windows 7 or newer
Quoted 1 line
Currently we set
_WIN32_WINNTto0x0600.
This is equiv to Windows 6 / Vista / Server 2008
So if we blindly declare GetPhysicallyInstalledSystemMemory ourselves, then we're likely going to fail at runtime when QEMU is used on Windows prior to Windows 7.
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [PATCH v2 05/12] util/oslib-win32: add qemu_get_host_physmem implementation
In reply to Stefan WeilQuoted 10 lines · Stefan Weil
Am 22.07.20 um 08:28 schrieb Alex Bennée:
Quoted 2 lines
It seems GetPhysicallyInstalledSystemMemory isn't available in the MinGW headers so we have to declare it ourselves. Compile tested only.
It is available, at least for Mingw-w64 which I also use for cross builds on Debian, but is only included with
_WIN32_WINNT>=0x0601.Currently we set
_WIN32_WINNTto0x0600.
That would explain why some people see things working if they build with visual studio (which I presume has a higher setting). We could just wrap the body of the function in:
#if (_WIN32_WINNT >= 0x0601)
much like in commands-win32.c?
Of course it wouldn't even be compile tested (I used the fedora docker image). We should probably clean up the test-mingw code to work with both the fedora and debian-w[32|64] images.
Quoted 4 lines
Regards,
Stefan
Signature · 1 line
Alex Bennée
Re: [PATCH v2 05/12] util/oslib-win32: add qemu_get_host_physmem implementation
Quoted 9 lines · Alex Bennée
Quoted 6 lines · Stefan Weil
Am 22.07.20 um 08:28 schrieb Alex Bennée:
Quoted 2 lines
It seems GetPhysicallyInstalledSystemMemory isn't available in the MinGW headers so we have to declare it ourselves. Compile tested only.
Quoted 8 lines
Quoted 4 lines
It is available, at least for Mingw-w64 which I also use for cross builds on Debian, but is only included with
_WIN32_WINNT>=0x0601.Currently we set
_WIN32_WINNTto0x0600.That would explain why some people see things working if they build with visual studio (which I presume has a higher setting). We could just wrap the body of the function in:
No, that's not how it works. We define _WIN32_WINNT in qemu/osdep.h, and this causes the Windows headers to hide any functions that post-date that version.
This is similar to how you might set _POSIX_C_SOURCE / _XOPEN_SOURCE to control UNIX header visibility.
IOW, the use of visual studio shouldn't affect it.
Quoted 7 lines
#if (_WIN32_WINNT >= 0x0601)much like in
commands-win32.c?Of course it wouldn't even be compile tested (I used the fedora docker image). We should probably clean up the test-mingw code to work with both the fedora and debian-w[32|64] images.
I'd just go for GlobalMemoryStatusEx like Stefan suggests. We use this in libvirt and GNULIB already and it does the job.
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [PATCH v2 05/12] util/oslib-win32: add qemu_get_host_physmem implementation
In reply to Alex BennéeI would suggest use loadLibrary to retrieve the function, if not available, then return 0 (For Win Xp and Vista);
Quoted 45 lines · Alex Bennée
It seems GetPhysicallyInstalledSystemMemory isn't available in the MinGW headers so we have to declare it ourselves. Compile tested only.
Cc Stefan Weil <[email protected]>Signed-off-by Alex Bennée <[email protected]>--- util/oslib-win32.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)util/oslib-win32.c +13
-3@@ -43,6 +43,8 @@/* this must come after including "trace.h" */ #include <shlobj.h> +WINBASEAPI BOOL WINAPI GetPhysicallyInstalledSystemMemory (PULONGLONG); +void *qemu_oom_check (void *ptr) {if (ptr ==NULL ) {@@ -831,6 +833,15 @@ char *qemu_get_host_name(Error **errp)size_t qemu_get_host_physmem (void ) { -/* currently unimplemented */ -return 0 ; +ULONGLONG mem; + +if (GetPhysicallyInstalledSystemMemory (&mem)) { +if (mem >SIZE_MAX ) { +return SIZE_MAX ; + }else { +return mem; + } + }else { +return 0 ; + } } --2.20.1
Signature · 6 lines
此致
礼
罗勇刚
Yours
sincerely,
Yonggang LuoRe: [PATCH v2 05/12] util/oslib-win32: add qemu_get_host_physmem implementation
Am 22.07.20 um 12:32 schrieb 罗勇刚(Yonggang Luo):
Quoted 2 lines
I would suggest use loadLibrary to retrieve the function, if not available, then return 0 (For Win Xp and Vista);
Maybe using GlobalMemoryStatusEx is a better alternative. It is available since XP.
Regards,
Stefan
||
Re: [PATCH v2 05/12] util/oslib-win32: add qemu_get_host_physmem implementation
Quoted 8 lines · Stefan Weil
Am 22.07.20 um 12:32 schrieb 罗勇刚(Yonggang Luo):
Quoted 2 lines
I would suggest use loadLibrary to retrieve the function, if not available, then return 0 (For Win Xp and Vista);
Maybe using GlobalMemoryStatusEx is a better alternative. It is available since XP.
I would welcome an alternative patch. I have no way to test if it works anyway.
Signature · 1 line
Alex Bennée
Re: [PATCH v2 05/12] util/oslib-win32: add qemu_get_host_physmem implementation
Quoted 9 lines · Alex Bennée
Quoted 6 lines · Stefan Weil
Am 22.07.20 um 12:32 schrieb 罗勇刚(Yonggang Luo):
Quoted 2 lines
I would suggest use loadLibrary to retrieve the function, if not available, then return 0 (For Win Xp and Vista);
Quoted 5 lines
Quoted 2 lines
Maybe using GlobalMemoryStatusEx is a better alternative. It is available since XP.
I would welcome an alternative patch. I have no way to test if it works anyway.
Something like this should work:
LPMEMORYSTATUSEX info = {
.dwLength = sizeof(LPMEMORYSTATUSEX),
};
if (!GlobalMemoryStatusEx(&info)) {
...error report...
}
return info.ullTotalPhys;(or ullAvailPhys for current free memory)
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
PATCH v2 6/12 accel/tcg: better handle memory constrained systems
In reply to Alex BennéeIt turns out there are some 64 bit systems that have relatively low amounts of physical memory available to them (typically CI system). Even with swapping available a 1GB translation buffer that fills up can put the machine under increased memory pressure. Detect these low memory situations and reduce tb_size appropriately.
Message-Id: <[email protected]>
---
v2
- /4 to /8 as suggested by Christian
--- accel/tcg/translate-all.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
accel/tcg/translate-all.c +6 -1
@@ -976,7 +976,12 @@ static inline size_t size_code_gen_buffer(size_t tb_size) {/* Size the buffer. */ if (tb_size ==0 ) { - tb_size =DEFAULT_CODE_GEN_BUFFER_SIZE ; +size_t phys_mem =qemu_get_host_physmem (); +if (phys_mem >0 && phys_mem < (2 *DEFAULT_CODE_GEN_BUFFER_SIZE )) { + tb_size = phys_mem /8 ; + }else { + tb_size =DEFAULT_CODE_GEN_BUFFER_SIZE ; + } }if (tb_size <MIN_CODE_GEN_BUFFER_SIZE ) { tb_size =MIN_CODE_GEN_BUFFER_SIZE ;
Signature · 1 line
2.20.1
Re: [PATCH v2 06/12] accel/tcg: better handle memory constrained systems
accel/tcg/translate-all.c static inline size_t size_code_gen_buffer(size_t tb_size) · line 984
Quoted 6 lines · Alex Bennée
accel/tcg/translate-all.c +6
-0+size_t phys_mem =qemu_get_host_physmem (); +if (phys_mem >0 && phys_mem < (2 *DEFAULT_CODE_GEN_BUFFER_SIZE )) { + tb_size = phys_mem /8 ; + }else { + tb_size =DEFAULT_CODE_GEN_BUFFER_SIZE ; + }
I don't understand the 2 * DEFAULT part.
Does this make more sense as
if (phys_mem == 0) {
tb_size = default;
} else {
tb_size = MIN(default, phys_mem / 8);
}?
r~
Re: [PATCH v2 06/12] accel/tcg: better handle memory constrained systems
Quoted 9 lines · Richard Henderson
accel/tcg/translate-all.c static inline size_t size_code_gen_buffer(size_t tb_size) · line 984
Quoted 6 lines · Alex Bennée
accel/tcg/translate-all.c +6
-0+size_t phys_mem =qemu_get_host_physmem (); +if (phys_mem >0 && phys_mem < (2 *DEFAULT_CODE_GEN_BUFFER_SIZE )) { + tb_size = phys_mem /8 ; + }else { + tb_size =DEFAULT_CODE_GEN_BUFFER_SIZE ; + }I don't understand the 2 * DEFAULT part.
I figured once you had at least twice as much memory you could use the full amount but...
Quoted 7 lines
Does this make more sense as
if (phys_mem == 0) { tb_size = default; } else { tb_size = MIN(default, phys_mem / 8); }
This is probably a less aggressive tapering off which still doesn't affect my 32gb dev machine ;-)
Signature · 1 line
Alex Bennée
Re: [PATCH v2 06/12] accel/tcg: better handle memory constrained systems
Quoted 19 lines · Alex Bennée
Quoted 9 lines · Richard Henderson
accel/tcg/translate-all.c static inline size_t size_code_gen_buffer(size_t tb_size) · line 984
Quoted 6 lines · Alex Bennée
accel/tcg/translate-all.c +6
-0+size_t phys_mem =qemu_get_host_physmem (); +if (phys_mem >0 && phys_mem < (2 *DEFAULT_CODE_GEN_BUFFER_SIZE )) { + tb_size = phys_mem /8 ; + }else { + tb_size =DEFAULT_CODE_GEN_BUFFER_SIZE ; + }I don't understand the 2 * DEFAULT part.
I figured once you had at least twice as much memory you could use the full amount but...
Quoted 2 lines
Does this make more sense as
Quoted 8 lines
Quoted 5 lines
if (phys_mem == 0) { tb_size = default; } else { tb_size = MIN(default, phys_mem / 8); }This is probably a less aggressive tapering off which still doesn't affect my 32gb dev machine ;-)
I still feel like this logic of looking at physmem is doomed, because it makes the assumption that all of physical RAM is theoretically available to the user, and this isn't the case if running inside a container or cgroup with a memory cap set.
I don't really have any good answer here, but assuming we can use 1 GB for a cache just doesn't seem like a good idea, especially if users are running multiple VMs in parallel.
OpenStack uses TCG in alot of their CI infrastructure for example and runs multiple VMs. If there's 4 VMs, that's another 4 GB of RAM usage just silently added on top of the explicit -m value.
I wouldn't be surprised if this pushes CI into OOM, even without containers or cgroups being involved, as they have plenty of other services consuming RAM in the CI VMs.
The commit 600e17b261555c56a048781b8dd5ba3985650013 talks about this minimizing codegen cache flushes, but doesn't mention the real world performance impact of eliminating those flushes ?
Presumably this makes the guest OS boot faster, but what's the before and after time ? And what's the time like for values in between the original 32mb and the new 1 GB ? Can we get some value that is *significantly* smaller than 1 GB but still gives some useful benefit ? what would 128 MB be like compared to the original 32mb ?
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [PATCH v2 06/12] accel/tcg: better handle memory constrained systems
Quoted 7 lines · Daniel P. Berrangé
OpenStack uses TCG in alot of their CI infrastructure for example and runs multiple VMs. If there's 4 VMs, that's another 4 GB of RAM usage just silently added on top of the explicit -m value.
I wouldn't be surprised if this pushes CI into OOM, even without containers or cgroups being involved, as they have plenty of other services consuming RAM in the CI VMs.
I would hope that CI would also supply a -tb_size to go along with that -m value. Because we really can't guess on their behalf.
Quoted 3 lines
The commit
600e17b261555c56a048781b8dd5ba3985650013talks about this minimizing codegen cache flushes, but doesn't mention the real world performance impact of eliminating those flushes ?
Somewhere on the mailing list was this info. It was so dreadfully slow it was *really* noticable. Timeouts everywhere.
Quoted 4 lines
Presumably this makes the guest OS boot faster, but what's the before and after time ? And what's the time like for values in between the original 32mb and the new 1 GB ?
But it wasn't "the original 32MB".
It was the original "ram_size / 4", until that broke due to argument parsing ordering.
I don't know what CI usually uses, but I usually use at least -m 4G, sometimes more. What's the libvirt default?
r~
Re: [PATCH v2 06/12] accel/tcg: better handle memory constrained systems
Quoted 11 lines · Richard Henderson
Quoted 7 lines · Daniel P. Berrangé
OpenStack uses TCG in alot of their CI infrastructure for example and runs multiple VMs. If there's 4 VMs, that's another 4 GB of RAM usage just silently added on top of the explicit -m value.
I wouldn't be surprised if this pushes CI into OOM, even without containers or cgroups being involved, as they have plenty of other services consuming RAM in the CI VMs.
I would hope that CI would also supply a -tb_size to go along with that -m value. Because we really can't guess on their behalf.
I've never even seen mention of -tb_size argument before myself, nor seen anyone else using it and libvirt doesn't set it, so I think this is not a valid assumption.
Quoted 7 lines
Quoted 3 lines
The commit
600e17b261555c56a048781b8dd5ba3985650013talks about this minimizing codegen cache flushes, but doesn't mention the real world performance impact of eliminating those flushes ?Somewhere on the mailing list was this info. It was so dreadfully slow it was *really* noticable. Timeouts everywhere.
Quoted 7 lines
Quoted 3 lines
Presumably this makes the guest OS boot faster, but what's the before and after time ? And what's the time like for values in between the original 32mb and the new 1 GB ?
But it wasn't "the original 32MB".
It was the original "ram_size/ 4", until that broke due to argument parsing ordering.
Hmm, 600e17b261555c56a048781b8dd5ba3985650013 says it was 32 MB as the default in its commit message, which seems to match the code doing
#define DEFAULT_CODE_GEN_BUFFER_SIZE_1 (32 * MiB)
Quoted 2 lines
I don't know what CI usually uses, but I usually use at least -m 4G, sometimes more. What's the libvirt default?
There's no default memory size - its up to whomever/whatever creates the VMs to choose how much RAM is given.
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [PATCH v2 06/12] accel/tcg: better handle memory constrained systems
Quoted 29 lines · Daniel P. Berrangé
Quoted 11 lines · Richard Henderson
Quoted 7 lines · Daniel P. Berrangé
OpenStack uses TCG in alot of their CI infrastructure for example and runs multiple VMs. If there's 4 VMs, that's another 4 GB of RAM usage just silently added on top of the explicit -m value.
I wouldn't be surprised if this pushes CI into OOM, even without containers or cgroups being involved, as they have plenty of other services consuming RAM in the CI VMs.
I would hope that CI would also supply a -tb_size to go along with that -m value. Because we really can't guess on their behalf.
I've never even seen mention of -tb_size argument before myself, nor seen anyone else using it and libvirt doesn't set it, so I think this is not a valid assumption.
Quoted 11 lines
Quoted 3 lines
The commit
600e17b261555c56a048781b8dd5ba3985650013talks about this minimizing codegen cache flushes, but doesn't mention the real world performance impact of eliminating those flushes ?Somewhere on the mailing list was this info. It was so dreadfully slow it was *really* noticable. Timeouts everywhere.
Quoted 3 lines
Presumably this makes the guest OS boot faster, but what's the before and after time ? And what's the time like for values in between the original 32mb and the new 1 GB ?
Quoted 8 lines
Quoted 3 lines
But it wasn't "the original 32MB".
It was the original "ram_size/ 4", until that broke due to argument parsing ordering.Hmm,
600e17b261555c56a048781b8dd5ba3985650013says it was 32 MB as the default in its commit message, which seems to match the code doing#define
DEFAULT_CODE_GEN_BUFFER_SIZE_1(32 * MiB)
You need to look earlier in the sequence (see the tag pull-tcg-20200228):
47a2def4533a2807e48954abd50b32ecb1aaf29a
so when the argument ordering broke the guest ram_size heuristic we started getting reports of performance regressions because we fell back to that size. Before then it was always based on guest ram size within the min/max bounds set by those defines.
Quoted 8 lines
Quoted 2 lines
I don't know what CI usually uses, but I usually use at least -m 4G, sometimes more. What's the libvirt default?
There's no default memory size - its up to whomever/whatever creates the VMs to choose how much RAM is given.
Regards,
Daniel
Signature · 1 line
Alex Bennée
Re: [PATCH v2 06/12] accel/tcg: better handle memory constrained systems
Quoted 41 lines · Alex Bennée
Quoted 29 lines · Daniel P. Berrangé
Quoted 11 lines · Richard Henderson
Quoted 7 lines · Daniel P. Berrangé
OpenStack uses TCG in alot of their CI infrastructure for example and runs multiple VMs. If there's 4 VMs, that's another 4 GB of RAM usage just silently added on top of the explicit -m value.
I wouldn't be surprised if this pushes CI into OOM, even without containers or cgroups being involved, as they have plenty of other services consuming RAM in the CI VMs.
I would hope that CI would also supply a -tb_size to go along with that -m value. Because we really can't guess on their behalf.
I've never even seen mention of -tb_size argument before myself, nor seen anyone else using it and libvirt doesn't set it, so I think this is not a valid assumption.
Quoted 11 lines
Quoted 3 lines
The commit
600e17b261555c56a048781b8dd5ba3985650013talks about this minimizing codegen cache flushes, but doesn't mention the real world performance impact of eliminating those flushes ?Somewhere on the mailing list was this info. It was so dreadfully slow it was *really* noticable. Timeouts everywhere.
Quoted 3 lines
Presumably this makes the guest OS boot faster, but what's the before and after time ? And what's the time like for values in between the original 32mb and the new 1 GB ?
Quoted 8 lines
Quoted 3 lines
But it wasn't "the original 32MB".
It was the original "ram_size/ 4", until that broke due to argument parsing ordering.Hmm,
600e17b261555c56a048781b8dd5ba3985650013says it was 32 MB as the default in its commit message, which seems to match the code doing#define
DEFAULT_CODE_GEN_BUFFER_SIZE_1(32 * MiB)
Quoted 8 lines
You need to look earlier in the sequence (see the tag pull-tcg-20200228):
47a2def4533a2807e48954abd50b32ecb1aaf29aso when the argument ordering broke the guest
ram_sizeheuristic we started getting reports of performance regressions because we fell back to that size. Before then it was always based on guest ram size within the min/max bounds set by those defines.
Ah I see. That's a shame, as something based on guest RAM size feels like a much safer bet for a default heuristic than basing it on host RAM size.
I'd probably say that the original commit which changed the argument processing is flawed, and could/should be fixed.
The problem that commit was trying to solve was to do validation of the value passed to -m. In fixing that it also moving the parsing. The key problem here is that we need to do parsing and validating at different points in the startup procedure. IOW, we need to split the logic, not simply moving the CLI parsing to the place that makes validation work.
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [PATCH v2 06/12] accel/tcg: better handle memory constrained systems
Quoted 46 lines · Daniel P. Berrangé
Quoted 45 lines · Alex Bennée
Quoted 29 lines · Daniel P. Berrangé
Quoted 11 lines · Richard Henderson
Quoted 7 lines · Daniel P. Berrangé
OpenStack uses TCG in alot of their CI infrastructure for example and runs multiple VMs. If there's 4 VMs, that's another 4 GB of RAM usage just silently added on top of the explicit -m value.
I wouldn't be surprised if this pushes CI into OOM, even without containers or cgroups being involved, as they have plenty of other services consuming RAM in the CI VMs.
I would hope that CI would also supply a -tb_size to go along with that -m value. Because we really can't guess on their behalf.
I've never even seen mention of -tb_size argument before myself, nor seen anyone else using it and libvirt doesn't set it, so I think this is not a valid assumption.
Quoted 11 lines
Quoted 3 lines
The commit
600e17b261555c56a048781b8dd5ba3985650013talks about this minimizing codegen cache flushes, but doesn't mention the real world performance impact of eliminating those flushes ?Somewhere on the mailing list was this info. It was so dreadfully slow it was *really* noticable. Timeouts everywhere.
Quoted 3 lines
Presumably this makes the guest OS boot faster, but what's the before and after time ? And what's the time like for values in between the original 32mb and the new 1 GB ?
Quoted 8 lines
Quoted 3 lines
But it wasn't "the original 32MB".
It was the original "ram_size/ 4", until that broke due to argument parsing ordering.Hmm,
600e17b261555c56a048781b8dd5ba3985650013says it was 32 MB as the default in its commit message, which seems to match the code doing#define
DEFAULT_CODE_GEN_BUFFER_SIZE_1(32 * MiB)You need to look earlier in the sequence (see the tag pull-tcg-20200228):
47a2def4533a2807e48954abd50b32ecb1aaf29a
Quoted 8 lines
Quoted 4 lines
so when the argument ordering broke the guest
ram_sizeheuristic we started getting reports of performance regressions because we fell back to that size. Before then it was always based on guest ram size within the min/max bounds set by those defines.Ah I see. That's a shame, as something based on guest RAM size feels like a much safer bet for a default heuristic than basing it on host RAM size.
It was a poor heuristic because the amount of code generation space you need really depends on the amount of code being executed and that is more determined by workload than RAM size. You may have 4gb of RAM running a single program with a large block cache or 128Mb of RAM but constantly swapping code from a block store which triggers a re-translation every time.
Also as the translation cache is mmap'ed it doesn't all have to get used. Having spare cache isn't too wasteful.
Quoted 2 lines
I'd probably say that the original commit which changed the argument processing is flawed, and could/should be fixed.
I'd say not - we are not trying to replace/fix the original heuristic but introduce a new one to finesse behaviour in relatively resource constrained machines. Nothing we do can cope with all the potential range of invocations of QEMU people might do. For that the user will have to look at workload and tweak the tb-size control. The default was chosen to make the "common" case of running a single guest on a users desktop work at a reasonable performance level. You'll see we make that distinction in the comments between system emulation and for example linux-user where it's much more reasonable to expect multiple QEMU invocations.
Quoted 8 lines
The problem that commit was trying to solve was to do validation of the value passed to -m. In fixing that it also moving the parsing. The key problem here is that we need to do parsing and validating at different points in the startup procedure. IOW, we need to split the logic, not simply moving the CLI parsing to the place that makes validation work.
Regards,
Daniel
Signature · 1 line
Alex Bennée
PATCH v2 7/12 target/i386: floatx80: avoid compound literals in static initializers
In reply to Alex BennéeFrom: Laszlo Ersek <[email protected]>
Quoting ISO C99 6.7.8p4, "All the expressions in an initializer for an object that has static storage duration shall be constant expressions or string literals".
The compound literal produced by the make_floatx80() macro is not such a constant expression, per 6.6p7-9. (An implementation may accept it, according to 6.6p10, but is not required to.)
Therefore using "floatx80_zero" and make_floatx80() for initializing "f2xm1_table" and "fpatan_table" is not portable. And gcc-4.8 in RHEL-7.6 actually chokes on them:
Quoted 3 lines
target/i386/fpu_helper.c:871:5: error: initializer element is not constant{ make_floatx80(0xbfff, 0x8000000000000000ULL), ^
We've had the make_floatx80_init() macro for this purpose since commit 3bf7e40ab914 ("softfloat: fix for C99", 2012-03-17), so let's use that macro again.
Message-Id: <[email protected]>
--- include/fpu/softfloat.h | 1 + target/i386/fpu_helper.c | 426 +++++++++++++++++++-------------------- 2 files changed, 214 insertions(+), 213 deletions(-)
include/fpu/softfloat.h +1 -0
@@ -822,6 +822,7 @@ static inline bool floatx80_invalid_encoding(floatx80 a) }#define floatx80_zero make_floatx80(0x0000, 0x0000000000000000LL) +#define floatx80_zero_init make_floatx80_init(0x0000, 0x0000000000000000LL)#define floatx80_one make_floatx80(0x3fff, 0x8000000000000000LL)#define floatx80_ln2 make_floatx80(0x3ffe, 0xb17217f7d1cf79acLL)#define floatx80_pi make_floatx80(0x4000, 0xc90fdaa22168c235LL)
target/i386/fpu_helper.c +213 -213
438 lines not on this page · raw message
Signature · 1 line
2.20.1
Re: [PATCH v2 07/12] target/i386: floatx80: avoid compound literals in static initializers
Quoted 22 lines · Alex Bennée
From: Laszlo Ersek <[email protected]>
Quoting ISO C99 6.7.8p4, "All the expressions in an initializer for an object that has static storage duration shall be constant expressions or string literals".
The compound literal produced by the
make_floatx80()macro is not such a constant expression, per 6.6p7-9. (An implementation may accept it, according to 6.6p10, but is not required to.)Therefore using "
floatx80_zero" andmake_floatx80()for initializing "f2xm1_table" and "fpatan_table" is not portable. And gcc-4.8 in RHEL-7.6 actually chokes on them:Quoted 3 lines
target/i386/fpu_helper.c:871:5: error: initializer element is not constant{ make_floatx80(0xbfff, 0x8000000000000000ULL), ^We've had the
make_floatx80_init()macro for this purpose since commit3bf7e40ab914("softfloat: fix for C99", 2012-03-17), so let's use that macro again.
Quoted 12 lines
Fixes eca30647fc07Fixes ff57bb7b6326Cc Aurelien Jarno <[email protected]>Cc Eduardo Habkost <[email protected]>Cc Joseph Myers <[email protected]>Cc Paolo Bonzini <[email protected]>Cc Peter Maydell <[email protected]>Cc Richard Henderson <[email protected]>Reviewed-by Alex Bennée <[email protected]>Signed-off-by Laszlo Ersek <[email protected]>
No change since the v1 I reviewed [*], so my R-b stands:
[*] https://www.mail-archive.com/[email protected]/msg723599.html
Maybe worth mentioning the similar commit 6fa9ba09db for target/m68k?
Quoted 464 lines
Signed-off-by Alex Bennée <[email protected]>Message-Id: <[email protected]>
--- include/fpu/softfloat.h | 1 + target/i386/fpu_helper.c | 426 +++++++++++++++++++-------------------- 2 files changed, 214 insertions(+), 213 deletions(-)include/fpu/softfloat.h +1
-0@@ -822,6 +822,7 @@ static inline bool floatx80_invalid_encoding(floatx80 a) }#define floatx80_zero make_floatx80(0x0000, 0x0000000000000000LL) +#define floatx80_zero_init make_floatx80_init(0x0000, 0x0000000000000000LL)#define floatx80_one make_floatx80(0x3fff, 0x8000000000000000LL)#define floatx80_ln2 make_floatx80(0x3ffe, 0xb17217f7d1cf79acLL)#define floatx80_pi make_floatx80(0x4000, 0xc90fdaa22168c235LL)target/i386/fpu_helper.c +213
-213@@ -868,201 +868,201 @@ struct f2xm1_data { };static const struct f2xm1_data f2xm1_table[65 ] = { - {make_floatx80 (0xbfff ,0x8000000000000000ULL ), -make_floatx80 (0x3ffe ,0x8000000000000000ULL ), -make_floatx80 (0xbffe ,0x8000000000000000ULL ) }, - {make_floatx80 (0xbffe ,0xf800000000002e7eULL ), -make_floatx80 (0x3ffe ,0x82cd8698ac2b9160ULL ), -make_floatx80 (0xbffd ,0xfa64f2cea7a8dd40ULL ) }, - {make_floatx80 (0xbffe ,0xefffffffffffe960ULL ), -make_floatx80 (0x3ffe ,0x85aac367cc488345ULL ), -make_floatx80 (0xbffd ,0xf4aa7930676ef976ULL ) }, - {make_floatx80 (0xbffe ,0xe800000000006f10ULL ), -make_floatx80 (0x3ffe ,0x88980e8092da5c14ULL ), -make_floatx80 (0xbffd ,0xeecfe2feda4b47d8ULL ) }, - {make_floatx80 (0xbffe ,0xe000000000008a45ULL ), -make_floatx80 (0x3ffe ,0x8b95c1e3ea8ba2a5ULL ), -make_floatx80 (0xbffd ,0xe8d47c382ae8bab6ULL ) }, - {make_floatx80 (0xbffe ,0xd7ffffffffff8a9eULL ), -make_floatx80 (0x3ffe ,0x8ea4398b45cd8116ULL ), -make_floatx80 (0xbffd ,0xe2b78ce97464fdd4ULL ) }, - {make_floatx80 (0xbffe ,0xd0000000000019a0ULL ), -make_floatx80 (0x3ffe ,0x91c3d373ab11b919ULL ), -make_floatx80 (0xbffd ,0xdc785918a9dc8dceULL ) }, - {make_floatx80 (0xbffe ,0xc7ffffffffff14dfULL ), -make_floatx80 (0x3ffe ,0x94f4efa8fef76836ULL ), -make_floatx80 (0xbffd ,0xd61620ae02112f94ULL ) }, - {make_floatx80 (0xbffe ,0xc000000000006530ULL ), -make_floatx80 (0x3ffe ,0x9837f0518db87fbbULL ), -make_floatx80 (0xbffd ,0xcf901f5ce48f008aULL ) }, - {make_floatx80 (0xbffe ,0xb7ffffffffff1723ULL ), -make_floatx80 (0x3ffe ,0x9b8d39b9d54eb74cULL ), -make_floatx80 (0xbffd ,0xc8e58c8c55629168ULL ) }, - {make_floatx80 (0xbffe ,0xb00000000000b5e1ULL ), -make_floatx80 (0x3ffe ,0x9ef5326091a0c366ULL ), -make_floatx80 (0xbffd ,0xc2159b3edcbe7934ULL ) }, - {make_floatx80 (0xbffe ,0xa800000000006f8aULL ), -make_floatx80 (0x3ffe ,0xa27043030c49370aULL ), -make_floatx80 (0xbffd ,0xbb1f79f9e76d91ecULL ) }, - {make_floatx80 (0xbffe ,0x9fffffffffff816aULL ), -make_floatx80 (0x3ffe ,0xa5fed6a9b15171cfULL ), -make_floatx80 (0xbffd ,0xb40252ac9d5d1c62ULL ) }, - {make_floatx80 (0xbffe ,0x97ffffffffffb621ULL ), -make_floatx80 (0x3ffe ,0xa9a15ab4ea7c30e6ULL ), -make_floatx80 (0xbffd ,0xacbd4a962b079e34ULL ) }, - {make_floatx80 (0xbffe ,0x8fffffffffff162bULL ), -make_floatx80 (0x3ffe ,0xad583eea42a1b886ULL ), -make_floatx80 (0xbffd ,0xa54f822b7abc8ef4ULL ) }, - {make_floatx80 (0xbffe ,0x87ffffffffff4d34ULL ), -make_floatx80 (0x3ffe ,0xb123f581d2ac7b51ULL ), -make_floatx80 (0xbffd ,0x9db814fc5aa7095eULL ) }, - {make_floatx80 (0xbffe ,0x800000000000227dULL ), -make_floatx80 (0x3ffe ,0xb504f333f9de539dULL ), -make_floatx80 (0xbffd ,0x95f619980c4358c6ULL ) }, - {make_floatx80 (0xbffd ,0xefffffffffff3978ULL ), -make_floatx80 (0x3ffe ,0xb8fbaf4762fbd0a1ULL ), -make_floatx80 (0xbffd ,0x8e08a1713a085ebeULL ) }, - {make_floatx80 (0xbffd ,0xe00000000000df81ULL ), -make_floatx80 (0x3ffe ,0xbd08a39f580bfd8cULL ), -make_floatx80 (0xbffd ,0x85eeb8c14fe804e8ULL ) }, - {make_floatx80 (0xbffd ,0xd00000000000bccfULL ), -make_floatx80 (0x3ffe ,0xc12c4cca667062f6ULL ), -make_floatx80 (0xbffc ,0xfb4eccd6663e7428ULL ) }, - {make_floatx80 (0xbffd ,0xc00000000000eff0ULL ), -make_floatx80 (0x3ffe ,0xc5672a1155069abeULL ), -make_floatx80 (0xbffc ,0xea6357baabe59508ULL ) }, - {make_floatx80 (0xbffd ,0xb000000000000fe6ULL ), -make_floatx80 (0x3ffe ,0xc9b9bd866e2f234bULL ), -make_floatx80 (0xbffc ,0xd91909e6474372d4ULL ) }, - {make_floatx80 (0xbffd ,0x9fffffffffff2172ULL ), -make_floatx80 (0x3ffe ,0xce248c151f84bf00ULL ), -make_floatx80 (0xbffc ,0xc76dcfab81ed0400ULL ) }, - {make_floatx80 (0xbffd ,0x8fffffffffffafffULL ), -make_floatx80 (0x3ffe ,0xd2a81d91f12afb2bULL ), -make_floatx80 (0xbffc ,0xb55f89b83b541354ULL ) }, - {make_floatx80 (0xbffc ,0xffffffffffff81a3ULL ), -make_floatx80 (0x3ffe ,0xd744fccad69d7d5eULL ), -make_floatx80 (0xbffc ,0xa2ec0cd4a58a0a88ULL ) }, - {make_floatx80 (0xbffc ,0xdfffffffffff1568ULL ), -make_floatx80 (0x3ffe ,0xdbfbb797daf25a44ULL ), -make_floatx80 (0xbffc ,0x901121a0943696f0ULL ) }, - {make_floatx80 (0xbffc ,0xbfffffffffff68daULL ), -make_floatx80 (0x3ffe ,0xe0ccdeec2a94f811ULL ), -make_floatx80 (0xbffb ,0xf999089eab583f78ULL ) }, - {make_floatx80 (0xbffc ,0x9fffffffffff4690ULL ), -make_floatx80 (0x3ffe ,0xe5b906e77c83657eULL ), -make_floatx80 (0xbffb ,0xd237c8c41be4d410ULL ) }, - {make_floatx80 (0xbffb ,0xffffffffffff8aeeULL ), -make_floatx80 (0x3ffe ,0xeac0c6e7dd24427cULL ), -make_floatx80 (0xbffb ,0xa9f9c8c116ddec20ULL ) }, - {make_floatx80 (0xbffb ,0xbfffffffffff2d18ULL ), -make_floatx80 (0x3ffe ,0xefe4b99bdcdb06ebULL ), -make_floatx80 (0xbffb ,0x80da33211927c8a8ULL ) }, - {make_floatx80 (0xbffa ,0xffffffffffff8ccbULL ), -make_floatx80 (0x3ffe ,0xf5257d152486d0f4ULL ), -make_floatx80 (0xbffa ,0xada82eadb792f0c0ULL ) }, - {make_floatx80 (0xbff9 ,0xffffffffffff11feULL ), -make_floatx80 (0x3ffe ,0xfa83b2db722a0846ULL ), -make_floatx80 (0xbff9 ,0xaf89a491babef740ULL ) }, - { floatx80_zero, -make_floatx80 (0x3fff ,0x8000000000000000ULL ), - floatx80_zero }, - {make_floatx80 (0x3ff9 ,0xffffffffffff2680ULL ), -make_floatx80 (0x3fff ,0x82cd8698ac2b9f6fULL ), -make_floatx80 (0x3ff9 ,0xb361a62b0ae7dbc0ULL ) }, - {make_floatx80 (0x3ffb ,0x800000000000b500ULL ), -make_floatx80 (0x3fff ,0x85aac367cc488345ULL ), -make_floatx80 (0x3ffa ,0xb5586cf9891068a0ULL ) }, - {make_floatx80 (0x3ffb ,0xbfffffffffff4b67ULL ), -make_floatx80 (0x3fff ,0x88980e8092da7cceULL ), -make_floatx80 (0x3ffb ,0x8980e8092da7cce0ULL ) }, - {make_floatx80 (0x3ffb ,0xffffffffffffff57ULL ), -make_floatx80 (0x3fff ,0x8b95c1e3ea8bd6dfULL ), -make_floatx80 (0x3ffb ,0xb95c1e3ea8bd6df0ULL ) }, - {make_floatx80 (0x3ffc ,0x9fffffffffff811fULL ), -make_floatx80 (0x3fff ,0x8ea4398b45cd4780ULL ), -make_floatx80 (0x3ffb ,0xea4398b45cd47800ULL ) }, - {make_floatx80 (0x3ffc ,0xbfffffffffff9980ULL ), -make_floatx80 (0x3fff ,0x91c3d373ab11b919ULL ), -make_floatx80 (0x3ffc ,0x8e1e9b9d588dc8c8ULL ) }, - {make_floatx80 (0x3ffc ,0xdffffffffffff631ULL ), -make_floatx80 (0x3fff ,0x94f4efa8fef70864ULL ), -make_floatx80 (0x3ffc ,0xa7a77d47f7b84320ULL ) }, - {make_floatx80 (0x3ffc ,0xffffffffffff2499ULL ), -make_floatx80 (0x3fff ,0x9837f0518db892d4ULL ), -make_floatx80 (0x3ffc ,0xc1bf828c6dc496a0ULL ) }, - {make_floatx80 (0x3ffd ,0x8fffffffffff80fbULL ), -make_floatx80 (0x3fff ,0x9b8d39b9d54e3a79ULL ), -make_floatx80 (0x3ffc ,0xdc69cdceaa71d3c8ULL ) }, - {make_floatx80 (0x3ffd ,0x9fffffffffffbc23ULL ), -make_floatx80 (0x3fff ,0x9ef5326091a10313ULL ), -make_floatx80 (0x3ffc ,0xf7a993048d081898ULL ) }, - {make_floatx80 (0x3ffd ,0xafffffffffff20ecULL ), -make_floatx80 (0x3fff ,0xa27043030c49370aULL ), -make_floatx80 (0x3ffd ,0x89c10c0c3124dc28ULL ) }, - {make_floatx80 (0x3ffd ,0xc00000000000fd2cULL ), -make_floatx80 (0x3fff ,0xa5fed6a9b15171cfULL ), -make_floatx80 (0x3ffd ,0x97fb5aa6c545c73cULL ) }, - {make_floatx80 (0x3ffd ,0xd0000000000093beULL ), -make_floatx80 (0x3fff ,0xa9a15ab4ea7c30e6ULL ), -make_floatx80 (0x3ffd ,0xa6856ad3a9f0c398ULL ) }, - {make_floatx80 (0x3ffd ,0xe00000000000c2aeULL ), -make_floatx80 (0x3fff ,0xad583eea42a17876ULL ), -make_floatx80 (0x3ffd ,0xb560fba90a85e1d8ULL ) }, - {make_floatx80 (0x3ffd ,0xefffffffffff1e3fULL ), -make_floatx80 (0x3fff ,0xb123f581d2abef6cULL ), -make_floatx80 (0x3ffd ,0xc48fd6074aafbdb0ULL ) }, - {make_floatx80 (0x3ffd ,0xffffffffffff1c23ULL ), -make_floatx80 (0x3fff ,0xb504f333f9de2cadULL ), -make_floatx80 (0x3ffd ,0xd413cccfe778b2b4ULL ) }, - {make_floatx80 (0x3ffe ,0x8800000000006344ULL ), -make_floatx80 (0x3fff ,0xb8fbaf4762fbd0a1ULL ), -make_floatx80 (0x3ffd ,0xe3eebd1d8bef4284ULL ) }, - {make_floatx80 (0x3ffe ,0x9000000000005d67ULL ), -make_floatx80 (0x3fff ,0xbd08a39f580c668dULL ), -make_floatx80 (0x3ffd ,0xf4228e7d60319a34ULL ) }, - {make_floatx80 (0x3ffe ,0x9800000000009127ULL ), -make_floatx80 (0x3fff ,0xc12c4cca6670e042ULL ), -make_floatx80 (0x3ffe ,0x82589994cce1c084ULL ) }, - {make_floatx80 (0x3ffe ,0x9fffffffffff06f9ULL ), -make_floatx80 (0x3fff ,0xc5672a11550655c3ULL ), -make_floatx80 (0x3ffe ,0x8ace5422aa0cab86ULL ) }, - {make_floatx80 (0x3ffe ,0xa7fffffffffff80dULL ), -make_floatx80 (0x3fff ,0xc9b9bd866e2f234bULL ), -make_floatx80 (0x3ffe ,0x93737b0cdc5e4696ULL ) }, - {make_floatx80 (0x3ffe ,0xafffffffffff1470ULL ), -make_floatx80 (0x3fff ,0xce248c151f83fd69ULL ), -make_floatx80 (0x3ffe ,0x9c49182a3f07fad2ULL ) }, - {make_floatx80 (0x3ffe ,0xb800000000000e0aULL ), -make_floatx80 (0x3fff ,0xd2a81d91f12aec5cULL ), -make_floatx80 (0x3ffe ,0xa5503b23e255d8b8ULL ) }, - {make_floatx80 (0x3ffe ,0xc00000000000b7faULL ), -make_floatx80 (0x3fff ,0xd744fccad69dd630ULL ), -make_floatx80 (0x3ffe ,0xae89f995ad3bac60ULL ) }, - {make_floatx80 (0x3ffe ,0xc800000000003aa6ULL ), -make_floatx80 (0x3fff ,0xdbfbb797daf25a44ULL ), -make_floatx80 (0x3ffe ,0xb7f76f2fb5e4b488ULL ) }, - {make_floatx80 (0x3ffe ,0xd00000000000a6aeULL ), -make_floatx80 (0x3fff ,0xe0ccdeec2a954685ULL ), -make_floatx80 (0x3ffe ,0xc199bdd8552a8d0aULL ) }, - {make_floatx80 (0x3ffe ,0xd800000000004165ULL ), -make_floatx80 (0x3fff ,0xe5b906e77c837155ULL ), -make_floatx80 (0x3ffe ,0xcb720dcef906e2aaULL ) }, - {make_floatx80 (0x3ffe ,0xe00000000000582cULL ), -make_floatx80 (0x3fff ,0xeac0c6e7dd24713aULL ), -make_floatx80 (0x3ffe ,0xd5818dcfba48e274ULL ) }, - {make_floatx80 (0x3ffe ,0xe800000000001a5dULL ), -make_floatx80 (0x3fff ,0xefe4b99bdcdb06ebULL ), -make_floatx80 (0x3ffe ,0xdfc97337b9b60dd6ULL ) }, - {make_floatx80 (0x3ffe ,0xefffffffffffc1efULL ), -make_floatx80 (0x3fff ,0xf5257d152486a2faULL ), -make_floatx80 (0x3ffe ,0xea4afa2a490d45f4ULL ) }, - {make_floatx80 (0x3ffe ,0xf800000000001069ULL ), -make_floatx80 (0x3fff ,0xfa83b2db722a0e5cULL ), -make_floatx80 (0x3ffe ,0xf50765b6e4541cb8ULL ) }, - {make_floatx80 (0x3fff ,0x8000000000000000ULL ), -make_floatx80 (0x4000 ,0x8000000000000000ULL ), -make_floatx80 (0x3fff ,0x8000000000000000ULL ) }, + {make_floatx80_init (0xbfff ,0x8000000000000000ULL ), +make_floatx80_init (0x3ffe ,0x8000000000000000ULL ), +make_floatx80_init (0xbffe ,0x8000000000000000ULL ) }, + {make_floatx80_init (0xbffe ,0xf800000000002e7eULL ), +make_floatx80_init (0x3ffe ,0x82cd8698ac2b9160ULL ), +make_floatx80_init (0xbffd ,0xfa64f2cea7a8dd40ULL ) }, + {make_floatx80_init (0xbffe ,0xefffffffffffe960ULL ), +make_floatx80_init (0x3ffe ,0x85aac367cc488345ULL ), +make_floatx80_init (0xbffd ,0xf4aa7930676ef976ULL ) }, + {make_floatx80_init (0xbffe ,0xe800000000006f10ULL ), +make_floatx80_init (0x3ffe ,0x88980e8092da5c14ULL ), +make_floatx80_init (0xbffd ,0xeecfe2feda4b47d8ULL ) }, + {make_floatx80_init (0xbffe ,0xe000000000008a45ULL ), +make_floatx80_init (0x3ffe ,0x8b95c1e3ea8ba2a5ULL ), +make_floatx80_init (0xbffd ,0xe8d47c382ae8bab6ULL ) }, + {make_floatx80_init (0xbffe ,0xd7ffffffffff8a9eULL ), +make_floatx80_init (0x3ffe ,0x8ea4398b45cd8116ULL ), +make_floatx80_init (0xbffd ,0xe2b78ce97464fdd4ULL ) }, + {make_floatx80_init (0xbffe ,0xd0000000000019a0ULL ), +make_floatx80_init (0x3ffe ,0x91c3d373ab11b919ULL ), +make_floatx80_init (0xbffd ,0xdc785918a9dc8dceULL ) }, + {make_floatx80_init (0xbffe ,0xc7ffffffffff14dfULL ), +make_floatx80_init (0x3ffe ,0x94f4efa8fef76836ULL ), +make_floatx80_init (0xbffd ,0xd61620ae02112f94ULL ) }, + {make_floatx80_init (0xbffe ,0xc000000000006530ULL ), +make_floatx80_init (0x3ffe ,0x9837f0518db87fbbULL ), +make_floatx80_init (0xbffd ,0xcf901f5ce48f008aULL ) }, + {make_floatx80_init (0xbffe ,0xb7ffffffffff1723ULL ), +make_floatx80_init (0x3ffe ,0x9b8d39b9d54eb74cULL ), +make_floatx80_init (0xbffd ,0xc8e58c8c55629168ULL ) }, + {make_floatx80_init (0xbffe ,0xb00000000000b5e1ULL ), +make_floatx80_init (0x3ffe ,0x9ef5326091a0c366ULL ), +make_floatx80_init (0xbffd ,0xc2159b3edcbe7934ULL ) }, + {make_floatx80_init (0xbffe ,0xa800000000006f8aULL ), +make_floatx80_init (0x3ffe ,0xa27043030c49370aULL ), +make_floatx80_init (0xbffd ,0xbb1f79f9e76d91ecULL ) }, + {make_floatx80_init (0xbffe ,0x9fffffffffff816aULL ), +make_floatx80_init (0x3ffe ,0xa5fed6a9b15171cfULL ), +make_floatx80_init (0xbffd ,0xb40252ac9d5d1c62ULL ) }, + {make_floatx80_init (0xbffe ,0x97ffffffffffb621ULL ), +make_floatx80_init (0x3ffe ,0xa9a15ab4ea7c30e6ULL ), +make_floatx80_init (0xbffd ,0xacbd4a962b079e34ULL ) }, + {make_floatx80_init (0xbffe ,0x8fffffffffff162bULL ), +make_floatx80_init (0x3ffe ,0xad583eea42a1b886ULL ), +make_floatx80_init (0xbffd ,0xa54f822b7abc8ef4ULL ) }, + {make_floatx80_init (0xbffe ,0x87ffffffffff4d34ULL ), +make_floatx80_init (0x3ffe ,0xb123f581d2ac7b51ULL ), +make_floatx80_init (0xbffd ,0x9db814fc5aa7095eULL ) }, + {make_floatx80_init (0xbffe ,0x800000000000227dULL ), +make_floatx80_init (0x3ffe ,0xb504f333f9de539dULL ), +make_floatx80_init (0xbffd ,0x95f619980c4358c6ULL ) }, + {make_floatx80_init (0xbffd ,0xefffffffffff3978ULL ), +make_floatx80_init (0x3ffe ,0xb8fbaf4762fbd0a1ULL ), +make_floatx80_init (0xbffd ,0x8e08a1713a085ebeULL ) }, + {make_floatx80_init (0xbffd ,0xe00000000000df81ULL ), +make_floatx80_init (0x3ffe ,0xbd08a39f580bfd8cULL ), +make_floatx80_init (0xbffd ,0x85eeb8c14fe804e8ULL ) }, + {make_floatx80_init (0xbffd ,0xd00000000000bccfULL ), +make_floatx80_init (0x3ffe ,0xc12c4cca667062f6ULL ), +make_floatx80_init (0xbffc ,0xfb4eccd6663e7428ULL ) }, + {make_floatx80_init (0xbffd ,0xc00000000000eff0ULL ), +make_floatx80_init (0x3ffe ,0xc5672a1155069abeULL ), +make_floatx80_init (0xbffc ,0xea6357baabe59508ULL ) }, + {make_floatx80_init (0xbffd ,0xb000000000000fe6ULL ), +make_floatx80_init (0x3ffe ,0xc9b9bd866e2f234bULL ), +make_floatx80_init (0xbffc ,0xd91909e6474372d4ULL ) }, + {make_floatx80_init (0xbffd ,0x9fffffffffff2172ULL ), +make_floatx80_init (0x3ffe ,0xce248c151f84bf00ULL ), +make_floatx80_init (0xbffc ,0xc76dcfab81ed0400ULL ) }, + {make_floatx80_init (0xbffd ,0x8fffffffffffafffULL ), +make_floatx80_init (0x3ffe ,0xd2a81d91f12afb2bULL ), +make_floatx80_init (0xbffc ,0xb55f89b83b541354ULL ) }, + {make_floatx80_init (0xbffc ,0xffffffffffff81a3ULL ), +make_floatx80_init (0x3ffe ,0xd744fccad69d7d5eULL ), +make_floatx80_init (0xbffc ,0xa2ec0cd4a58a0a88ULL ) }, + {make_floatx80_init (0xbffc ,0xdfffffffffff1568ULL ), +make_floatx80_init (0x3ffe ,0xdbfbb797daf25a44ULL ), +make_floatx80_init (0xbffc ,0x901121a0943696f0ULL ) }, + {make_floatx80_init (0xbffc ,0xbfffffffffff68daULL ), +make_floatx80_init (0x3ffe ,0xe0ccdeec2a94f811ULL ), +make_floatx80_init (0xbffb ,0xf999089eab583f78ULL ) }, + {make_floatx80_init (0xbffc ,0x9fffffffffff4690ULL ), +make_floatx80_init (0x3ffe ,0xe5b906e77c83657eULL ), +make_floatx80_init (0xbffb ,0xd237c8c41be4d410ULL ) }, + {make_floatx80_init (0xbffb ,0xffffffffffff8aeeULL ), +make_floatx80_init (0x3ffe ,0xeac0c6e7dd24427cULL ), +make_floatx80_init (0xbffb ,0xa9f9c8c116ddec20ULL ) }, + {make_floatx80_init (0xbffb ,0xbfffffffffff2d18ULL ), +make_floatx80_init (0x3ffe ,0xefe4b99bdcdb06ebULL ), +make_floatx80_init (0xbffb ,0x80da33211927c8a8ULL ) }, + {make_floatx80_init (0xbffa ,0xffffffffffff8ccbULL ), +make_floatx80_init (0x3ffe ,0xf5257d152486d0f4ULL ), +make_floatx80_init (0xbffa ,0xada82eadb792f0c0ULL ) }, + {make_floatx80_init (0xbff9 ,0xffffffffffff11feULL ), +make_floatx80_init (0x3ffe ,0xfa83b2db722a0846ULL ), +make_floatx80_init (0xbff9 ,0xaf89a491babef740ULL ) }, + { floatx80_zero_init, +make_floatx80_init (0x3fff ,0x8000000000000000ULL ), + floatx80_zero_init }, + {make_floatx80_init (0x3ff9 ,0xffffffffffff2680ULL ), +make_floatx80_init (0x3fff ,0x82cd8698ac2b9f6fULL ), +make_floatx80_init (0x3ff9 ,0xb361a62b0ae7dbc0ULL ) }, + {make_floatx80_init (0x3ffb ,0x800000000000b500ULL ), +make_floatx80_init (0x3fff ,0x85aac367cc488345ULL ), +make_floatx80_init (0x3ffa ,0xb5586cf9891068a0ULL ) }, + {make_floatx80_init (0x3ffb ,0xbfffffffffff4b67ULL ), +make_floatx80_init (0x3fff ,0x88980e8092da7cceULL ), +make_floatx80_init (0x3ffb ,0x8980e8092da7cce0ULL ) }, + {make_floatx80_init (0x3ffb ,0xffffffffffffff57ULL ), +make_floatx80_init (0x3fff ,0x8b95c1e3ea8bd6dfULL ), +make_floatx80_init (0x3ffb ,0xb95c1e3ea8bd6df0ULL ) }, + {make_floatx80_init (0x3ffc ,0x9fffffffffff811fULL ), +make_floatx80_init (0x3fff ,0x8ea4398b45cd4780ULL ), +make_floatx80_init (0x3ffb ,0xea4398b45cd47800ULL ) }, + {make_floatx80_init (0x3ffc ,0xbfffffffffff9980ULL ), +make_floatx80_init (0x3fff ,0x91c3d373ab11b919ULL ), +make_floatx80_init (0x3ffc ,0x8e1e9b9d588dc8c8ULL ) }, + {make_floatx80_init (0x3ffc ,0xdffffffffffff631ULL ), +make_floatx80_init (0x3fff ,0x94f4efa8fef70864ULL ), +make_floatx80_init (0x3ffc ,0xa7a77d47f7b84320ULL ) }, + {make_floatx80_init (0x3ffc ,0xffffffffffff2499ULL ), +make_floatx80_init (0x3fff ,0x9837f0518db892d4ULL ), +make_floatx80_init (0x3ffc ,0xc1bf828c6dc496a0ULL ) }, + {make_floatx80_init (0x3ffd ,0x8fffffffffff80fbULL ), +make_floatx80_init (0x3fff ,0x9b8d39b9d54e3a79ULL ), +make_floatx80_init (0x3ffc ,0xdc69cdceaa71d3c8ULL ) }, + {make_floatx80_init (0x3ffd ,0x9fffffffffffbc23ULL ), +make_floatx80_init (0x3fff ,0x9ef5326091a10313ULL ), +make_floatx80_init (0x3ffc ,0xf7a993048d081898ULL ) }, + {make_floatx80_init (0x3ffd ,0xafffffffffff20ecULL ), +make_floatx80_init (0x3fff ,0xa27043030c49370aULL ), +make_floatx80_init (0x3ffd ,0x89c10c0c3124dc28ULL ) }, + {make_floatx80_init (0x3ffd ,0xc00000000000fd2cULL ), +make_floatx80_init (0x3fff ,0xa5fed6a9b15171cfULL ), +make_floatx80_init (0x3ffd ,0x97fb5aa6c545c73cULL ) }, + {make_floatx80_init (0x3ffd ,0xd0000000000093beULL ), +make_floatx80_init (0x3fff ,0xa9a15ab4ea7c30e6ULL ), +make_floatx80_init (0x3ffd ,0xa6856ad3a9f0c398ULL ) }, + {make_floatx80_init (0x3ffd ,0xe00000000000c2aeULL ), +make_floatx80_init (0x3fff ,0xad583eea42a17876ULL ), +make_floatx80_init (0x3ffd ,0xb560fba90a85e1d8ULL ) }, + {make_floatx80_init (0x3ffd ,0xefffffffffff1e3fULL ), +make_floatx80_init (0x3fff ,0xb123f581d2abef6cULL ), +make_floatx80_init (0x3ffd ,0xc48fd6074aafbdb0ULL ) }, + {make_floatx80_init (0x3ffd ,0xffffffffffff1c23ULL ), +make_floatx80_init (0x3fff ,0xb504f333f9de2cadULL ), +make_floatx80_init (0x3ffd ,0xd413cccfe778b2b4ULL ) }, + {make_floatx80_init (0x3ffe ,0x8800000000006344ULL ), +make_floatx80_init (0x3fff ,0xb8fbaf4762fbd0a1ULL ), +make_floatx80_init (0x3ffd ,0xe3eebd1d8bef4284ULL ) }, + {make_floatx80_init (0x3ffe ,0x9000000000005d67ULL ), +make_floatx80_init (0x3fff ,0xbd08a39f580c668dULL ), +make_floatx80_init (0x3ffd ,0xf4228e7d60319a34ULL ) }, + {make_floatx80_init (0x3ffe ,0x9800000000009127ULL ), +make_floatx80_init (0x3fff ,0xc12c4cca6670e042ULL ), +make_floatx80_init (0x3ffe ,0x82589994cce1c084ULL ) }, + {make_floatx80_init (0x3ffe ,0x9fffffffffff06f9ULL ), +make_floatx80_init (0x3fff ,0xc5672a11550655c3ULL ), +make_floatx80_init (0x3ffe ,0x8ace5422aa0cab86ULL ) }, + {make_floatx80_init (0x3ffe ,0xa7fffffffffff80dULL ), +make_floatx80_init (0x3fff ,0xc9b9bd866e2f234bULL ), +make_floatx80_init (0x3ffe ,0x93737b0cdc5e4696ULL ) }, + {make_floatx80_init (0x3ffe ,0xafffffffffff1470ULL ), +make_floatx80_init (0x3fff ,0xce248c151f83fd69ULL ), +make_floatx80_init (0x3ffe ,0x9c49182a3f07fad2ULL ) }, + {make_floatx80_init (0x3ffe ,0xb800000000000e0aULL ), +make_floatx80_init (0x3fff ,0xd2a81d91f12aec5cULL ), +make_floatx80_init (0x3ffe ,0xa5503b23e255d8b8ULL ) }, + {make_floatx80_init (0x3ffe ,0xc00000000000b7faULL ), +make_floatx80_init (0x3fff ,0xd744fccad69dd630ULL ), +make_floatx80_init (0x3ffe ,0xae89f995ad3bac60ULL ) }, + {make_floatx80_init (0x3ffe ,0xc800000000003aa6ULL ), +make_floatx80_init (0x3fff ,0xdbfbb797daf25a44ULL ), +make_floatx80_init (0x3ffe ,0xb7f76f2fb5e4b488ULL ) }, + {make_floatx80_init (0x3ffe ,0xd00000000000a6aeULL ), +make_floatx80_init (0x3fff ,0xe0ccdeec2a954685ULL ), +make_floatx80_init (0x3ffe ,0xc199bdd8552a8d0aULL ) }, + {make_floatx80_init (0x3ffe ,0xd800000000004165ULL ), +make_floatx80_init (0x3fff ,0xe5b906e77c837155ULL ), +make_floatx80_init (0x3ffe ,0xcb720dcef906e2aaULL ) }, + {make_floatx80_init (0x3ffe ,0xe00000000000582cULL ), +make_floatx80_init (0x3fff ,0xeac0c6e7dd24713aULL ), +make_floatx80_init (0x3ffe ,0xd5818dcfba48e274ULL ) }, + {make_floatx80_init (0x3ffe ,0xe800000000001a5dULL ), +make_floatx80_init (0x3fff ,0xefe4b99bdcdb06ebULL ), +make_floatx80_init (0x3ffe ,0xdfc97337b9b60dd6ULL ) }, + {make_floatx80_init (0x3ffe ,0xefffffffffffc1efULL ), +make_floatx80_init (0x3fff ,0xf5257d152486a2faULL ), +make_floatx80_init (0x3ffe ,0xea4afa2a490d45f4ULL ) }, + {make_floatx80_init (0x3ffe ,0xf800000000001069ULL ), +make_floatx80_init (0x3fff ,0xfa83b2db722a0e5cULL ), +make_floatx80_init (0x3ffe ,0xf50765b6e4541cb8ULL ) }, + {make_floatx80_init (0x3fff ,0x8000000000000000ULL ), +make_floatx80_init (0x4000 ,0x8000000000000000ULL ), +make_floatx80_init (0x3fff ,0x8000000000000000ULL ) }, };void helper_f2xm1 (CPUX86State *env)@@ -1275,24 +1275,24 @@ struct fpatan_data { };static const struct fpatan_data fpatan_table[9 ] = { - { floatx80_zero, - floatx80_zero }, - {make_floatx80 (0x3ffb ,0xfeadd4d5617b6e33ULL ), -make_floatx80 (0xbfb9 ,0xdda19d8305ddc420ULL ) }, - {make_floatx80 (0x3ffc ,0xfadbafc96406eb15ULL ), -make_floatx80 (0x3fbb ,0xdb8f3debef442fccULL ) }, - {make_floatx80 (0x3ffd ,0xb7b0ca0f26f78474ULL ), -make_floatx80 (0xbfbc ,0xeab9bdba460376faULL ) }, - {make_floatx80 (0x3ffd ,0xed63382b0dda7b45ULL ), -make_floatx80 (0x3fbc ,0xdfc88bd978751a06ULL ) }, - {make_floatx80 (0x3ffe ,0x8f005d5ef7f59f9bULL ), -make_floatx80 (0x3fbd ,0xb906bc2ccb886e90ULL ) }, - {make_floatx80 (0x3ffe ,0xa4bc7d1934f70924ULL ), -make_floatx80 (0x3fbb ,0xcd43f9522bed64f8ULL ) }, - {make_floatx80 (0x3ffe ,0xb8053e2bc2319e74ULL ), -make_floatx80 (0xbfbc ,0xd3496ab7bd6eef0cULL ) }, - {make_floatx80 (0x3ffe ,0xc90fdaa22168c235ULL ), -make_floatx80 (0xbfbc ,0xece675d1fc8f8cbcULL ) }, + { floatx80_zero_init, + floatx80_zero_init }, + {make_floatx80_init (0x3ffb ,0xfeadd4d5617b6e33ULL ), +make_floatx80_init (0xbfb9 ,0xdda19d8305ddc420ULL ) }, + {make_floatx80_init (0x3ffc ,0xfadbafc96406eb15ULL ), +make_floatx80_init (0x3fbb ,0xdb8f3debef442fccULL ) }, + {make_floatx80_init (0x3ffd ,0xb7b0ca0f26f78474ULL ), +make_floatx80_init (0xbfbc ,0xeab9bdba460376faULL ) }, + {make_floatx80_init (0x3ffd ,0xed63382b0dda7b45ULL ), +make_floatx80_init (0x3fbc ,0xdfc88bd978751a06ULL ) }, + {make_floatx80_init (0x3ffe ,0x8f005d5ef7f59f9bULL ), +make_floatx80_init (0x3fbd ,0xb906bc2ccb886e90ULL ) }, + {make_floatx80_init (0x3ffe ,0xa4bc7d1934f70924ULL ), +make_floatx80_init (0x3fbb ,0xcd43f9522bed64f8ULL ) }, + {make_floatx80_init (0x3ffe ,0xb8053e2bc2319e74ULL ), +make_floatx80_init (0xbfbc ,0xd3496ab7bd6eef0cULL ) }, + {make_floatx80_init (0x3ffe ,0xc90fdaa22168c235ULL ), +make_floatx80_init (0xbfbc ,0xece675d1fc8f8cbcULL ) }, };void helper_fpatan (CPUX86State *env)
PATCH v2 8/12 linux-user: don't use MAP_FIXED in pgd_find_hole_fallback
In reply to Alex BennéePlain MAP_FIXED has the undesirable behaviour of splatting exiting maps so we don't actually achieve what we want when looking for gaps. We should be using MAP_FIXED_NOREPLACE. As this isn't always available we need to potentially check the returned address to see if the kernel gave us what we asked for.
--- include/qemu/osdep.h | 3 +++ linux-user/elfload.c | 10 ++++++---- 2 files changed, 9 insertions(+), 4 deletions(-)
include/qemu/osdep.h +3 -0
@@ -173,6 +173,9 @@ extern int daemon(int, int);#ifndef MAP_ANONYMOUS #define MAP_ANONYMOUS MAP_ANON#endif +#ifndef MAP_FIXED_NOREPLACE +#define MAP_FIXED_NOREPLACE 0 +#endif #ifndef ENOMEDIUM #define ENOMEDIUM ENODEV#endif
linux-user/elfload.c +6 -4
@@ -2134,12 +2134,15 @@ static uintptr_t pgd_find_hole_fallback(uintptr_t guest_size, uintptr_t brk,/* we have run out of space */ return -1 ; }else { -int flags =MAP_ANONYMOUS |MAP_PRIVATE |MAP_NORESERVE |MAP_FIXED ; +int flags =MAP_ANONYMOUS |MAP_PRIVATE |MAP_NORESERVE | +MAP_FIXED_NOREPLACE ;void * mmap_start =mmap ((void *) align_start, guest_size,PROT_NONE , flags,-1 ,0 );if (mmap_start !=MAP_FAILED ) {munmap ((void *) align_start, guest_size); -return (uintptr_t ) mmap_start + offset; +if (MAP_FIXED_NOREPLACE || mmap_start == (void *) align_start) { +return (uintptr_t ) mmap_start + offset; + } } base += qemu_host_page_size; }
@@ -2307,9 +2310,8 @@ static void pgb_reserved_va(const char *image_name, abi_ulong guest_loaddr,/* Widen the "image" to the entire reserved address space. */ pgb_static (image_name,0 , reserved_va, align); -#ifdef MAP_FIXED_NOREPLACE +/* osdep.h defines this as 0 if it's missing */ flags |=MAP_FIXED_NOREPLACE ; -#endif /* Reserve the memory on the host. */ assert (guest_base !=0 );
Signature · 1 line
2.20.1
Re: [PATCH v2 08/12] linux-user: don't use MAP_FIXED in pgd_find_hole_fallback
Quoted 6 lines · Alex Bennée
Plain
MAP_FIXEDhas the undesirable behaviour of splatting exiting maps so we don't actually achieve what we want when looking for gaps. We should be usingMAP_FIXED_NOREPLACE. As this isn't always available we need to potentially check the returned address to see if the kernel gave us what we asked for.
Quoted 6 lines
Fixes ad592e3Signed-off-by Alex Bennée <[email protected]>--- include/qemu/osdep.h | 3 +++ linux-user/elfload.c | 10 ++++++---- 2 files changed, 9 insertions(+), 4 deletions(-)
r~
PATCH v2 9/12 tests/docker: fix update command due to python3 str/bytes distinction
In reply to Alex BennéeDoes this seem convoluted to you? It feels a little complicated to me.
--- tests/docker/docker.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
tests/docker/docker.py +7 -6
@@ -24,7 +24,7 @@ import tempfile import re import signal from tarfile import TarFile, TarInfo -from io import StringIO +from io import StringIO, BytesIO from shutil import copy, rmtree from pwd import getpwuid from datetime import datetime, timedelta
@@ -541,13 +541,14 @@ class UpdateCommand(SubCommand): # Create a Docker buildfile df = StringIO() - df.write("FROM %s\n" % args.tag) - df.write("ADD . /\n") - df.seek(0) + df.write(u"FROM %s\n" % args.tag) + df.write(u"ADD . /\n") + + df_bytes = BytesIO(bytes(df.getvalue(), "UTF-8")) df_tar = TarInfo(name="Dockerfile") - df_tar.size = len(df.buf) - tmp_tar.addfile(df_tar, fileobj=df) + df_tar.size = df_bytes.getbuffer().nbytes + tmp_tar.addfile(df_tar, fileobj=df_bytes) tmp_tar.close()
Signature · 1 line
2.20.1
PATCH v2 10/12 tests/docker: fix binfmt_misc image building
In reply to Alex BennéeWhen we updated the arguments for docker.py we missed a bit.
--- tests/docker/Makefile.include | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/docker/Makefile.include +1 -1
@@ -78,7 +78,7 @@ docker-binfmt-image-debian-%: $(DOCKER_FILES_DIR)/debian-bootstrap.docker DEB_ARCH=$(DEB_ARCH) \ DEB_TYPE=$(DEB_TYPE) \ $(if $(DEB_URL),DEB_URL=$(DEB_URL),) \ - $(DOCKER_SCRIPT) build qemu/debian-$* $< \ + $(DOCKER_SCRIPT) build -t qemu/debian-$* -f $< \ $(if $V,,--quiet) $(if $(NOCACHE),--no-cache) \ $(if $(NOUSER),,--add-current-user) \ $(if $(EXTRA_FILES),--extra-files $(EXTRA_FILES)) \
Signature · 1 line
2.20.1
Re: [PATCH v2 10/12] tests/docker: fix binfmt_misc image building
Quoted 2 lines · Alex Bennée
When we updated the arguments for
docker.pywe missed a bit.
Oops.
Quoted 1 line
Fixes dfae6284
(see https://www.mail-archive.com/[email protected]/msg711059.html)
Quoted 19 lines
Signed-off-by Alex Bennée <[email protected]>--- tests/docker/Makefile.include | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tests/docker/Makefile.include +1
-1@@ -78,7 +78,7 @@ docker-binfmt-image-debian-%: $(DOCKER_FILES_DIR)/debian-bootstrap.docker DEB_ARCH=$(DEB_ARCH) \ DEB_TYPE=$(DEB_TYPE) \ $(if $(DEB_URL),DEB_URL=$(DEB_URL),) \ - $(DOCKER_SCRIPT) build qemu/debian-$* $< \ + $(DOCKER_SCRIPT) build -t qemu/debian-$* -f $< \ $(if $V,,--quiet) $(if $(NOCACHE),--no-cache) \ $(if $(NOUSER),,--add-current-user) \ $(if $(EXTRA_FILES),--extra-files $(EXTRA_FILES)) \
PATCH v2 11/12 tests/docker: add support for DEB_KEYRING
In reply to Alex BennéeFor installing stuff from sid or ports you may need to manually specify the location of the keyring. You can even import keys into your personal keyring and point it there, e.g.:
gpg --keyserver keyring.debian.org --recv-keys 84C573CD4E1AFD6C
make docker-binfmt-image-debian-sid-hppa DEB_TYPE=sid DEB_ARCH=hppa \
DEB_URL=http://ftp.ports.debian.org/debian-ports/ \
EXECUTABLE=./hppa-linux-user/qemu-hppa V=1 \
DEB_KEYRING=${HOME}/.gnupg/pubring.kbx--- tests/docker/dockerfiles/debian-bootstrap.pre | 7 +++++++ 1 file changed, 7 insertions(+)
tests/docker/dockerfiles/debian-bootstrap.pre +7 -0
@@ -79,6 +79,13 @@ else fi fi +# +# Add optional args +# +if [ -n "${DEB_KEYRING}" ]; then + DEBOOTSTRAP="${DEBOOTSTRAP} --keyring=${DEB_KEYRING}" +fi + # # Finally check to see if any qemu's are installed #
Signature · 1 line
2.20.1
Re: [PATCH v2 11/12] tests/docker: add support for DEB_KEYRING
Quoted 24 lines · Alex Bennée
For installing stuff from sid or ports you may need to manually specify the location of the keyring. You can even import keys into your personal keyring and point it there, e.g.:
gpg --keyserver keyring.debian.org --recv-keys 84C573CD4E1AFD6C make docker-binfmt-image-debian-sid-hppa DEB_TYPE=sid DEB_ARCH=hppa \ DEB_URL=http://ftp.ports.debian.org/debian-ports/ \ EXECUTABLE=./hppa-linux-user/qemu-hppa V=1 \ DEB_KEYRING=${HOME}/.gnupg/pubring.kbxSigned-off-by Alex Bennée <[email protected]>--- tests/docker/dockerfiles/debian-bootstrap.pre | 7 +++++++ 1 file changed, 7 insertions(+)tests/docker/dockerfiles/debian-bootstrap.pre +0
-0@@ -79,6 +79,13 @@ else fi fi
tests/docker/dockerfiles/debian-bootstrap.pre else · line 91
Quoted 10 lines
tests/docker/dockerfiles/debian-bootstrap.pre +7
-0+# +# Add optional args +# +if [ -n "${DEB_KEYRING}" ]; then + DEBOOTSTRAP="${DEBOOTSTRAP} --keyring=${DEB_KEYRING}" +fi + # # Finally check to see if any qemu's are installed #
Re: [PATCH v2 11/12] tests/docker: add support for DEB_KEYRING
In reply to Alex BennéeQuoted 10 lines · Alex Bennée
For installing stuff from sid or ports you may need to manually specify the location of the keyring. You can even import keys into your personal keyring and point it there, e.g.:
gpg --keyserver keyring.debian.org --recv-keys 84C573CD4E1AFD6C make docker-binfmt-image-debian-sid-hppa DEB_TYPE=sid DEB_ARCH=hppa \ DEB_URL=http://ftp.ports.debian.org/debian-ports/ \ EXECUTABLE=./hppa-linux-user/qemu-hppa V=1 \ DEB_KEYRING=${HOME}/.gnupg/pubring.kbx
Quoted 4 lines
Signed-off-by Alex Bennée <[email protected]>--- tests/docker/dockerfiles/debian-bootstrap.pre | 7 +++++++ 1 file changed, 7 insertions(+)
r~
PATCH v2 12/12 linux-user: fix clock_nanosleep()
In reply to Alex BennéeFrom: Laurent Vivier <[email protected]>
If clock_nanosleep() encounters an error, it returns one of the positive error number.
If the call is interrupted by a signal handler, it fails with error EINTR and if "remain" is not NULL and "flags" is not TIMER_ABSTIME, it returns the remaining unslept time in "remain".
Update linux-user to not overwrite the "remain" structure if there is no error.
Found with "make check-tcg", linux-test fails on nanosleep test:
TEST linux-test on x86_64.../tests/tcg/multiarch/linux-test.c:242: nanosleep
make[2]: *** [../Makefile.target:153: run-linux-test] Error 1
make[1]: *** [.../tests/tcg/Makefile.qemu:76: run-guest-tests] Error 2
make: *** [.../tests/Makefile.include:857: run-tcg-tests-x86_64-linux-user] Error 2
Message-Id: <[email protected]>
--- linux-user/syscall.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
linux-user/syscall.c +12 -3
@@ -11829,10 +11829,19 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, {struct timespec ts;target_to_host_timespec (&ts, arg3); - ret =get_errno (safe_clock_nanosleep (arg1, arg2, - &ts, arg4 ? &ts :NULL )); -if (arg4) +/* +* clock_nanosleep() returns 0 or one of the *positive* error number. +*/ + ret =host_to_target_errno (safe_clock_nanosleep (arg1, arg2, &ts, + arg4 ? &ts :NULL )); +/* +* if the call is interrupted by a signal handler, it fails +* with error TARGET_EINTR and if arg4 is not NULL and arg2 is not +* TIMER_ABSTIME, it returns the remaining unslept time in arg4. +*/ +if (ret ==TARGET_EINTR && arg4 && arg2 !=TIMER_ABSTIME ) {host_to_target_timespec (arg4, &ts); + }#if defined(TARGET_PPC )/* clock_nanosleep is odd in that it returns positive errno values.
Signature · 1 line
2.20.1
Re: [PATCH v2 12/12] linux-user: fix clock_nanosleep()
Le 22/07/2020 à 08:29, Alex Bennée a écrit :
Quoted 45 lines
From: Laurent Vivier <[email protected]>
If
clock_nanosleep()encounters an error, it returns one of the positive error number.If the call is interrupted by a signal handler, it fails with error EINTR and if "remain" is not NULL and "flags" is not
TIMER_ABSTIME, it returns the remaining unslept time in "remain".Update linux-user to not overwrite the "remain" structure if there is no error.
Found with "make check-tcg", linux-test fails on nanosleep test:
TEST linux-test on
x86_64.../tests/tcg/multiarch/linux-test.c:242: nanosleep
make[2]: *** [../Makefile.target:153: run-linux-test] Error 1
make[1]: *** [.../tests/tcg/Makefile.qemu:76: run-guest-tests] Error 2
make: *** [.../tests/Makefile.include:857: run-tcg-tests-x86_64-linux-user] Error 2Reported-by Philippe Mathieu-Daudé <[email protected]>Signed-off-by Laurent Vivier <[email protected]>Message-Id: <[email protected]>
--- linux-user/syscall.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)linux-user/syscall.c +6
-3@@ -11829,10 +11829,19 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, {struct timespec ts;target_to_host_timespec (&ts, arg3); - ret =get_errno (safe_clock_nanosleep (arg1, arg2, - &ts, arg4 ? &ts :NULL )); -if (arg4) +/* +* clock_nanosleep() returns 0 or one of the *positive* error number. +*/ + ret =host_to_target_errno (safe_clock_nanosleep (arg1, arg2, &ts, + arg4 ? &ts :NULL )); +/*
linux-user/syscall.c static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, · line 11847
Quoted 10 lines
linux-user/syscall.c +6
-0+* if the call is interrupted by a signal handler, it fails +* with error TARGET_EINTR and if arg4 is not NULL and arg2 is not +* TIMER_ABSTIME, it returns the remaining unslept time in arg4. +*/ +if (ret ==TARGET_EINTR && arg4 && arg2 !=TIMER_ABSTIME ) {host_to_target_timespec (arg4, &ts); + }#if defined(TARGET_PPC )/* clock_nanosleep is odd in that it returns positive errno values.
Wait a little before pushing that: I've made more tests and it seems to break something in LTP. I have to analyze.
Thanks,
Laurent
Re: [PATCH v2 12/12] linux-user: fix clock_nanosleep()
Le 22/07/2020 à 08:49, Laurent Vivier a écrit :
Quoted 53 lines
Le 22/07/2020 à 08:29, Alex Bennée a écrit :
Quoted 52 lines
From: Laurent Vivier <[email protected]>
If
clock_nanosleep()encounters an error, it returns one of the positive error number.If the call is interrupted by a signal handler, it fails with error EINTR and if "remain" is not NULL and "flags" is not
TIMER_ABSTIME, it returns the remaining unslept time in "remain".Update linux-user to not overwrite the "remain" structure if there is no error.
Found with "make check-tcg", linux-test fails on nanosleep test:
TEST linux-test on
x86_64.../tests/tcg/multiarch/linux-test.c:242: nanosleep
make[2]: *** [../Makefile.target:153: run-linux-test] Error 1
make[1]: *** [.../tests/tcg/Makefile.qemu:76: run-guest-tests] Error 2
make: *** [.../tests/Makefile.include:857: run-tcg-tests-x86_64-linux-user] Error 2Reported-by Philippe Mathieu-Daudé <[email protected]>Signed-off-by Laurent Vivier <[email protected]>Message-Id: <[email protected]>
--- linux-user/syscall.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)linux-user/syscall.c +12
-3@@ -11829,10 +11829,19 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, {struct timespec ts;target_to_host_timespec (&ts, arg3); - ret =get_errno (safe_clock_nanosleep (arg1, arg2, - &ts, arg4 ? &ts :NULL )); -if (arg4) +/* +* clock_nanosleep() returns 0 or one of the *positive* error number. +*/ + ret =host_to_target_errno (safe_clock_nanosleep (arg1, arg2, &ts, + arg4 ? &ts :NULL )); +/* +* if the call is interrupted by a signal handler, it fails +* with error TARGET_EINTR and if arg4 is not NULL and arg2 is not +* TIMER_ABSTIME, it returns the remaining unslept time in arg4. +*/ +if (ret ==TARGET_EINTR && arg4 && arg2 !=TIMER_ABSTIME ) {host_to_target_timespec (arg4, &ts); + }
Quoted 6 lines
linux-user/syscall.c static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, · line 11847
Quoted 3 lines
linux-user/syscall.c +0
-0#if defined(TARGET_PPC )/* clock_nanosleep is odd in that it returns positive errno values. Wait a little before pushing that: I've made more tests and it seems to break something in LTP. I have to analyze.
Apparently our safe_clock_nanosleep() doesn't behave like the system one described in the manpage: it actually returns -1 and update errno. So we need to keep the get_errno() and I think TARGET_PPC part can be removed because the crf bit will be updated in ppc/cpu_loop.c.
I update and test my patch and I will send the v2.
Thanks,
Laurent
Re: [PATCH v2 12/12] linux-user: fix clock_nanosleep()
In reply to Laurent VivierQuoted 53 lines · Laurent Vivier
Quoted 52 lines · Alex Bennée
From: Laurent Vivier <[email protected]>
If
clock_nanosleep()encounters an error, it returns one of the positive error number.If the call is interrupted by a signal handler, it fails with error EINTR and if "remain" is not NULL and "flags" is not
TIMER_ABSTIME, it returns the remaining unslept time in "remain".Update linux-user to not overwrite the "remain" structure if there is no error.
Found with "make check-tcg", linux-test fails on nanosleep test:
TEST linux-test on
x86_64.../tests/tcg/multiarch/linux-test.c:242: nanosleep
make[2]: *** [../Makefile.target:153: run-linux-test] Error 1
make[1]: *** [.../tests/tcg/Makefile.qemu:76: run-guest-tests] Error 2
make: *** [.../tests/Makefile.include:857: run-tcg-tests-x86_64-linux-user] Error 2Reported-by Philippe Mathieu-Daudé <[email protected]>Signed-off-by Laurent Vivier <[email protected]>Message-Id: <[email protected]>
--- linux-user/syscall.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)linux-user/syscall.c +12
-3@@ -11829,10 +11829,19 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, {struct timespec ts;target_to_host_timespec (&ts, arg3); - ret =get_errno (safe_clock_nanosleep (arg1, arg2, - &ts, arg4 ? &ts :NULL )); -if (arg4) +/* +* clock_nanosleep() returns 0 or one of the *positive* error number. +*/ + ret =host_to_target_errno (safe_clock_nanosleep (arg1, arg2, &ts, + arg4 ? &ts :NULL )); +/* +* if the call is interrupted by a signal handler, it fails +* with error TARGET_EINTR and if arg4 is not NULL and arg2 is not +* TIMER_ABSTIME, it returns the remaining unslept time in arg4. +*/ +if (ret ==TARGET_EINTR && arg4 && arg2 !=TIMER_ABSTIME ) {host_to_target_timespec (arg4, &ts); + }
Quoted 6 lines
linux-user/syscall.c static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, · line 11847
Quoted 3 lines
linux-user/syscall.c +0
-0#if defined(TARGET_PPC )/* clock_nanosleep is odd in that it returns positive errno values. Wait a little before pushing that: I've made more tests and it seems to break something in LTP. I have to analyze.
OK - which LTP test does it break?
I can drop from the PR if we don't have a clean-up by then (Fri?).
Quoted 3 lines
Thanks,
Laurent
Signature · 1 line
Alex Bennée
Re: [PATCH v2 12/12] linux-user: fix clock_nanosleep()
Le 22/07/2020 à 10:55, Alex Bennée a écrit :
Quoted 56 lines
Quoted 53 lines · Laurent Vivier
Quoted 52 lines · Alex Bennée
From: Laurent Vivier <[email protected]>
If
clock_nanosleep()encounters an error, it returns one of the positive error number.If the call is interrupted by a signal handler, it fails with error EINTR and if "remain" is not NULL and "flags" is not
TIMER_ABSTIME, it returns the remaining unslept time in "remain".Update linux-user to not overwrite the "remain" structure if there is no error.
Found with "make check-tcg", linux-test fails on nanosleep test:
TEST linux-test on
x86_64.../tests/tcg/multiarch/linux-test.c:242: nanosleep
make[2]: *** [../Makefile.target:153: run-linux-test] Error 1
make[1]: *** [.../tests/tcg/Makefile.qemu:76: run-guest-tests] Error 2
make: *** [.../tests/Makefile.include:857: run-tcg-tests-x86_64-linux-user] Error 2Reported-by Philippe Mathieu-Daudé <[email protected]>Signed-off-by Laurent Vivier <[email protected]>Message-Id: <[email protected]>
--- linux-user/syscall.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)linux-user/syscall.c +12
-3@@ -11829,10 +11829,19 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, {struct timespec ts;target_to_host_timespec (&ts, arg3); - ret =get_errno (safe_clock_nanosleep (arg1, arg2, - &ts, arg4 ? &ts :NULL )); -if (arg4) +/* +* clock_nanosleep() returns 0 or one of the *positive* error number. +*/ + ret =host_to_target_errno (safe_clock_nanosleep (arg1, arg2, &ts, + arg4 ? &ts :NULL )); +/* +* if the call is interrupted by a signal handler, it fails +* with error TARGET_EINTR and if arg4 is not NULL and arg2 is not +* TIMER_ABSTIME, it returns the remaining unslept time in arg4. +*/ +if (ret ==TARGET_EINTR && arg4 && arg2 !=TIMER_ABSTIME ) {host_to_target_timespec (arg4, &ts); + }
Quoted 8 lines
Quoted 6 lines
linux-user/syscall.c static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, · line 11847
Quoted 3 lines
linux-user/syscall.c +0
-0#if defined(TARGET_PPC )/* clock_nanosleep is odd in that it returns positive errno values. Wait a little before pushing that: I've made more tests and it seems to break something in LTP. I have to analyze.
OK - which LTP test does it break?
clock_nanosleep01
Quoted 2 lines
I can drop from the PR if we don't have a clean-up by then (Fri?).
I have a fix. I'm testing it. I will send the v2 today.
https://github.com/vivier/qemu/commit/25060f425e71c57112a334d9930f234011d079a1
Thanks,
Laurent
Re: [PATCH v2 12/12] linux-user: fix clock_nanosleep()
In reply to Alex BennéeQuoted 20 lines · Alex Bennée
From: Laurent Vivier <[email protected]>
If
clock_nanosleep()encounters an error, it returns one of the positive error number.If the call is interrupted by a signal handler, it fails with error EINTR and if "remain" is not NULL and "flags" is not
TIMER_ABSTIME, it returns the remaining unslept time in "remain".Update linux-user to not overwrite the "remain" structure if there is no error.
Found with "make check-tcg", linux-test fails on nanosleep test:
TEST linux-test on
x86_64.../tests/tcg/multiarch/linux-test.c:242: nanosleep
make[2]: *** [../Makefile.target:153: run-linux-test] Error 1
make[1]: *** [.../tests/tcg/Makefile.qemu:76: run-guest-tests] Error 2
make: *** [.../tests/Makefile.include:857: run-tcg-tests-x86_64-linux-user] Error 2
Quoted 3 lines
Reported-by Philippe Mathieu-Daudé <[email protected]>Signed-off-by Laurent Vivier <[email protected]>Message-Id: <[email protected]>
(Missing your S-o-b)
Quoted 32 lines
--- linux-user/syscall.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)linux-user/syscall.c +12
-3@@ -11829,10 +11829,19 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, {struct timespec ts;target_to_host_timespec (&ts, arg3); - ret =get_errno (safe_clock_nanosleep (arg1, arg2, - &ts, arg4 ? &ts :NULL )); -if (arg4) +/* +* clock_nanosleep() returns 0 or one of the *positive* error number. +*/ + ret =host_to_target_errno (safe_clock_nanosleep (arg1, arg2, &ts, + arg4 ? &ts :NULL )); +/* +* if the call is interrupted by a signal handler, it fails +* with error TARGET_EINTR and if arg4 is not NULL and arg2 is not +* TIMER_ABSTIME, it returns the remaining unslept time in arg4. +*/ +if (ret ==TARGET_EINTR && arg4 && arg2 !=TIMER_ABSTIME ) {host_to_target_timespec (arg4, &ts); + }#if defined(TARGET_PPC )/* clock_nanosleep is odd in that it returns positive errno values.