[PATCH v2] linux-user: Passthrough MADV_DONTNEED for certain file mappings

2022-07-25 Thread Ilya Leoshkevich
ASSTHROUGH, and then allow madvise() passthrough for these pages as well. Signed-off-by: Ilya Leoshkevich --- v1: https://lists.gnu.org/archive/html/qemu-devel/2022-07/msg00112.html v1 -> v2: Fix PAGE_PASSTHROUGH value; make checks consistent with page_set_flags() (Laurent). include/exec/c

[PING^2] linux-user: Passthrough MADV_DONTNEED for certain file mappings

2022-07-22 Thread Ilya Leoshkevich
On Fri, 2022-07-01 at 15:52 +0200, Ilya Leoshkevich wrote: > This is a follow-up for commit 892a4f6a750a ("linux-user: Add partial > support for MADV_DONTNEED"), which added passthrough for anonymous > mappings. File mappings can be handled in a similar manner. > > In ord

[PATCH v2 2/2] tests/tcg/s390x: Test unaligned accesses to lowcore

2022-07-22 Thread Ilya Leoshkevich
Add a small test to avoid regressions. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.softmmu-target | 9 + tests/tcg/s390x/unaligned-lowcore.S | 19 +++ 2 files changed, 28 insertions(+) create mode 100644 tests/tcg/s390x/Makefile.softmmu-target

[PATCH v2 1/2] qapi: Add exit-failure PanicAction

2022-07-22 Thread Ilya Leoshkevich
. Signed-off-by: Ilya Leoshkevich --- include/sysemu/sysemu.h | 2 +- qapi/run-state.json | 4 +++- qemu-options.hx | 2 +- softmmu/main.c | 6 -- softmmu/runstate.c | 17 + 5 files changed, 22 insertions(+), 9 deletions(-) diff --git a/include

[PATCH v2 0/2] accel/tcg: Test unaligned stores to s390x low-address-protected lowcore

2022-07-22 Thread Ilya Leoshkevich
-address-protected lowcore; it performs a shutdown on success and panic on failure. Best regards, Ilya [1] https://lists.gnu.org/archive/html/qemu-devel/2022-07/msg01876.html Ilya Leoshkevich (2): qapi: Add exit-failure PanicAction tests/tcg/s390x: Test unaligned accesses to lowcore include

[PATCH v2 3/3] tests/tcg/s390x: test signed vfmin/vfmax

2022-07-13 Thread Ilya Leoshkevich
in this case. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.target | 7 + tests/tcg/s390x/vfminmax.c | 411 2 files changed, 418 insertions(+) create mode 100644 tests/tcg/s390x/vfminmax.c diff --git a/tests/tcg/s390x/Makefile.target b

[PATCH v2 0/3] target/s390x: vfmin/vfmax fixes

2022-07-13 Thread Ilya Leoshkevich
-devel/2022-07/msg01915.html v1 -> v2: Drop mmap() in the test (Richard). Ilya Leoshkevich (3): target/s390x: fix handling of zeroes in vfmin/vfmax target/s390x: fix NaN propagation rules tests/tcg/s390x: test signed vfmin/vfmax fpu/softfloat-specialize.c.inc| 3 +- target/s390x/

[PATCH v2 2/3] target/s390x: fix NaN propagation rules

2022-07-13 Thread Ilya Leoshkevich
s390x has the same NaN propagation rules as ARM, and not as x86. Signed-off-by: Ilya Leoshkevich Reviewed-by: Richard Henderson Reviewed-by: David Hildenbrand --- fpu/softfloat-specialize.c.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fpu/softfloat

[PATCH v2 1/3] target/s390x: fix handling of zeroes in vfmin/vfmax

2022-07-13 Thread Ilya Leoshkevich
") Co-developed-by: Ulrich Weigand Signed-off-by: Ilya Leoshkevich Reviewed-by: Richard Henderson Reviewed-by: David Hildenbrand --- target/s390x/tcg/vec_fpu_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/s390x/tcg/vec_fpu_helper.c b/target

Re: [PATCH 3/3] tests/tcg/s390x: test signed vfmin/vfmax

2022-07-13 Thread Ilya Leoshkevich
On Wed, 2022-07-13 at 21:14 +0530, Richard Henderson wrote: > On 7/12/22 18:02, Ilya Leoshkevich wrote: > > > This works, of course.  It could be simpler using EXECUTE, to > > > store > > > just the one > > > instruction and not worry about an executable ma

[PING] linux-user: Passthrough MADV_DONTNEED for certain file mappings

2022-07-12 Thread Ilya Leoshkevich
On Fri, 2022-07-01 at 15:52 +0200, Ilya Leoshkevich wrote: > This is a follow-up for commit 892a4f6a750a ("linux-user: Add partial > support for MADV_DONTNEED"), which added passthrough for anonymous > mappings. File mappings can be handled in a similar manner. > > In ord

Re: [PATCH 3/3] tests/tcg/s390x: test signed vfmin/vfmax

2022-07-12 Thread Ilya Leoshkevich
On Tue, 2022-07-12 at 10:19 +0530, Richard Henderson wrote: > On 7/12/22 07:27, Ilya Leoshkevich wrote: > > +/* > > + * vfmin/vfmax code generation. > > + */ > > +extern const char vfminmax_template[]; > > +extern const int vfminmax_template_size; > > +ext

Re: [PATCH 2/3] hw/misc: Add mmio-debug-exit device

2022-07-12 Thread Ilya Leoshkevich
On Tue, 2022-07-12 at 12:08 +0200, David Hildenbrand wrote: > On 12.07.22 11:52, Ilya Leoshkevich wrote: > > On Tue, 2022-07-12 at 10:42 +0530, Richard Henderson wrote: > > > On 7/12/22 00:26, Ilya Leoshkevich wrote: > > > > System tests on x86 use isa-debug-exit dev

Re: [PATCH 2/3] hw/misc: Add mmio-debug-exit device

2022-07-12 Thread Ilya Leoshkevich
On Tue, 2022-07-12 at 10:42 +0530, Richard Henderson wrote: > On 7/12/22 00:26, Ilya Leoshkevich wrote: > > System tests on x86 use isa-debug-exit device in order to signal > > success or failure to the test runner. Unfortunately it's not > > easily > > usable on other a

[PATCH 3/3] tests/tcg/s390x: test signed vfmin/vfmax

2022-07-11 Thread Ilya Leoshkevich
in this case. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.target | 7 + tests/tcg/s390x/vfminmax.c | 426 2 files changed, 433 insertions(+) create mode 100644 tests/tcg/s390x/vfminmax.c diff --git a/tests/tcg/s390x/Makefile.target b

[PATCH 2/3] target/s390x: fix NaN propagation rules

2022-07-11 Thread Ilya Leoshkevich
s390x has the same NaN propagation rules as ARM, and not as x86. Signed-off-by: Ilya Leoshkevich --- fpu/softfloat-specialize.c.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc index 943e3301d2..a43ff5e02e

[PATCH 1/3] target/s390x: fix handling of zeroes in vfmin/vfmax

2022-07-11 Thread Ilya Leoshkevich
") Co-developed-by: Ulrich Weigand Signed-off-by: Ilya Leoshkevich --- target/s390x/tcg/vec_fpu_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/s390x/tcg/vec_fpu_helper.c b/target/s390x/tcg/vec_fpu_helper.c index 2a618a1093..75cf605b9f 100644 --- a/target

[PATCH 0/3] target/s390x: vfmin/vfmax fixes

2022-07-11 Thread Ilya Leoshkevich
Hi, Uli has found an issue with finding maximum of different kinds of 0s; I wrote a test and found another one with finding maximum of different kinds of NaNs. Patches 1 and 2 fix those issues, patch 3 adds a vfmin/vfmax test. Best regards, Ilya Ilya Leoshkevich (3): target/s390x: fix

[PATCH 3/3] tests/tcg/s390x: Test unaligned accesses to lowcore

2022-07-11 Thread Ilya Leoshkevich
Add a small test to avoid regressions. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.softmmu-target | 9 + tests/tcg/s390x/unaligned-lowcore.S | 24 2 files changed, 33 insertions(+) create mode 100644 tests/tcg/s390x/Makefile.softmmu-target

[PATCH 1/3] accel/tcg: Fix unaligned stores to s390x low-address-protected lowcore

2022-07-11 Thread Ilya Leoshkevich
Signed-off-by: Ilya Leoshkevich --- accel/tcg/cputlb.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index f90f4312ea..a46f3a654d 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -2248,7 +2248,7 @@ store_helper_unaligned(CP

[PATCH 0/3] accel/tcg: Fix unaligned stores to s390x low-address-protected lowcore

2022-07-11 Thread Ilya Leoshkevich
a system test for this issue. Best regards, Ilya Ilya Leoshkevich (3): accel/tcg: Fix unaligned stores to s390x low-address-protected lowcore hw/misc: Add mmio-debug-exit device tests/tcg/s390x: Test unaligned accesses to lowcore accel/tcg/cputlb.c | 8 ++- hw/misc

[PATCH 2/3] hw/misc: Add mmio-debug-exit device

2022-07-11 Thread Ilya Leoshkevich
, which an architecture might not otherwise need. Introduce mmio-debug-exit device, which has the same semantics, but is triggered by writes to memory. Signed-off-by: Ilya Leoshkevich --- hw/misc/Kconfig | 3 ++ hw/misc/debugexit_mmio.c | 80 hw/misc

Re: [RFC] gitlab: introduce s390x wasmtime job

2022-07-05 Thread Ilya Leoshkevich
On Tue, 2022-07-05 at 15:40 +0100, Peter Maydell wrote: > On Tue, 5 Jul 2022 at 15:37, Ilya Leoshkevich > wrote: > > > > On Tue, 2022-07-05 at 14:57 +0100, Peter Maydell wrote: > > > On Tue, 5 Jul 2022 at 14:04, Daniel P. Berrangé > > > > > > wrote:

[PATCH v3] multifd: Copy pages before compressing them with zlib

2022-07-05 Thread Ilya Leoshkevich
l [4] http://publibfp.dhe.ibm.com/epubs/pdf/a227832c.pdf [5] https://lists.gnu.org/archive/html/qemu-devel/2022-07/msg00889.html Signed-off-by: Ilya Leoshkevich --- v1: https://lists.gnu.org/archive/html/qemu-devel/2022-03/msg06841.html v1 -> v2: Rebase, mention Mark Adler's reply in the c

Re: [PATCH] multifd: Copy pages before compressing them with zlib

2022-07-05 Thread Ilya Leoshkevich
On Tue, 2022-07-05 at 16:27 +0100, Dr. David Alan Gilbert wrote: > * Ilya Leoshkevich (i...@linux.ibm.com) wrote: > > zlib_send_prepare() compresses pages of a running VM. zlib does not > > make any thread-safety guarantees with respect to changing > > deflate() > > inpu

Re: [RFC] gitlab: introduce s390x wasmtime job

2022-07-05 Thread Ilya Leoshkevich
On Tue, 2022-07-05 at 14:57 +0100, Peter Maydell wrote: > On Tue, 5 Jul 2022 at 14:04, Daniel P. Berrangé > wrote: > > If we put this job in QEMU CI someone will have to be able to > > interpret the results when it fails. > > In particular since this is qemu-user, the answer is probably > at

Re: [RFC] gitlab: introduce s390x wasmtime job

2022-07-05 Thread Ilya Leoshkevich
On Tue, 2022-07-05 at 13:58 +0100, Daniel P. Berrangé wrote: > On Tue, Jul 05, 2022 at 12:48:44AM +0200, Ilya Leoshkevich wrote: > > wasmtime is a WebAssembly runtime, which includes a large > > testsuite. > > This testsuite uses qemu-user (aarch64 and s390x are supported) in

[RFC] gitlab: introduce s390x wasmtime job

2022-07-04 Thread Ilya Leoshkevich
/2022-07/msg00112.html Signed-off-by: Ilya Leoshkevich --- .gitlab-ci.d/container-cross.yml | 10 +++ .gitlab-ci.d/container-template.yml | 2 +- .gitlab-ci.d/qemu-project.yml | 1 + .gitlab-ci.d/wasmtime-template.yml| 6 ++ .gitlab-ci.d

[PATCH] multifd: Copy pages before compressing them with zlib

2022-07-04 Thread Ilya Leoshkevich
l [4] http://publibfp.dhe.ibm.com/epubs/pdf/a227832c.pdf [5] https://gitlab.com/qemu-project/qemu/-/issues/1099 Signed-off-by: Ilya Leoshkevich --- v1: https://lists.gnu.org/archive/html/qemu-devel/2022-03/msg06841.html v1 -> v2: Rebase, mention Mark Adler's reply in the commit message. migr

[PATCH] linux-user: Passthrough MADV_DONTNEED for certain file mappings

2022-07-01 Thread Ilya Leoshkevich
ASSTHROUGH, and then allow madvise() passthrough for these pages as well. Signed-off-by: Ilya Leoshkevich --- include/exec/cpu-all.h | 6 ++ linux-user/mmap.c | 25 + 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/include/exec/cpu-all.h b/include/exec

[PATCH] linux-user: Fix stracing in-memory mmap arguments

2022-06-30 Thread Ilya Leoshkevich
of do_syscall(), however, that would change what the qemu_plugin_register_vcpu_syscall_cb() users get. Signed-off-by: Ilya Leoshkevich --- linux-user/mmap.c | 20 linux-user/strace.c| 24 linux-user/syscall.c | 25 +++-- linux

[PATCH v2] linux-user: Add partial support for MADV_DONTNEED

2022-06-21 Thread Ilya Leoshkevich
mtime/blob/v0.37.0/ci/qemu-madvise.patch [4] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/mm/madvise.c?h=v5.19-rc3#n1368 Signed-off-by: Ilya Leoshkevich Reviewed-by: Laurent Vivier --- v1: https://lists.gnu.org/archive/html/qemu-devel/2022-06/msg03572.html v1 -&g

[PATCH] linux-user: Add partial support for MADV_DONTNEED

2022-06-20 Thread Ilya Leoshkevich
mtime/blob/v0.37.0/ci/qemu-madvise.patch [4] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/mm/madvise.c?h=v5.19-rc3#n1368 Signed-off-by: Ilya Leoshkevich --- linux-user/mmap.c | 68 ++ linux-user/syscall.c | 6 +--- linux

PING: [PATCH 2/2] tests/tcg/s390x: Test unwinding from signal handlers

2022-05-19 Thread Ilya Leoshkevich
On Wed, 2022-05-04 at 00:51 +0200, Ilya Leoshkevich wrote: > Add a small test to prevent regressions. > > Signed-off-by: Ilya Leoshkevich > --- >  tests/tcg/s390x/signals-s390x.c | 69 ++- > -- >  1 file changed, 55 insertions(+), 14 deletio

[PATCH] linux-user/host/s390: Treat EX and EXRL as writes

2022-05-04 Thread Ilya Leoshkevich
) as writes. There may be false positives, but they will lead only to an extra page_unprotect() call. Reported-by: Thomas Huth Signed-off-by: Ilya Leoshkevich --- linux-user/include/host/s390/host-signal.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/linux-user/include/host/s390/host

Re: branch-relative-long fails on s390x host (was: [PATCH] tests/tcg/s390x: Use a different PCRel32 notation in branch-relative-long.c)

2022-05-04 Thread Ilya Leoshkevich
On Wed, 2022-05-04 at 12:51 +0200, Ilya Leoshkevich wrote: > On Wed, 2022-05-04 at 12:46 +0200, Thomas Huth wrote: > > On 04/05/2022 11.37, Ilya Leoshkevich wrote: > > > On Wed, 2022-05-04 at 11:14 +0200, Thomas Huth wrote: > > > > On 04/05/2022 11.07, Ilya Leosh

Re: branch-relative-long fails on s390x host (was: [PATCH] tests/tcg/s390x: Use a different PCRel32 notation in branch-relative-long.c)

2022-05-04 Thread Ilya Leoshkevich
On Wed, 2022-05-04 at 12:46 +0200, Thomas Huth wrote: > On 04/05/2022 11.37, Ilya Leoshkevich wrote: > > On Wed, 2022-05-04 at 11:14 +0200, Thomas Huth wrote: > > > On 04/05/2022 11.07, Ilya Leoshkevich wrote: > > > > On Wed, 2022-05-04 at 09:01 +0200, Thomas Huth

Re: branch-relative-long fails on s390x host (was: [PATCH] tests/tcg/s390x: Use a different PCRel32 notation in branch-relative-long.c)

2022-05-04 Thread Ilya Leoshkevich
On Wed, 2022-05-04 at 11:14 +0200, Thomas Huth wrote: > On 04/05/2022 11.07, Ilya Leoshkevich wrote: > > On Wed, 2022-05-04 at 09:01 +0200, Thomas Huth wrote: > > > On 04/05/2022 00.46, Ilya Leoshkevich wrote: > > > > On Tue, 2022-05-03 at 21:26 +0200, Thomas Huth

Re: [PATCH] tests/tcg/s390x: Use a different PCRel32 notation in branch-relative-long.c

2022-05-04 Thread Ilya Leoshkevich
On Wed, 2022-05-04 at 09:01 +0200, Thomas Huth wrote: > On 04/05/2022 00.46, Ilya Leoshkevich wrote: > > On Tue, 2022-05-03 at 21:26 +0200, Thomas Huth wrote: > > > On 03/05/2022 11.02, Thomas Huth wrote: > > > > On 02/05/2022 18.48, Ilya Leoshkevich wrote: > >

[PATCH 1/2] linux-user/s390x: Fix unwinding from signal handlers

2022-05-03 Thread Ilya Leoshkevich
the field and add a comment. Reported-by: Ulrich Weigand Signed-off-by: Ilya Leoshkevich Fixes: 31330e6cecfd ("linux-user/s390x: Implement setup_sigtramp") --- linux-user/s390x/signal.c | 5 + 1 file changed, 5 insertions(+) diff --git a/linux-user/s390x/signal.c b/linux-user/

Re: [PATCH] tests/tcg/s390x: Use a different PCRel32 notation in branch-relative-long.c

2022-05-03 Thread Ilya Leoshkevich
On Tue, 2022-05-03 at 21:26 +0200, Thomas Huth wrote: > On 03/05/2022 11.02, Thomas Huth wrote: > > On 02/05/2022 18.48, Ilya Leoshkevich wrote: > > > Binutils >=2.37 and Clang do not accept (. - 0x1) PCRel32 > > > constants. While this looks lik

[PATCH 0/2] linux-user/s390x: Fix unwinding from signal handlers

2022-05-03 Thread Ilya Leoshkevich
Hi, This is the fix for the issue discussed in [1]. Patch 1 fixes the issue itself, patch 2 adds a test. [1] https://lists.nongnu.org/archive/html/qemu-devel/2022-04/msg05127.html Best regards, Ilya Ilya Leoshkevich (2): linux-user/s390x: Fix unwinding from signal handlers tests/tcg/s390x

[PATCH 2/2] tests/tcg/s390x: Test unwinding from signal handlers

2022-05-03 Thread Ilya Leoshkevich
Add a small test to prevent regressions. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/signals-s390x.c | 69 ++--- 1 file changed, 55 insertions(+), 14 deletions(-) diff --git a/tests/tcg/s390x/signals-s390x.c b/tests/tcg/s390x/signals-s390x.c index dc2f8ee59a

[PATCH] tests/tcg/s390x: Use a different PCRel32 notation in branch-relative-long.c

2022-05-02 Thread Ilya Leoshkevich
Binutils >=2.37 and Clang do not accept (. - 0x1) PCRel32 constants. While this looks like a bug that needs fixing, use a different notation (-0x1) as a workaround. Reported-by: Thomas Huth Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/branch-relative-long.c | 4 ++--

Re: [PATCH] multifd: Copy pages before compressing them with zlib

2022-04-04 Thread Ilya Leoshkevich
On Mon, 2022-04-04 at 12:20 +0100, Dr. David Alan Gilbert wrote: > * Ilya Leoshkevich (i...@linux.ibm.com) wrote: > > zlib_send_prepare() compresses pages of a running VM. zlib does not > > make any thread-safety guarantees with respect to changing > > deflate() > > inpu

[PATCH] multifd: Copy pages before compressing them with zlib

2022-03-29 Thread Ilya Leoshkevich
chive/html/qemu-devel/2022-03/msg03988.html [4] http://publibfp.dhe.ibm.com/epubs/pdf/a227832c.pdf Signed-off-by: Ilya Leoshkevich --- migration/multifd-zlib.c | 35 ++- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/migration/multifd-zlib.c b/migrati

[PATCH v3 2/3] s390x/tcg: Fix BRCL with a large negative offset

2022-03-14 Thread Ilya Leoshkevich
When RI2 is 0x8000, qemu enters an infinite loop instead of jumping backwards. Fix by adding a missing cast, like in in2_ri2(). Fixes: 7233f2ed1717 ("target-s390: Convert BRANCH ON CONDITION") Reviewed-by: David Hildenbrand Reviewed-by: Richard Henderson Signed-off-by: Ilya L

[PATCH v3 3/3] tests/tcg/s390x: Test BRASL and BRCL with large negative offsets

2022-03-14 Thread Ilya Leoshkevich
Add a small test in order to prevent regressions. Reviewed-by: Richard Henderson Reviewed-by: David Hildenbrand Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.target| 1 + tests/tcg/s390x/branch-relative-long.c | 68 ++ 2 files changed, 69

[PATCH v3 0/3] Fix BRASL and BRCL with large negative offsets

2022-03-14 Thread Ilya Leoshkevich
387.html v2 -> v3: - Use MAP_NORESERVE (Christian / David). - Unhardcode 0x10006 (Richard). Best regards, Ilya Ilya Leoshkevich (3): s390x/tcg: Fix BRASL with a large negative offset s390x/tcg: Fix BRCL with a large negative offset tests/tcg/s390x: Test BRASL and BRCL with large ne

[PATCH v3 1/3] s390x/tcg: Fix BRASL with a large negative offset

2022-03-14 Thread Ilya Leoshkevich
When RI2 is 0x8000, qemu enters an infinite loop instead of jumping backwards. Fix by adding a missing cast, like in in2_ri2(). Fixes: 8ac33cdb8bfb ("Convert BRANCH AND SAVE") Reviewed-by: David Hildenbrand Reviewed-by: Richard Henderson Signed-off-by: Ilya Leoshkevich --- ta

[PATCH v2 3/3] tests/tcg/s390x: Test BRASL and BRCL with large negative offsets

2022-03-12 Thread Ilya Leoshkevich
Add a small test in order to prevent regressions. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.target| 1 + tests/tcg/s390x/branch-relative-long.c | 60 ++ 2 files changed, 61 insertions(+) create mode 100644 tests/tcg/s390x/branch-relative

[PATCH v2 1/3] s390x/tcg: Fix BRASL with a large negative offset

2022-03-12 Thread Ilya Leoshkevich
When RI2 is 0x8000, qemu enters an infinite loop instead of jumping backwards. Fix by adding a missing cast, like in in2_ri2(). Fixes: 8ac33cdb8bfb ("Convert BRANCH AND SAVE") Reviewed-by: David Hildenbrand Signed-off-by: Ilya Leoshkevich --- target/s390x/tcg/translate.c | 2

[PATCH v2 0/3] Fix BRASL and BRCL with large negative offsets

2022-03-12 Thread Ilya Leoshkevich
ard). - Replace test opcodes with inline asm (David). Since we now want to skip the test if the code cannot be mapped (e.g. on a 31-bit host), we shouldn't be asking the loader to map the code right away. So the mmap() approach stays. Best regards, Ilya Ilya Leoshkevich (3): s390x/tcg: Fix BR

[PATCH v2 2/3] s390x/tcg: Fix BRCL with a large negative offset

2022-03-12 Thread Ilya Leoshkevich
When RI2 is 0x8000, qemu enters an infinite loop instead of jumping backwards. Fix by adding a missing cast, like in in2_ri2(). Fixes: 7233f2ed1717 ("target-s390: Convert BRANCH ON CONDITION") Reviewed-by: David Hildenbrand Signed-off-by: Ilya Leoshkevich --- target/s390x/tcg/t

Re: [PATCH 3/3] tests/tcg/s390x: Test BRASL and BRCL with large negative offsets

2022-03-11 Thread Ilya Leoshkevich
On Fri, 2022-03-11 at 19:57 +0100, David Hildenbrand wrote: > On 11.03.22 19:49, Ilya Leoshkevich wrote: > > Add a small test in order to prevent regressions. > > > > Signed-off-by: Ilya Leoshkevich > > --- > >  tests/tcg/s390x/Makefile.target    |  1 + >

[PATCH 1/3] s390x/tcg: Fix BRASL with a large negative offset

2022-03-11 Thread Ilya Leoshkevich
When RI2 is 0x8000, qemu enters an infinite loop instead of jumping backwards. Fix by adding a missing cast, like in in2_ri2(). Fixes: 8ac33cdb8bfb ("Convert BRANCH AND SAVE") Signed-off-by: Ilya Leoshkevich --- target/s390x/tcg/translate.c | 2 +- 1 file changed, 1 insertion(+),

[PATCH 2/3] s390x/tcg: Fix BRCL with a large negative offset

2022-03-11 Thread Ilya Leoshkevich
When RI2 is 0x8000, qemu enters an infinite loop instead of jumping backwards. Fix by adding a missing cast, like in in2_ri2(). Fixes: 7233f2ed1717 ("target-s390: Convert BRANCH ON CONDITION") Signed-off-by: Ilya Leoshkevich --- target/s390x/tcg/translate.c | 2 +- 1 file

[PATCH 3/3] tests/tcg/s390x: Test BRASL and BRCL with large negative offsets

2022-03-11 Thread Ilya Leoshkevich
Add a small test in order to prevent regressions. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.target| 1 + tests/tcg/s390x/branch-relative-long.c | 29 ++ 2 files changed, 30 insertions(+) create mode 100644 tests/tcg/s390x/branch-relative

[PATCH 0/3] Fix BRASL and BRCL with large negative offsets

2022-03-11 Thread Ilya Leoshkevich
Hi, I noticed that sometimes jumping backwards leads to crashes or hangs. The problem is a missing cast. Patches 1 and 2 fix the problem, patch 3 adds a test. Best regards, Ilya Ilya Leoshkevich (3): s390x/tcg: Fix BRASL with a large negative offset s390x/tcg: Fix BRCL with a large negative

[PATCH v4 4/5] target/s390x: Fix shifting 32-bit values for more than 31 bits

2022-01-12 Thread Ilya Leoshkevich
and sh64 and adapting CC calculation to shift values greater than 31. Fixes: cbe24bfa91d2 ("target-s390: Convert SHIFT, ROTATE SINGLE") Signed-off-by: Ilya Leoshkevich --- target/s390x/cpu-dump.c| 3 +-- target/s390x/s390x-internal.h | 3 +-- target/s390x/tcg/cc_helpe

[PATCH v4 2/5] target/s390x: Fix SRDA CC calculation

2022-01-12 Thread Ilya Leoshkevich
SRDA uses r1_D32 for binding the first operand and s64 for setting CC. cout_s64() relies on o->out being the shift result, however, wout_r1_D32() clobbers it. Fix by using a temporary. Fixes: a79ba3398a0a ("target-s390: Convert SHIFT DOUBLE") Signed-off-by: Ilya Leoshkevich ---

[PATCH v4 0/5] target/s390x: Fix shift instructions

2022-01-12 Thread Ilya Leoshkevich
bit index. Inline help_l2_shift(). Fix wout_r1_D32(). Add all shift instructions to the test. Split the series. Ilya Leoshkevich (5): target/s390x: Fix SLDA sign bit index target/s390x: Fix SRDA CC calculation target/s390x: Fix cc_calc_sla_64() missing

[PATCH v4 1/5] target/s390x: Fix SLDA sign bit index

2022-01-12 Thread Ilya Leoshkevich
SLDA operates on 64-bit values, so its sign bit index should be 63, not 31. Fixes: a79ba3398a0a ("target-s390: Convert SHIFT DOUBLE") Reported-by: David Hildenbrand Signed-off-by: Ilya Leoshkevich Reviewed-by: David Hildenbrand --- target/s390x/tcg/insn-data.def | 2 +- 1 file

[PATCH v4 5/5] tests/tcg/s390x: Test shift instructions

2022-01-12 Thread Ilya Leoshkevich
Add a test for each shift instruction in order to to prevent regressions. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.target | 1 + tests/tcg/s390x/shift.c | 270 2 files changed, 271 insertions(+) create mode 100644 tests/tcg/s390x

[PATCH v4 3/5] target/s390x: Fix cc_calc_sla_64() missing overflows

2022-01-12 Thread Ilya Leoshkevich
INGLE") Co-developed-by: David Hildenbrand Signed-off-by: Ilya Leoshkevich --- target/s390x/tcg/cc_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/s390x/tcg/cc_helper.c b/target/s390x/tcg/cc_helper.c index c2c96c3a3c..c9b7b0e8c6 100644 --- a/target

Re: [PATCH v2 3/5] target/s390x: Fix cc_calc_sla_64() missing overflows

2022-01-12 Thread Ilya Leoshkevich
On Wed, 2022-01-12 at 16:45 +0100, David Hildenbrand wrote: > > > If the sign is false, the shifted bits (mask) have to be 0. > > > If the sign bit is true, the shifted bits (mask) have to be set. > > > > IIUC this logic handles sign bit + "shift - 1" bits. So if the last > > shifted bit is

[PATCH v3 4/5] target/s390x: Fix shifting 32-bit values for more than 31 bits

2022-01-12 Thread Ilya Leoshkevich
and sh64 and adapting CC calculation to shift values greater than 31. Fixes: cbe24bfa91d2 ("target-s390: Convert SHIFT, ROTATE SINGLE") Signed-off-by: Ilya Leoshkevich Reviewed-by: David Hildenbrand --- target/s390x/cpu-dump.c| 3 +-- target/s390x/s390x-internal.h | 3 +-- ta

[PATCH v3 1/5] target/s390x: Fix SLDA sign bit index

2022-01-12 Thread Ilya Leoshkevich
SLDA operates on 64-bit values, so its sign bit index should be 63, not 31. Fixes: a79ba3398a0a ("target-s390: Convert SHIFT DOUBLE") Reported-by: David Hildenbrand Signed-off-by: Ilya Leoshkevich Reviewed-by: David Hildenbrand --- target/s390x/tcg/insn-data.def | 2 +- 1 file

[PATCH v3 3/5] target/s390x: Fix cc_calc_sla_64() missing overflows

2022-01-12 Thread Ilya Leoshkevich
INGLE") Signed-off-by: Ilya Leoshkevich --- target/s390x/tcg/cc_helper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/s390x/tcg/cc_helper.c b/target/s390x/tcg/cc_helper.c index c2c96c3a3c..b6acffa3e8 100644 --- a/target/s390x/tcg/cc_helper.c +++ b/target

[PATCH v3 5/5] tests/tcg/s390x: Test shift instructions

2022-01-12 Thread Ilya Leoshkevich
Add a test for each shift instruction in order to to prevent regressions. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.target | 1 + tests/tcg/s390x/shift.c | 270 2 files changed, 271 insertions(+) create mode 100644 tests/tcg/s390x

[PATCH v3 2/5] target/s390x: Fix SRDA CC calculation

2022-01-12 Thread Ilya Leoshkevich
SRDA uses r1_D32 for binding the first operand and s64 for setting CC. cout_s64() relies on o->out being the shift result, however, wout_r1_D32() clobbers it. Fix by using a temporary. Fixes: a79ba3398a0a ("target-s390: Convert SHIFT DOUBLE") Signed-off-by: Ilya Leoshkevich Revie

[PATCH v3 0/5] target/s390x: Fix shift instructions

2022-01-12 Thread Ilya Leoshkevich
series. Ilya Leoshkevich (5): target/s390x: Fix SLDA sign bit index target/s390x: Fix SRDA CC calculation target/s390x: Fix cc_calc_sla_64() missing overflows target/s390x: Fix shifting 32-bit values for more than 31 bits tests/tcg/s390x: Test shift instructions target/s390x/cpu-

Re: [PATCH v2 3/5] target/s390x: Fix cc_calc_sla_64() missing overflows

2022-01-12 Thread Ilya Leoshkevich
On Wed, 2022-01-12 at 09:59 +0100, David Hildenbrand wrote: > On 12.01.22 05:39, Ilya Leoshkevich wrote: > > An overflow occurs for SLAG when at least one shifted bit is not > > equal > > to sign bit. Therefore, we need to check that `shift + 1` bits are > > neither all

[PATCH v2 4/5] target/s390x: Fix shifting 32-bit values for more than 31 bits

2022-01-11 Thread Ilya Leoshkevich
and sh64 and adapting cc_calc_sla_32() to shift values greater than 31. Fixes: cbe24bfa91d2 ("target-s390: Convert SHIFT, ROTATE SINGLE") Signed-off-by: Ilya Leoshkevich --- target/s390x/tcg/cc_helper.c | 32 +- target/s390x/tcg/insn-dat

Re: [PATCH] target/s390x: Fix 32-bit shifts

2022-01-11 Thread Ilya Leoshkevich
On Tue, 2022-01-11 at 15:22 +0100, David Hildenbrand wrote: > On 10.01.22 19:59, Ilya Leoshkevich wrote: > > Both 32- and 64-bit shifts use lowest 6 address bits. The current > > code > > special-cases 32-bit shifts to use only 5 bits, which is not > > correct. > >

[PATCH v2 3/5] target/s390x: Fix cc_calc_sla_64() missing overflows

2022-01-11 Thread Ilya Leoshkevich
INGLE") Signed-off-by: Ilya Leoshkevich --- target/s390x/tcg/cc_helper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/s390x/tcg/cc_helper.c b/target/s390x/tcg/cc_helper.c index c2c96c3a3c..b6acffa3e8 100644 --- a/target/s390x/tcg/cc_helper.c +++ b/target

[PATCH v2 5/5] tests/tcg/s390x: Test shift instructions

2022-01-11 Thread Ilya Leoshkevich
Add a test for each shift instruction in order to to prevent regressions. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.target | 1 + tests/tcg/s390x/shift.c | 258 2 files changed, 259 insertions(+) create mode 100644 tests/tcg/s390x

[PATCH v2 2/5] target/s390x: Fix SRDA CC calculation

2022-01-11 Thread Ilya Leoshkevich
SRDA uses r1_D32 for binding the first operand and s64 for setting CC. cout_s64() relies on o->out being the shift result, however, wout_r1_D32() clobbers it. Fix by using a temporary. Fixes: a79ba3398a0a ("target-s390: Convert SHIFT DOUBLE") Signed-off-by: Ilya Leoshkevich ---

[PATCH v2 0/5] target/s390x: Fix shift instructions

2022-01-11 Thread Ilya Leoshkevich
est. Split the series. Ilya Leoshkevich (5): target/s390x: Fix SLDA sign bit index target/s390x: Fix SRDA CC calculation target/s390x: Fix cc_calc_sla_64() missing overflows target/s390x: Fix shifting 32-bit values for more than 31 bits tests/tcg/s390x: Test shift instructions target/s3

[PATCH v2 1/5] target/s390x: Fix SLDA sign bit index

2022-01-11 Thread Ilya Leoshkevich
David Hildenbrand noticed that sign bit index for SLDA is wrong: since SLDA operates on 64-bit values, it should be 63, not 31. Fixes: a79ba3398a0a ("target-s390: Convert SHIFT DOUBLE") Signed-off-by: Ilya Leoshkevich --- target/s390x/tcg/insn-data.def | 2 +- 1 file changed, 1 inser

[PATCH] target/s390x: Fix 32-bit shifts

2022-01-10 Thread Ilya Leoshkevich
Both 32- and 64-bit shifts use lowest 6 address bits. The current code special-cases 32-bit shifts to use only 5 bits, which is not correct. Fix by merging sh32 and sh64. Fixes: cbe24bfa91d2 ("target-s390: Convert SHIFT, ROTATE SINGLE") Signed-off-by: Ilya Leoshkevich --- target/s390

PING [PATCH v2] accel/tcg/user-exec: Fix read-modify-write of code on s390 hosts

2021-09-08 Thread Ilya Leoshkevich
On Wed, 2021-08-04 at 00:16 +0200, Ilya Leoshkevich wrote: > x86_64 dotnet/runtime uses cmpxchg for code patching. When running it > under s390x qemu-linux user, cpu_signal_handler() does not recognize > this as a write and does not restore PAGE_WRITE cleared by > tb_page_add(),

Re: [PATCH v8] tests/tcg/s390x: Test SIGILL and SIGSEGV handling

2021-08-06 Thread Ilya Leoshkevich
On Fri, 2021-08-06 at 07:25 +0200, Thomas Huth wrote: > On 05/08/2021 00.51, Ilya Leoshkevich wrote: > > Verify that s390x-specific uc_mcontext.psw.addr is reported > > correctly > > and that signal handling interacts properly with debugging. > > > >

[PATCH v3] accel/tcg: Clear PAGE_WRITE before translation

2021-08-05 Thread Ilya Leoshkevich
. [1] https://lists.nongnu.org/archive/html/qemu-devel/2021-08/msg00644.html Signed-off-by: Ilya Leoshkevich --- v2: https://lists.nongnu.org/archive/html/qemu-devel/2021-08/msg00819.html v2 -> v3: Move translator_ld*_swap() functions from translator.h into translator.c for a bet

Re: [PATCH RFC 1/1] accel/tcg: Clear PAGE_WRITE before translation

2021-08-05 Thread Ilya Leoshkevich
On Thu, 2021-08-05 at 06:59 -1000, Richard Henderson wrote: > On 8/5/21 12:56 AM, Ilya Leoshkevich wrote: > > On Wed, 2021-08-04 at 14:30 -1000, Richard Henderson wrote: > > > I think that the translator_ld*_swap functions should be moved > > > out of > > > incl

[PATCH v2] accel/tcg: Clear PAGE_WRITE before translation

2021-08-05 Thread Ilya Leoshkevich
://lists.nongnu.org/archive/html/qemu-devel/2021-08/msg00644.html Signed-off-by: Ilya Leoshkevich --- v1: https://lists.nongnu.org/archive/html/qemu-devel/2021-08/msg00712.html v1 -> v2: Clear PAGE_WRITE for the initial page and then on each read that crosses a page boundary (Rich

Re: [PATCH RFC 1/1] accel/tcg: Clear PAGE_WRITE before translation

2021-08-05 Thread Ilya Leoshkevich
On Wed, 2021-08-04 at 14:30 -1000, Richard Henderson wrote: > On 8/4/21 12:46 PM, Ilya Leoshkevich wrote: > > translate_insn() implementations fetch instruction bytes piecemeal, > > which can cause qemu-user to generate inconsistent translations if > > another thread modifies

Re: [PATCH v8] tests/tcg/s390x: Test SIGILL and SIGSEGV handling

2021-08-05 Thread Ilya Leoshkevich
On Thu, 2021-08-05 at 11:37 +0200, David Hildenbrand wrote: > On 05.08.21 00:51, Ilya Leoshkevich wrote: > > Verify that s390x-specific uc_mcontext.psw.addr is reported > > correctly > > and that signal handling interacts properly with debugging. > > > >

[PATCH v8] tests/tcg/s390x: Test SIGILL and SIGSEGV handling

2021-08-04 Thread Ilya Leoshkevich
Verify that s390x-specific uc_mcontext.psw.addr is reported correctly and that signal handling interacts properly with debugging. Signed-off-by: Ilya Leoshkevich --- v7: https://lists.nongnu.org/archive/html/qemu-devel/2021-08/msg00463.html v7 -> v8: Another rebase needed due to the confl

[PATCH RFC 1/1] accel/tcg: Clear PAGE_WRITE before translation

2021-08-04 Thread Ilya Leoshkevich
/2021-08/msg00644.html Signed-off-by: Ilya Leoshkevich --- accel/tcg/translate-all.c| 59 +--- accel/tcg/translator.c | 26 ++-- include/exec/translate-all.h | 1 + 3 files changed, 59 insertions(+), 27 deletions(-) diff --git a/accel/tcg

[PATCH RFC 0/1] accel/tcg: Clear PAGE_WRITE before translation

2021-08-04 Thread Ilya Leoshkevich
talking about user-only, where translation is always serial. stsquad: the link from january is a system-mode bug of the same kind, where, yes, we need to hold the page lock or something. rth: ahh yes because we don't have zoned translation caches... Ilya Leoshkevich (1): accel/tcg: Clear

Cross-thread code patching and qemu-x86_64

2021-08-04 Thread Ilya Leoshkevich
Hello, I'm trying to run a .NET app with qemu-x86_64 on a s390x host. With a few fixes posted earlier it works for a while and then crashes like this: (gdb) x/8i $pc-6 0x3f8ab23ef8:jmpq 0x3f87d2c5e0 0x3f8ab23efd:pop%rdi => 0x3f8ab23efe:sub(%rdx),%al

[PATCH v2] accel/tcg/user-exec: Fix read-modify-write of code on s390 hosts

2021-08-03 Thread Ilya Leoshkevich
x86_64 dotnet/runtime uses cmpxchg for code patching. When running it under s390x qemu-linux user, cpu_signal_handler() does not recognize this as a write and does not restore PAGE_WRITE cleared by tb_page_add(), incorrectly forwarding the signal to the guest code. Signed-off-by: Ilya Leoshkevich

[PATCH] accel/tcg/user-exec: Fix read-modify-write of code on s390 hosts

2021-08-03 Thread Ilya Leoshkevich
x86_64 dotnet/runtime uses cmpxchg for code patching. When running it under s390x qemu-linux user, cpu_signal_handler() does not recognize this as a write and does not restore PAGE_WRITE cleared by tb_page_add(), incorrectly forwarding the signal to the guest code. Signed-off-by: Ilya Leoshkevich

[PATCH v7] tests/tcg/s390x: Test SIGILL and SIGSEGV handling

2021-08-03 Thread Ilya Leoshkevich
Verify that s390x-specific uc_mcontext.psw.addr is reported correctly and that signal handling interacts properly with debugging. Signed-off-by: Ilya Leoshkevich --- v6: https://lists.nongnu.org/archive/html/qemu-devel/2021-07/msg00873.html v6 -> v7: Rebased. tests/tcg/s390x/Makefile.tar

[PATCH] linux-user/elfload: byteswap i386 registers when dumping core

2021-08-03 Thread Ilya Leoshkevich
Core dumps from emulating x86_64 on big-endian hosts contain incorrect register values. Signed-off-by: Ilya Leoshkevich --- linux-user/elfload.c | 88 ++-- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/linux-user/elfload.c b/linux-user

[PATCH] linux-user: fix guest/host address mixup in i386 setup_rt_frame()

2021-08-03 Thread Ilya Leoshkevich
setup_rt_frame() passes siginfo and ucontext host addresses to guest signal handlers, causing problems when e.g. emulating x86_64 on s390x. Signed-off-by: Ilya Leoshkevich --- linux-user/i386/signal.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/linux-user/i386

Re: [PATCH PING] tests/tcg/linux-test: Fix random hangs in test_socket

2021-07-28 Thread Ilya Leoshkevich
On Tue, 2021-06-01 at 16:20 +0200, Ilya Leoshkevich wrote: > test_socket hangs randomly in connect(), especially when run without > qemu. Apparently the reason is that linux started treating backlog > value of 0 literally instead of rounding it up since v4.4 (commit > ef547f2ac16b).

Re: [PATCH v6 2/2] tests/tcg/s390x: Test SIGILL and SIGSEGV handling

2021-07-26 Thread Ilya Leoshkevich
On Mon, 2021-07-05 at 23:04 +0200, Ilya Leoshkevich wrote: > Verify that s390x-specific uc_mcontext.psw.addr is reported correctly > and that signal handling interacts properly with debugging. > > Signed-off-by: Ilya Leoshkevich > --- >  tests/tcg/s390x/Makefile.target  

Re: [PATCH v5 0/2] target/s390x: Fix SIGILL/SIGFPE/SIGTRAP psw.addr reporting

2021-07-12 Thread Ilya Leoshkevich
On Mon, 2021-07-12 at 10:59 -0400, jonathan.albrecht wrote: > On 2021-07-02 8:01 am, Laurent Vivier wrote: > > Le 02/07/2021 à 12:34, Cornelia Huck a écrit : > > > On Wed, Jun 23 2021, Ilya Leoshkevich wrote: > > > > > > > > > What's the st

<    4   5   6   7   8   9   10   >