| 1 |
From 8b269ce1c5e3df74be85e549c6cd6280e34a00f4 Mon Sep 17 00:00:00 2001 |
| 2 |
From: Marcel Cornu <[email protected]> |
| 3 |
Date: Fri, 26 Jan 2024 13:59:07 +0000 |
| 4 |
Subject: [PATCH] v4.1.0: Fix non-arch L3CAT detection |
| 5 |
|
| 6 |
Fix for detection of non-architectural L3CAT on intel-cmt-cat v4.1.0. |
| 7 |
Note: The RDT_PROBE_MSR environment variable must be set with the MSR |
| 8 |
interface for correct detection. |
| 9 |
--- |
| 10 |
lib/hw_cap.c | 35 ++++++++++++++++++++++++++++------- |
| 11 |
lib/log.c | 2 +- |
| 12 |
2 files changed, 29 insertions(+), 8 deletions(-) |
| 13 |
|
| 14 |
diff --git a/lib/hw_cap.c b/lib/hw_cap.c |
| 15 |
index b1444e45..a6b33b60 100644 |
| 16 |
--- a/lib/hw_cap.c |
| 17 |
+++ b/lib/hw_cap.c |
| 18 |
@@ -524,6 +524,7 @@ hw_cap_l3ca_discover(struct pqos_cap_l3ca *cap, const struct pqos_cpuinfo *cpu) |
| 19 |
{ |
| 20 |
struct cpuid_out res; |
| 21 |
unsigned l3_size = 0; |
| 22 |
+ unsigned check_brand_str = 0; |
| 23 |
int ret = PQOS_RETVAL_OK; |
| 24 |
|
| 25 |
ASSERT(cap != NULL); |
| 26 |
@@ -542,23 +543,43 @@ hw_cap_l3ca_discover(struct pqos_cap_l3ca *cap, const struct pqos_cpuinfo *cpu) |
| 27 |
/** |
| 28 |
* Use CPUID method |
| 29 |
*/ |
| 30 |
- LOG_INFO("CPUID.0x7.0: L3 CAT supported\n"); |
| 31 |
ret = hw_cap_l3ca_cpuid(cap, cpu); |
| 32 |
- if (ret == PQOS_RETVAL_OK) |
| 33 |
+ if (ret == PQOS_RETVAL_RESOURCE) |
| 34 |
+ check_brand_str = 1; |
| 35 |
+ else if (ret == PQOS_RETVAL_OK) |
| 36 |
ret = get_cache_info(&cpu->l3, NULL, &l3_size); |
| 37 |
} else { |
| 38 |
+ LOG_INFO("CPUID.0x7.0: L3 CAT not detected.\n"); |
| 39 |
+ check_brand_str = 1; |
| 40 |
+ } |
| 41 |
+ if (check_brand_str) { |
| 42 |
+ LOG_INFO("Checking brand string...\n"); |
| 43 |
/** |
| 44 |
* Use brand string matching method 1st. |
| 45 |
- * If it fails then try register probing. |
| 46 |
*/ |
| 47 |
- LOG_INFO("CPUID.0x7.0: L3 CAT not detected. " |
| 48 |
- "Checking brand string...\n"); |
| 49 |
ret = hw_cap_l3ca_brandstr(cap); |
| 50 |
- if (ret != PQOS_RETVAL_OK) |
| 51 |
+ /** |
| 52 |
+ * If brand string check fails then probe MSRs |
| 53 |
+ * Note: RDT_PROBE_MSR env var must also be set |
| 54 |
+ */ |
| 55 |
+ if (ret != PQOS_RETVAL_OK && getenv("RDT_PROBE_MSR") != NULL) { |
| 56 |
+ LOG_INFO("Probing msr....\n"); |
| 57 |
ret = hw_cap_l3ca_probe(cap, cpu); |
| 58 |
- if (ret == PQOS_RETVAL_OK) |
| 59 |
+ } |
| 60 |
+ if (ret == PQOS_RETVAL_OK) { |
| 61 |
ret = |
| 62 |
get_cache_info(&cpu->l3, &cap->num_ways, &l3_size); |
| 63 |
+ |
| 64 |
+ LOG_WARN("Detected model specific non-architectural " |
| 65 |
+ "features (L3 " |
| 66 |
+ "CAT).\n Intel recommends validating " |
| 67 |
+ "that the feature " |
| 68 |
+ "provides the\n performance necessary " |
| 69 |
+ "for your " |
| 70 |
+ "use-case. Non-architectural\n features " |
| 71 |
+ "may not " |
| 72 |
+ "behave as expected in all scenarios.\n"); |
| 73 |
+ } |
| 74 |
} |
| 75 |
|
| 76 |
if (cap->num_ways > 0) |
| 77 |
diff --git a/lib/log.c b/lib/log.c |
| 78 |
index 735131dd..c3d33c21 100644 |
| 79 |
--- a/lib/log.c |
| 80 |
+++ b/lib/log.c |
| 81 |
@@ -51,7 +51,7 @@ |
| 82 |
* Local data types |
| 83 |
* --------------------------------------- |
| 84 |
*/ |
| 85 |
-#define AP_BUFFER_SIZE 256 |
| 86 |
+#define AP_BUFFER_SIZE 320 |
| 87 |
|
| 88 |
/** |
| 89 |
* --------------------------------------- |
| 90 |
-- |
| 91 |
2.34.1 |
| 92 |
|