|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v2 5/5] tests: Introduce a TSX test
On 14.06.2021 18:13, Andrew Cooper wrote:
> --- /dev/null
> +++ b/tools/tests/tsx/test-tsx.c
> @@ -0,0 +1,538 @@
> +/*
> + * TSX settings and consistency tests
> + *
> + * This tests various behaviours and invariants with regards to TSX. It
> + * ideally wants running for several microcode versions, and all applicable
> + * tsx= commandline settings, on a single CPU, including after an S3
> + * suspend/resume event.
> + *
> + * It tests specifically:
> + * - The consistency of MSR_TSX_CTRL/MSR_TSX_FORCE_ABORT values across the
> + * system, and their accessibility WRT data in the host CPU policy.
> + * - The actual behaviour of RTM on the system.
> + * - Cross-check the default/max policies based on the actual RTM behaviour.
> + * - Create some guests, check their defaults, and check that the defaults
> + * can be changed.
> + */
> +
> +#define _GNU_SOURCE
> +
> +#include <err.h>
> +#include <errno.h>
> +#include <inttypes.h>
> +#include <signal.h>
> +#include <stdio.h>
> +#include <string.h>
> +#include <sys/mman.h>
> +#include <sys/ucontext.h>
> +
> +#include <xenctrl.h>
> +#include <xenguest.h>
> +#include <xen-tools/libs.h>
> +
> +#include "xg_private.h"
> +
> +enum {
> +#define XEN_CPUFEATURE(name, value) X86_FEATURE_##name = value,
> +#include <xen/arch-x86/cpufeatureset.h>
> +};
> +#define bitmaskof(idx) (1u << ((idx) & 31))
> +
> +#define MSR_ARCH_CAPABILITIES 0x0000010a
> +#define ARCH_CAPS_TSX_CTRL (1 << 7)
> +#define MSR_TSX_FORCE_ABORT 0x0000010f
> +#define MSR_TSX_CTRL 0x00000122
> +
> +static unsigned int nr_failures;
> +#define fail(fmt, ...) \
> +({ \
> + nr_failures++; \
> + (void)printf(fmt, ##__VA_ARGS__); \
fprintf(stderr, ...)?
Either way (and with the adjustment you pointed yourself out in reply)
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
Jan
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |