[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 5/5] tests: Introduce a TSX test


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 15 Jun 2021 15:49:21 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=L7Ef1FjiN7x1QXO4WGuChpDpELEzNJEDR5HVvEYj5Ps=; b=dKrCqU8qwc6EaNp0IzIaWN8aVCmbaYChXlx6QY4qMZuOXDnqaDmbkOi1+pstY7pzGWb4dRzFEhY/n26RirivL4WzHvIrOqzBevg1QFsKhKZDc2Il/gUVAdOCEx/9zlKtg1LuhOzKhH9FEaO8hPc6kkd8YDS3FcFSTkw7ZvoLd86GGu3LIfHutJ79glJmlgCBwEw916K1sG4o0xI89Zj75VfvMVBmgBtLBXtCSpCJlFy8Cu9hxuSLVD6i+nqt8z6tNHtv2SzqKxz3NB5gD5VDDkFfo0ZtqL9MA0kkFotA//zrhxODdGUR+nVVHOJQbMKIHxrxnxFEY6Y8SDOXPCi7Lg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jaZAaf/1k8x23YV5XgdVCSzALrmT8DfMOMLMo2M4A5pyRWnlxapu5EbHiUvx5nMC4twz0iNIcGm7SDkQSgpWAiYQt40xKJvHMeIblpw1OALcNKm5gdiTpmwP85T/hoOyKJ/7BoEkGvlSJvhTJKo99chHRvNG1X0pAqnuAV7WF1vkYA2PwxZpl6qUlLu7J9Yv69R+vANUKGT9FUrBk89jByjQg9acQcTTE30CLWXlUc7grA5MetueUed6MAckJ7XGVSAKu9xd2DqrefRVG59JOS1kh98gkkJ5HABwZB5nBvh4lGFhNhF3mz/tfqmNIHHdSz8q5sOIzh/45DLWhKW+Sw==
  • Authentication-results: lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=none action=none header.from=suse.com;
  • Cc: Igor Druzhinin <igor.druzhinin@xxxxxxxxxx>, Edwin Torok <edvin.torok@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 15 Jun 2021 13:49:34 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.