|
46 | 46 | #include "test_util.h"
|
47 | 47 | #include "memstress.h"
|
48 | 48 | #include "guest_modes.h"
|
| 49 | +#include "processor.h" |
49 | 50 |
|
50 | 51 | /* Global variable used to synchronize all of the vCPU threads. */
|
51 | 52 | static int iteration;
|
@@ -180,15 +181,21 @@ static void mark_vcpu_memory_idle(struct kvm_vm *vm,
|
180 | 181 | * access tracking but low enough as to not make the test too brittle
|
181 | 182 | * over time and across architectures.
|
182 | 183 | *
|
183 |
| - * Note that when run in nested virtualization, this check will trigger |
184 |
| - * much more frequently because TLB size is unlimited and since no flush |
185 |
| - * happens, much more pages are cached there and guest won't see the |
186 |
| - * "idle" bit cleared. |
| 184 | + * When running the guest as a nested VM, "warn" instead of asserting |
| 185 | + * as the TLB size is effectively unlimited and the KVM doesn't |
| 186 | + * explicitly flush the TLB when aging SPTEs. As a result, more pages |
| 187 | + * are cached and the guest won't see the "idle" bit cleared. |
187 | 188 | */
|
188 |
| - if (still_idle >= pages / 10) |
| 189 | + if (still_idle >= pages / 10) { |
| 190 | +#ifdef __x86_64__ |
| 191 | + TEST_ASSERT(this_cpu_has(X86_FEATURE_HYPERVISOR), |
| 192 | + "vCPU%d: Too many pages still idle (%lu out of %lu)", |
| 193 | + vcpu_idx, still_idle, pages); |
| 194 | +#endif |
189 | 195 | printf("WARNING: vCPU%d: Too many pages still idle (%lu out of %lu), "
|
190 | 196 | "this will affect performance results.\n",
|
191 | 197 | vcpu_idx, still_idle, pages);
|
| 198 | + } |
192 | 199 |
|
193 | 200 | close(page_idle_fd);
|
194 | 201 | close(pagemap_fd);
|
|
0 commit comments