gem5: classify all test failures

To skip tests, create a decent list of "which instructions a test use"
and "which instructions each simulator does not support".
This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-11-05 00:00:00 +00:00
parent 5b67747214
commit 988289f766
2 changed files with 98 additions and 28 deletions

View File

@@ -3815,6 +3815,20 @@ However, in case something goes wrong, you can also try statically linked execut
* gem5 user mode currently only supports static executables as mentioned at: xref:gem5-syscall-emulation-mode[xrefstyle=full] * gem5 user mode currently only supports static executables as mentioned at: xref:gem5-syscall-emulation-mode[xrefstyle=full]
* QEMU x86_64 guest on x86_64 host was failing with <<stack-smashing-detected>>, but we found a workaround * QEMU x86_64 guest on x86_64 host was failing with <<stack-smashing-detected>>, but we found a workaround
Running statically linked executables sometimes makes things break:
* <<user-mode-static-executables-with-dynamic-libraries>>
* TODO understand why:
+
....
./run --static --userland userland/c/file_write_read.c
....
fails our assertion that the data was read back correctly:
+
....
Assertion `strcmp(data, output) == 0' faile
....
==== User mode static executables with dynamic libraries ==== User mode static executables with dynamic libraries
One limitation of static executables is that Buildroot mostly only builds dynamic versions of libraries (the libc is an exception). One limitation of static executables is that Buildroot mostly only builds dynamic versions of libraries (the libc is an exception).

View File

@@ -50,7 +50,8 @@ class PathProperties:
# We should get rid of this if we ever properly implement dependency graphs. # We should get rid of this if we ever properly implement dependency graphs.
'extra_objs_lkmc_common': False, 'extra_objs_lkmc_common': False,
'gem5_unimplemented_instruction': False, 'gem5_unimplemented_instruction': False,
'qemu_unimplemented_instruction': False, # Fully, or partially unimplemented.
'gem5_unimplemented_syscall': False,
# For some reason QEMU fails with SIGSEGV on int syscalls in x86_64. # For some reason QEMU fails with SIGSEGV on int syscalls in x86_64.
'qemu_x86_64_int_syscall': False, 'qemu_x86_64_int_syscall': False,
'interactive': False, 'interactive': False,
@@ -62,6 +63,7 @@ class PathProperties:
# it only generates intermediate object files. Therefore it # it only generates intermediate object files. Therefore it
# should not be run while testing. # should not be run while testing.
'no_executable': False, 'no_executable': False,
'qemu_unimplemented_instruction': False,
# The script requires a non-trivial to determine argument to be passed to run properly. # The script requires a non-trivial to determine argument to be passed to run properly.
'requires_argument': False, 'requires_argument': False,
# Let's not test stuff that relies on the internet by default, user might be offline, # Let's not test stuff that relies on the internet by default, user might be offline,
@@ -95,6 +97,34 @@ class PathProperties:
'test_run_args': {}, 'test_run_args': {},
# Examples that can be built in userland. # Examples that can be built in userland.
'userland': False, 'userland': False,
# Known instructions that this test uses, and which may not be implemented
# in a given simulator, in which case we skip.
'uses_instructions': {},
}
unimplemented_instructions = {
'gem5': {
'arm': {
'vcvta',
},
'x86_64': {
'fcomi',
'fcomip',
'fsqrt',
'popcnt',
'rdrand',
'rdtscp',
'vfmadd132pd',
},
},
'qemu': {
'x86_64': {
'popcnt',
'rdtscp',
'rdrand',
'vfmadd132pd',
}
},
} }
''' '''
@@ -160,6 +190,17 @@ class PathProperties:
# Our C compiler does not suppport SVE yet. # Our C compiler does not suppport SVE yet.
# https://cirosantilli.com/linux-kernel-module-cheat#update-gcc-gcc-supported-by-buildroot # https://cirosantilli.com/linux-kernel-module-cheat#update-gcc-gcc-supported-by-buildroot
os.path.splitext(self.path_components[-1])[1] == '.c' and self['arm_sve'] os.path.splitext(self.path_components[-1])[1] == '.c' and self['arm_sve']
) and not (
# C++ multithreading in static does not seem to work:
# https://cirosantilli.com/linux-kernel-module-cheat#user-mode-static-executables-with-dynamic-libraries
os.path.splitext(self.path_components[-1])[1] == '.cpp' and (
# TODO the better check here would be for 'static'
# to factor out with test-executable logic, but lazy.
# env['static'] and
env['emulator'] == 'gem5' and
'cpus' in self['test_run_args'] and
self['test_run_args']['cpus'] > 1
)
) )
) )
@@ -187,8 +228,8 @@ class PathProperties:
not ( not (
env['emulator'] == 'gem5' and env['emulator'] == 'gem5' and
( (
self['gem5_unimplemented_instruction'] or self['gem5_unimplemented_syscall'] or
# gem5 does not report signals properly. # https://github.com/cirosantilli/linux-kernel-module-cheat/issues/101
self['signal_received'] is not None or self['signal_received'] is not None or
self['requires_dynamic_library'] or self['requires_dynamic_library'] or
self['requires_semihosting'] or self['requires_semihosting'] or
@@ -198,8 +239,16 @@ class PathProperties:
not ( not (
env['emulator'] == 'qemu' and env['emulator'] == 'qemu' and
( (
self['requires_m5ops'] or self['requires_m5ops']
self['qemu_unimplemented_instruction'] )
) and
not (
env['arch'] in self['uses_instructions'] and
env['emulator'] in self.unimplemented_instructions and
env['arch'] in self.unimplemented_instructions[env['emulator']] and
(
self.unimplemented_instructions[env['emulator']][env['arch']] &
self['uses_instructions'][env['arch']]
) )
) )
) )
@@ -403,7 +452,7 @@ path_properties_tuples = (
}, },
'vcvta.S': { 'vcvta.S': {
'arm_aarch32': True, 'arm_aarch32': True,
'gem5_unimplemented_instruction': True, 'uses_instructions': {'arm': {'vcvta'}}
}, },
} }
), ),
@@ -450,32 +499,34 @@ path_properties_tuples = (
{}, {},
{ {
'freestanding': freestanding_properties, 'freestanding': freestanding_properties,
'sqrt_x87.c': {'uses_instructions': {'x86_64': {'fsqrt'}}},
} }
), ),
'intrinsics': ( 'intrinsics': (
{}, {},
{ {
'rdtscp.c': { 'rdtscp.c': {'uses_instructions': {'x86_64': {'rdtscp'}}},
'gem5_unimplemented_instruction': True,
'qemu_unimplemented_instruction': True,
},
} }
), ),
'div_overflow.S': {'signal_received': signal.Signals.SIGFPE}, 'div_overflow.S': {'signal_received': signal.Signals.SIGFPE},
'div_zero.S': {'signal_received': signal.Signals.SIGFPE}, 'div_zero.S': {'signal_received': signal.Signals.SIGFPE},
'fabs.S': {'uses_instructions': {'x86_64': {'fcomip'}}},
'fadd.S': {'uses_instructions': {'x86_64': {'fcomi'}}},
'faddp.S': {'uses_instructions': {'x86_64': {'fcomip'}}},
'fchs.S': {'uses_instructions': {'x86_64': {'fcomip'}}},
'fild.S': {'uses_instructions': {'x86_64': {'fcomip'}}},
'fld1.S': {'uses_instructions': {'x86_64': {'fcomip'}}},
'fldz.S': {'uses_instructions': {'x86_64': {'fcomip'}}},
'fscale.S': {'uses_instructions': {'x86_64': {'fcomip'}}},
'fsqrt.S': {'uses_instructions': {'x86_64': {'fcomip', 'fsqrt'}}},
'fxch.S': {'uses_instructions': {'x86_64': {'fcomip'}}},
'lkmc_assert_eq_fail.S': {'signal_received': signal.Signals.SIGABRT}, 'lkmc_assert_eq_fail.S': {'signal_received': signal.Signals.SIGABRT},
'lkmc_assert_memcmp_fail.S': {'signal_received': signal.Signals.SIGABRT}, 'lkmc_assert_memcmp_fail.S': {'signal_received': signal.Signals.SIGABRT},
'popcnt.S': {'qemu_unimplemented_instruction': True}, 'popcnt.S': {'uses_instructions': {'x86_64': {'popcnt'}}},
'rdrand.S': { 'rdrand.S': {'uses_instructions': {'x86_64': {'rdrand'}}},
'gem5_unimplemented_instruction': True, 'rdtscp.S': {'uses_instructions': {'x86_64': {'rdtscp'}}},
'qemu_unimplemented_instruction': True,
},
'rdtscp.S': {'qemu_unimplemented_instruction': True},
'ring0.c': {'signal_received': signal.Signals.SIGSEGV}, 'ring0.c': {'signal_received': signal.Signals.SIGSEGV},
'vfmadd132pd.S': { 'vfmadd132pd.S': {'uses_instructions': {'x86_64': {'vfmadd132pd'}}},
'gem5_unimplemented_instruction': True,
'qemu_unimplemented_instruction': True,
},
} }
), ),
'lkmc_assert_fail.S': { 'lkmc_assert_fail.S': {
@@ -506,14 +557,7 @@ path_properties_tuples = (
'cpp': ( 'cpp': (
{}, {},
{ {
'atomic.cpp': { 'atomic.cpp': {'test_run_args': {'cpus': 3}},
'test_run_args': {'cpus': 3},
# LDADD from LSE
# https://cirosantilli.com/linux-kernel-module-cheat#arm-lse
# Implemented on master:
# https://gem5-review.googlesource.com/c/public/gem5/+/19812
'gem5_unimplemented_instruction': True,
},
'count.cpp': {'more_than_1s': True}, 'count.cpp': {'more_than_1s': True},
'sleep_for.cpp': { 'sleep_for.cpp': {
'more_than_1s': True, 'more_than_1s': True,
@@ -544,8 +588,16 @@ path_properties_tuples = (
{ {
'ctrl_alt_del.c': {'requires_sudo': True}, 'ctrl_alt_del.c': {'requires_sudo': True},
'init_env_poweroff.c': {'requires_sudo': True}, 'init_env_poweroff.c': {'requires_sudo': True},
'mmap_anonymous_touch.c': {
# https://github.com/cirosantilli/linux-kernel-module-cheat/issues/103
'gem5_unimplemented_syscall': True
},
'myinsmod.c': {'requires_sudo': True}, 'myinsmod.c': {'requires_sudo': True},
'myrmmod.c': {'requires_sudo': True}, 'myrmmod.c': {'requires_sudo': True},
'open_o_tmpfile.c': {
# https://github.com/cirosantilli/linux-kernel-module-cheat/issues/100
'gem5_unimplemented_syscall': True
},
'pagemap_dump.c': {'requires_argument': True}, 'pagemap_dump.c': {'requires_argument': True},
'poweroff.c': {'requires_sudo': True}, 'poweroff.c': {'requires_sudo': True},
'proc_events.c': {'requires_sudo': True}, 'proc_events.c': {'requires_sudo': True},
@@ -575,6 +627,10 @@ path_properties_tuples = (
'pthread_self.c': { 'pthread_self.c': {
'test_run_args': {'cpus': 2}, 'test_run_args': {'cpus': 2},
}, },
'mmap_file.c': {
# https://github.com/cirosantilli/linux-kernel-module-cheat/issues/102
'gem5_unimplemented_syscall': True
},
'wget.c': {'requires_internet': True}, 'wget.c': {'requires_internet': True},
'sleep_forever.c': {'more_than_1s': True}, 'sleep_forever.c': {'more_than_1s': True},
'virt_to_phys_test.c': {'more_than_1s': True}, 'virt_to_phys_test.c': {'more_than_1s': True},