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

[PATCH 1/2] x86/cpu-policy: add (another) size check of deep_features[]


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 29 Aug 2023 14:15:42 +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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3kOaYSK1aU6BycTvCRMwKPEsD3WbAgMeYjultb2R0/4=; b=ldhmHd/q0JUoK/lY9A3FEKMyRLaM2zjEg0/R+EShMcQvzuYGUNaPM9krOx5jHUvSdDtxmzX6huRotqEy+klaGBEnZ8n79D2Y4kQbfCW2RIzuA5q2uTlekmS9j487eFPlAGT/AW88ObTA0cpZJXXUu+uFaTDXU8PuArRN+vdplZ0Pr8xfwY0VvjHG11MtL8d0AaqWmzr+7EZBWo4p99PnaQxyt/D7aUk22gDfsJXepm5ERavKkUQ4P8eq8goSkoJInfR8cQoImlxhCO9rqx0p1OyOe1dALQ6cHIxRhG9pI9DtOWfT/PUmZvUNPKkfefsCqIufTyrww0cAs9aE3MJlbQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mhB02qnKHgjXbFIjQdzgZpJVdR8I2qepqGYJJDl0erwphCiULLihTekfFDjyDV2wb+bqS5iXyyWsEfSVHkrGh7vJZfMuUSE/9mh6Q+/JVfdYaOi5UvYGA5C0r/wpIHbjYFGAh4sGO3AuMzdwRhSzg3Mtm9t9vQhyVsXT+pmMs2Irx5Sz6qTKEj9dymzcxQQbiX1UVDjDQACnpXQvAhHIMwpggX4BfRulZQLz7sjE/9eprpkQ//MyDkawduLCVAK8LmwYssvRGM1fRwS4wq6z+NHB/KvzPClJVFtkVKsAro/NWLaK/1oSBdXgfGQn5c/8CCq6NGQWYyTeA1a94Np6JA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Tue, 29 Aug 2023 12:15:50 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Having this check in library code guarantees that the tool stack use(s)
will also be covered.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
Dropping the check from arch/x86/cpu-policy.c:build_assertions() in
exchange may be an option. While there checking is against FSCAPINTS,
the difference is only on the surface: That's a #define resolving to
FEATURESET_NR_ENTRIES.

Really the duplication of deep_features[] itself is also somewhat odd.
While not quite as big as deep_deps[], both Xen and libxg could
certainly get away with just a single instance each.

--- a/xen/lib/x86/cpuid.c
+++ b/xen/lib/x86/cpuid.c
@@ -298,6 +298,7 @@ const uint32_t *x86_cpu_policy_lookup_de
     } deep_deps[] = INIT_DEEP_DEPS;
     unsigned int start = 0, end = ARRAY_SIZE(deep_deps);
 
+    BUILD_BUG_ON(ARRAY_SIZE(deep_features) != FEATURESET_NR_ENTRIES);
     BUILD_BUG_ON(ARRAY_SIZE(deep_deps) != NR_DEEP_DEPS);
 
     /* Fast early exit. */




 


Rackspace

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