[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 10/21] tests/cpu-policy: add sorted MSR test
- To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
- Date: Tue, 13 Apr 2021 16:01:28 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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=QdjL53sxfL72OocLfvFBEO6t+rw9rfdKFRBd12scbro=; b=RzoL7xPis1aErWqhZMWfzxp0MhJGbRSVrXuX86GizC9zdFuKK5PrD4FW7oHCXQau+C6uQuOVvZH4brCz+uEb7+YKP8Pot+gOnl37hIRIja77ahoKD2fgjjZM0kD6nsTq7AespkDZxs7/b8O+fPwHhnfV3XztLiBomGtKguOsFJ3Iw6+vQDzEHqKHQVqKW1EtVGPp8mXg9QyXHoGBoJdzRu9xOgsLpXkudQQ+MwBrM1nF2hUH6BViTX3AwhV4r5kMxuOHY++sfnZ4zz3StiIDY7vS46ovsITJ4x7sfjqRd3CvgkkZWuMqklwGp76vOlFM8mz8XHDGy9pZ6ofWtlIdPQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LhusGuN/wA9Tg9JPTTttwO4yzdLd7ohDdhBwi6H2xR0DtA2q6lspK3C7RgcAfN95f3PM35XUBaHdYb2swDfzcButSV61nJQwjNKnSSDztIWaNpGOBnMv70KQeSqyl0Af0eX4E6149+V8TDC0CZ16t/QSj4csESHaSQ820g18qnVzm08Vga0Oro7hSI3r6yQlPSLJ37ADB3c/saCTwr5WTjecA7kZVaqYB8bnXZzwagAJ1AZT4OqOEAnmFCh/egOH48hXGe5ACH3ICKTbSGtavUNjVnEnpxzjIY/FHE2XUwHJhdMRe8jFlQO5wcEgldfAI76TqJSla6Ms3Q5tN1ZB6w==
- Authentication-results: esa2.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
- Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monne <roger.pau@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Wei Liu <wl@xxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>
- Delivery-date: Tue, 13 Apr 2021 14:02:57 +0000
- Ironport-hdrordr: A9a23:nS7wcq4XsyIXVmxItQPXwU2EI+orLtY04lQ7vn1ZYSd+NuSFis Gjm+ka3xfoiDAXHEotg8yEJbPoexzh3LZPy800Ma25VAfr/FGpIoZr8Jf4z1TbdxHW3tV2kZ 1te60WMrDNJHBnkMf35xS5Gd48wN+BtJuln/va0m0Fd2BXQotLhj0JbjqzOEtwWQVAGN4FD5 Ka/MVKvH6Nfn4QY8S9CBA+LpT+jvfMk4/rZgNDOg4/5GC1/E6VwZPZMzzd5BcRVDtT3awvmF KqryXV7riu2svLrCP0+HTU6/1t6bnc4/tFQPeBk80Ebgjr4zzYH7hJf52nkHQLrPq06FAs+e O80ysIG8ho8XveciWUjHLWqnDd+Q0j4XPj1lOU6EGLyaeSJENYerh8rLlUfRfD500rsMsU6t Mw40uju4dKFhSFpSzh5rHzJmBXv3Cpqnkvm/N7tQ05baIibtZq3Oki1XIQOpIBECXm0ZsgAe ljAerNjcwmD2+yXjT3uHJiz8erWWl2NhCaQlIassjQ6DROmmtlpnFoiPA3rzMlztYQWpNE7+ PLPuBBk6xPdNYfaeZYCP0aScW6J2TRSXv3QS2vCGWiMJtCF2PGqpbx7rlwzvqtYoY0wJw7n4 mEeE9EtEYpEnieSfGm7dluyFTgUW+9VTPixoV1/J5ioIDxQ7LtLGmqVE0uqc29uP8Sa/erGs qbCdZzObvOPGHuEYFG00nVQJ9JM0QTV8UTp5IVQFSLjs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nFqtinaWyVkhXgarB1FlMOji7lVqp5wHXGyl 5dfDtbOmoSPsdxvcUxf+SMt4r9y9g5S5bHSQ+3QHL1mcPSJWaRXQMPmF0/d6P1H0n8t71yV+1s jO7vxeKYFD6Pjm1+Heb2SOdB/a9IwzYcZiamajbIz2lh/XcXI3KCUzOYOmWhA5lHsoFZhndlwF Oo8=
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
Further changes will rely on MSR entries being sorted, so add a test
to assert it.
Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
Changes since v1:
- New in this version.
---
tools/tests/cpu-policy/test-cpu-policy.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/tools/tests/cpu-policy/test-cpu-policy.c
b/tools/tests/cpu-policy/test-cpu-policy.c
index 0fa209f1ea7..ed450a09970 100644
--- a/tools/tests/cpu-policy/test-cpu-policy.c
+++ b/tools/tests/cpu-policy/test-cpu-policy.c
@@ -86,6 +86,16 @@ static bool leaves_are_sorted(const xen_cpuid_leaf_t
*leaves, unsigned int nr)
return true;
}
+static bool msrs_are_sorted(const xen_msr_entry_t *entries, unsigned int nr)
+{
+ for ( unsigned int i = 1; i < nr; ++i )
+ /* MSR index went backwards => not sorted. */
+ if ( entries[i - 1].idx > entries[i].idx )
+ return false;
+
+ return true;
+}
+
static void test_cpuid_current(void)
{
struct cpuid_policy p;
@@ -270,6 +280,13 @@ static void test_msr_serialise_success(void)
goto test_done;
}
+ if ( !msrs_are_sorted(msrs, nr) )
+ {
+ fail(" Test %s, MSR entries not sorted\n",
+ t->name);
+ goto test_done;
+ }
+
test_done:
free(msrs);
}
--
2.30.1
|