Message ID | 20180629145347.652-41-peter.maydell@linaro.org |
---|---|
State | New |
Headers | show |
Series | [PULL,01/55] hw/block/fdc: Replace error_setg(&error_abort) by assert() | expand |
On 29/06/2018 16:53, Peter Maydell wrote: > From: Richard Henderson <richard.henderson@linaro.org> > > Enable ARM_FEATURE_SVE for the generic "max" cpu. > > Tested-by: Alex Bennée <alex.bennee@linaro.org> > Reviewed-by: Peter Maydell <peter.maydell@linaro.org> > Signed-off-by: Richard Henderson <richard.henderson@linaro.org> > Message-id: 20180627043328.11531-35-richard.henderson@linaro.org > Signed-off-by: Peter Maydell <peter.maydell@linaro.org> > --- > linux-user/elfload.c | 1 + > target/arm/cpu.c | 7 +++++++ > target/arm/cpu64.c | 1 + > 3 files changed, 9 insertions(+) > > diff --git a/linux-user/elfload.c b/linux-user/elfload.c > index 13bc78d0c86..d1231ad07a3 100644 > --- a/linux-user/elfload.c > +++ b/linux-user/elfload.c > @@ -584,6 +584,7 @@ static uint32_t get_elf_hwcap(void) > GET_FEATURE(ARM_FEATURE_V8_ATOMICS, ARM_HWCAP_A64_ATOMICS); > GET_FEATURE(ARM_FEATURE_V8_RDM, ARM_HWCAP_A64_ASIMDRDM); > GET_FEATURE(ARM_FEATURE_V8_FCMA, ARM_HWCAP_A64_FCMA); > + GET_FEATURE(ARM_FEATURE_SVE, ARM_HWCAP_A64_SVE); > #undef GET_FEATURE > > return hwcaps; > diff --git a/target/arm/cpu.c b/target/arm/cpu.c > index 2ae4fffafb9..6dcc552e143 100644 > --- a/target/arm/cpu.c > +++ b/target/arm/cpu.c > @@ -164,6 +164,13 @@ static void arm_cpu_reset(CPUState *s) > env->cp15.sctlr_el[1] |= SCTLR_UCT | SCTLR_UCI | SCTLR_DZE; > /* and to the FP/Neon instructions */ > env->cp15.cpacr_el1 = deposit64(env->cp15.cpacr_el1, 20, 2, 3); > + /* and to the SVE instructions */ > + env->cp15.cpacr_el1 = deposit64(env->cp15.cpacr_el1, 16, 2, 3); > + env->cp15.cptr_el[3] |= CPTR_EZ; > + /* with maximum vector length */ > + env->vfp.zcr_el[1] = ARM_MAX_VQ - 1; > + env->vfp.zcr_el[2] = ARM_MAX_VQ - 1; > + env->vfp.zcr_el[3] = ARM_MAX_VQ - 1; > #else > /* Reset into the highest available EL */ > if (arm_feature(env, ARM_FEATURE_EL3)) { > diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c > index c50dcd4077d..0360d7efc5e 100644 > --- a/target/arm/cpu64.c > +++ b/target/arm/cpu64.c > @@ -252,6 +252,7 @@ static void aarch64_max_initfn(Object *obj) > set_feature(&cpu->env, ARM_FEATURE_V8_RDM); > set_feature(&cpu->env, ARM_FEATURE_V8_FP16); > set_feature(&cpu->env, ARM_FEATURE_V8_FCMA); > + set_feature(&cpu->env, ARM_FEATURE_SVE); > /* For usermode -cpu max we can use a larger and more efficient DCZ > * blocksize since we don't have to follow what the hardware does. > */ > Running some tests for my pull request, I've found this commit breaks ltp-full-20180515 sigaltstack01 tests with ubuntu arm64/trusty. sigaltstack01 274 TBROK : tst_sig.c:233: unexpected signal SIGIOT/SIGABRT(6) received (pid = 15241). *** Error in `/opt/ltp/testcases/bin/sigaltstack01': free(): invalid pointer: 0x000000000042a010 *** Thanks, Laurent
Laurent Vivier <lvivier@redhat.com> writes: > On 29/06/2018 16:53, Peter Maydell wrote: >> From: Richard Henderson <richard.henderson@linaro.org> >> >> Enable ARM_FEATURE_SVE for the generic "max" cpu. >> >> Tested-by: Alex Bennée <alex.bennee@linaro.org> >> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> >> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> >> Message-id: 20180627043328.11531-35-richard.henderson@linaro.org >> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> >> --- >> linux-user/elfload.c | 1 + >> target/arm/cpu.c | 7 +++++++ >> target/arm/cpu64.c | 1 + >> 3 files changed, 9 insertions(+) >> >> diff --git a/linux-user/elfload.c b/linux-user/elfload.c >> index 13bc78d0c86..d1231ad07a3 100644 >> --- a/linux-user/elfload.c >> +++ b/linux-user/elfload.c >> @@ -584,6 +584,7 @@ static uint32_t get_elf_hwcap(void) >> GET_FEATURE(ARM_FEATURE_V8_ATOMICS, ARM_HWCAP_A64_ATOMICS); >> GET_FEATURE(ARM_FEATURE_V8_RDM, ARM_HWCAP_A64_ASIMDRDM); >> GET_FEATURE(ARM_FEATURE_V8_FCMA, ARM_HWCAP_A64_FCMA); >> + GET_FEATURE(ARM_FEATURE_SVE, ARM_HWCAP_A64_SVE); >> #undef GET_FEATURE >> >> return hwcaps; >> diff --git a/target/arm/cpu.c b/target/arm/cpu.c >> index 2ae4fffafb9..6dcc552e143 100644 >> --- a/target/arm/cpu.c >> +++ b/target/arm/cpu.c >> @@ -164,6 +164,13 @@ static void arm_cpu_reset(CPUState *s) >> env->cp15.sctlr_el[1] |= SCTLR_UCT | SCTLR_UCI | SCTLR_DZE; >> /* and to the FP/Neon instructions */ >> env->cp15.cpacr_el1 = deposit64(env->cp15.cpacr_el1, 20, 2, 3); >> + /* and to the SVE instructions */ >> + env->cp15.cpacr_el1 = deposit64(env->cp15.cpacr_el1, 16, 2, 3); >> + env->cp15.cptr_el[3] |= CPTR_EZ; >> + /* with maximum vector length */ >> + env->vfp.zcr_el[1] = ARM_MAX_VQ - 1; >> + env->vfp.zcr_el[2] = ARM_MAX_VQ - 1; >> + env->vfp.zcr_el[3] = ARM_MAX_VQ - 1; >> #else >> /* Reset into the highest available EL */ >> if (arm_feature(env, ARM_FEATURE_EL3)) { >> diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c >> index c50dcd4077d..0360d7efc5e 100644 >> --- a/target/arm/cpu64.c >> +++ b/target/arm/cpu64.c >> @@ -252,6 +252,7 @@ static void aarch64_max_initfn(Object *obj) >> set_feature(&cpu->env, ARM_FEATURE_V8_RDM); >> set_feature(&cpu->env, ARM_FEATURE_V8_FP16); >> set_feature(&cpu->env, ARM_FEATURE_V8_FCMA); >> + set_feature(&cpu->env, ARM_FEATURE_SVE); >> /* For usermode -cpu max we can use a larger and more efficient DCZ >> * blocksize since we don't have to follow what the hardware does. >> */ >> > > Running some tests for my pull request, I've found this commit breaks > ltp-full-20180515 sigaltstack01 tests with ubuntu arm64/trusty. > > sigaltstack01 274 TBROK : tst_sig.c:233: unexpected signal > SIGIOT/SIGABRT(6) received (pid = 15241). > *** Error in `/opt/ltp/testcases/bin/sigaltstack01': free(): invalid > pointer: 0x000000000042a010 *** I wonder if that is the test case not handling the full frame size (or us not checking the allocated size). What syscall or signal delivery was happening at the time? > > Thanks, > Laurent -- Alex Bennée
On 12/11/2018 23:12, Alex Bennée wrote: > > Laurent Vivier <lvivier@redhat.com> writes: > >> On 29/06/2018 16:53, Peter Maydell wrote: >>> From: Richard Henderson <richard.henderson@linaro.org> >>> >>> Enable ARM_FEATURE_SVE for the generic "max" cpu. >>> >>> Tested-by: Alex Bennée <alex.bennee@linaro.org> >>> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> >>> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> >>> Message-id: 20180627043328.11531-35-richard.henderson@linaro.org >>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> >>> --- >>> linux-user/elfload.c | 1 + >>> target/arm/cpu.c | 7 +++++++ >>> target/arm/cpu64.c | 1 + >>> 3 files changed, 9 insertions(+) >>> >>> diff --git a/linux-user/elfload.c b/linux-user/elfload.c >>> index 13bc78d0c86..d1231ad07a3 100644 >>> --- a/linux-user/elfload.c >>> +++ b/linux-user/elfload.c >>> @@ -584,6 +584,7 @@ static uint32_t get_elf_hwcap(void) >>> GET_FEATURE(ARM_FEATURE_V8_ATOMICS, ARM_HWCAP_A64_ATOMICS); >>> GET_FEATURE(ARM_FEATURE_V8_RDM, ARM_HWCAP_A64_ASIMDRDM); >>> GET_FEATURE(ARM_FEATURE_V8_FCMA, ARM_HWCAP_A64_FCMA); >>> + GET_FEATURE(ARM_FEATURE_SVE, ARM_HWCAP_A64_SVE); >>> #undef GET_FEATURE >>> >>> return hwcaps; >>> diff --git a/target/arm/cpu.c b/target/arm/cpu.c >>> index 2ae4fffafb9..6dcc552e143 100644 >>> --- a/target/arm/cpu.c >>> +++ b/target/arm/cpu.c >>> @@ -164,6 +164,13 @@ static void arm_cpu_reset(CPUState *s) >>> env->cp15.sctlr_el[1] |= SCTLR_UCT | SCTLR_UCI | SCTLR_DZE; >>> /* and to the FP/Neon instructions */ >>> env->cp15.cpacr_el1 = deposit64(env->cp15.cpacr_el1, 20, 2, 3); >>> + /* and to the SVE instructions */ >>> + env->cp15.cpacr_el1 = deposit64(env->cp15.cpacr_el1, 16, 2, 3); >>> + env->cp15.cptr_el[3] |= CPTR_EZ; >>> + /* with maximum vector length */ >>> + env->vfp.zcr_el[1] = ARM_MAX_VQ - 1; >>> + env->vfp.zcr_el[2] = ARM_MAX_VQ - 1; >>> + env->vfp.zcr_el[3] = ARM_MAX_VQ - 1; >>> #else >>> /* Reset into the highest available EL */ >>> if (arm_feature(env, ARM_FEATURE_EL3)) { >>> diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c >>> index c50dcd4077d..0360d7efc5e 100644 >>> --- a/target/arm/cpu64.c >>> +++ b/target/arm/cpu64.c >>> @@ -252,6 +252,7 @@ static void aarch64_max_initfn(Object *obj) >>> set_feature(&cpu->env, ARM_FEATURE_V8_RDM); >>> set_feature(&cpu->env, ARM_FEATURE_V8_FP16); >>> set_feature(&cpu->env, ARM_FEATURE_V8_FCMA); >>> + set_feature(&cpu->env, ARM_FEATURE_SVE); >>> /* For usermode -cpu max we can use a larger and more efficient DCZ >>> * blocksize since we don't have to follow what the hardware does. >>> */ >>> >> >> Running some tests for my pull request, I've found this commit breaks >> ltp-full-20180515 sigaltstack01 tests with ubuntu arm64/trusty. >> >> sigaltstack01 274 TBROK : tst_sig.c:233: unexpected signal >> SIGIOT/SIGABRT(6) received (pid = 15241). >> *** Error in `/opt/ltp/testcases/bin/sigaltstack01': free(): invalid >> pointer: 0x000000000042a010 *** > > I wonder if that is the test case not handling the full frame size (or > us not checking the allocated size). What syscall or signal delivery was > happening at the time? > The signal is an abort() triggered by the libc. But I think the first problem happens because memory is corrupted: it crashes in the cleanup() function when the test is over and the memory is freed. #4149 <signal handler called> #4150 __GI_abort () at abort.c:91 #4151 0x00000040008a1448 in __libc_message (do_abort=1, fmt=fmt@entry=0x4000950cb0 "*** Error in `%s': %s: 0x%s ***\n") at ../sysdeps/posix/libc_fatal.c:175 #4152 0x00000040008ab71c in malloc_printerr (action=1, str=0x4000950ed8 "free(): invalid pointer", ptr=<optimized out>) at malloc.c:4996 #4153 0x00000040008ac4f4 in _int_free (av=0x400097a560 <main_arena>, p=<optimized out>, have_lock=0) at malloc.c:3840 #4154 0x0000000000403340 in cleanup () at sigaltstack01.c:236 #4155 main (ac=<optimized out>, av=<optimized out>) at sigaltstack01.c:165 233 void cleanup(void) 234 { 235 236 free(sigstk.ss_sp); 237 238 } Thanks, Laurent
On 11/12/18 10:10 PM, Laurent Vivier wrote: > Running some tests for my pull request, I've found this commit breaks > ltp-full-20180515 sigaltstack01 tests with ubuntu arm64/trusty. > > sigaltstack01 274 TBROK : tst_sig.c:233: unexpected signal > SIGIOT/SIGABRT(6) received (pid = 15241). > *** Error in `/opt/ltp/testcases/bin/sigaltstack01': free(): invalid > pointer: 0x000000000042a010 *** How exactly does one reproduce this failure? $ ~/qemu/bld/aarch64-linux-user/qemu-aarch64 -cpu max ./testcases/kernel/syscalls/sigaltstack/sigaltstack01 sigaltstack01 1 TPASS : Functionality of sigaltstack() successful r~
On 11/12/18 10:10 PM, Laurent Vivier wrote: > Running some tests for my pull request, I've found this commit breaks > ltp-full-20180515 sigaltstack01 tests with ubuntu arm64/trusty. Hmm. Just noticed this part -- my pass came from ubuntu arm64/bionic. Do you believe that the glibc version plays enough of a part in this? r~
On 13/11/2018 10:49, Richard Henderson wrote: > On 11/12/18 10:10 PM, Laurent Vivier wrote: >> Running some tests for my pull request, I've found this commit breaks >> ltp-full-20180515 sigaltstack01 tests with ubuntu arm64/trusty. >> >> sigaltstack01 274 TBROK : tst_sig.c:233: unexpected signal >> SIGIOT/SIGABRT(6) received (pid = 15241). >> *** Error in `/opt/ltp/testcases/bin/sigaltstack01': free(): invalid >> pointer: 0x000000000042a010 *** > > How exactly does one reproduce this failure? > > $ ~/qemu/bld/aarch64-linux-user/qemu-aarch64 -cpu max > ./testcases/kernel/syscalls/sigaltstack/sigaltstack01 > sigaltstack01 1 TPASS : Functionality of sigaltstack() successful For me it happens only with Ubuntu trusty: sudo chroot chroot/arm64/trusty /opt/ltp/testcases/bin/sigaltstack01 Thanks, Laurent
On 13/11/2018 10:51, Richard Henderson wrote: > On 11/12/18 10:10 PM, Laurent Vivier wrote: >> Running some tests for my pull request, I've found this commit breaks >> ltp-full-20180515 sigaltstack01 tests with ubuntu arm64/trusty. > > Hmm. Just noticed this part -- my pass came from ubuntu arm64/bionic. > Do you believe that the glibc version plays enough of a part in this? Probably, or the compiler? $ cat /etc/apt/sources.list deb http://ports.ubuntu.com/ubuntu-ports/ trusty main $ dpkg --status gcc Package: gcc Status: install ok installed Priority: optional Section: devel Installed-Size: 41 Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> Architecture: arm64 Source: gcc-defaults (1.124ubuntu6) Version: 4:4.8.2-1ubuntu6 Provides: c-compiler Depends: cpp (>= 4:4.8.2-1ubuntu6), gcc-4.8 (>= 4.8.2-5~) Recommends: libc6-dev | libc-dev Suggests: gcc-multilib, make, manpages-dev, autoconf, automake1.9, libtool, flex, bison, gdb, gcc-doc Conflicts: gcc-doc (<< 1:2.95.3) Description: GNU C compiler This is the GNU C compiler, a fairly portable optimizing compiler for C. . This is a dependency package providing the default GNU C compiler. Original-Maintainer: Debian GCC Maintainers <debian-gcc@lists.debian.org> $ dpkg --status libc6 Package: libc6 Status: install ok installed Priority: required Section: libs Installed-Size: 9225 Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> Architecture: arm64 Multi-Arch: same Source: eglibc Version: 2.19-0ubuntu6 Provides: glibc-2.19-1 Depends: libgcc1 Suggests: glibc-doc, debconf | debconf-2.0, locales Breaks: hurd (<< 1:0.5.git20140203-1), nscd (<< 2.19) Conflicts: prelink (<= 0.0.20090311-1), tzdata (<< 2007k-1), tzdata-etch Conffiles: /etc/ld.so.conf.d/aarch64-linux-gnu.conf d69324714eb19058cc7bb5e854a427ca Description: Embedded GNU C Library: Shared libraries Contains the standard libraries that are used by nearly all programs on the system. This package includes shared versions of the standard C library and the standard math library, as well as many others. Homepage: http://www.eglibc.org Original-Maintainer: GNU Libc Maintainers <debian-glibc@lists.debian.org> thanks, Laurent
diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 13bc78d0c86..d1231ad07a3 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -584,6 +584,7 @@ static uint32_t get_elf_hwcap(void) GET_FEATURE(ARM_FEATURE_V8_ATOMICS, ARM_HWCAP_A64_ATOMICS); GET_FEATURE(ARM_FEATURE_V8_RDM, ARM_HWCAP_A64_ASIMDRDM); GET_FEATURE(ARM_FEATURE_V8_FCMA, ARM_HWCAP_A64_FCMA); + GET_FEATURE(ARM_FEATURE_SVE, ARM_HWCAP_A64_SVE); #undef GET_FEATURE return hwcaps; diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 2ae4fffafb9..6dcc552e143 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -164,6 +164,13 @@ static void arm_cpu_reset(CPUState *s) env->cp15.sctlr_el[1] |= SCTLR_UCT | SCTLR_UCI | SCTLR_DZE; /* and to the FP/Neon instructions */ env->cp15.cpacr_el1 = deposit64(env->cp15.cpacr_el1, 20, 2, 3); + /* and to the SVE instructions */ + env->cp15.cpacr_el1 = deposit64(env->cp15.cpacr_el1, 16, 2, 3); + env->cp15.cptr_el[3] |= CPTR_EZ; + /* with maximum vector length */ + env->vfp.zcr_el[1] = ARM_MAX_VQ - 1; + env->vfp.zcr_el[2] = ARM_MAX_VQ - 1; + env->vfp.zcr_el[3] = ARM_MAX_VQ - 1; #else /* Reset into the highest available EL */ if (arm_feature(env, ARM_FEATURE_EL3)) { diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index c50dcd4077d..0360d7efc5e 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -252,6 +252,7 @@ static void aarch64_max_initfn(Object *obj) set_feature(&cpu->env, ARM_FEATURE_V8_RDM); set_feature(&cpu->env, ARM_FEATURE_V8_FP16); set_feature(&cpu->env, ARM_FEATURE_V8_FCMA); + set_feature(&cpu->env, ARM_FEATURE_SVE); /* For usermode -cpu max we can use a larger and more efficient DCZ * blocksize since we don't have to follow what the hardware does. */