New issue
Advanced search Search tips

Issue 919938 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Today
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 3
Type: Bug



Sign in to add a comment

Many Chromium tests fail when run under Hyper-V

Project Member Reported by ri...@microsoft.com, Jan 8

Issue description

What steps will reproduce the problem?
1. Run a Chromium test under Hyper-V, eg. base_unittests.exe --gtest_filter=*TestNoNegativeCpuUsage

What is the expected result?
Test passes

What happens instead of that?
Test fails

Please provide any additional information below. Attach a screenshot if
possible.
[ RUN      ] SystemMetricsTest.TestNoNegativeCpuUsage
[8900:8500:0108/103110.211:85670703:FATAL:process_metrics.cc(117)] Check failed: !time_delta.is_zero().

TimeTicks and ThreadTicks are not entering high precision mode, because CPU::has_non_stop_time_stamp_counter_ is false. Hyper-V cpuid.0x80000007 is reporting a variant TSC.
 
This looks like a duplicate of  crbug.com/723225 . I mention this mostly to make sure that if one bug is closed as fixed that we also close the other (if appropriate).
Project Member

Comment 2 by bugdroid1@chromium.org, Jan 18 (5 days ago)

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/4aea59b985a99008891dd0dbcd9b6ebf6b3673fa

commit 4aea59b985a99008891dd0dbcd9b6ebf6b3673fa
Author: Rick James <rickj@microsoft.com>
Date: Fri Jan 18 02:25:47 2019

Treat Microsoft Hyper-V as having an invariant time stamp counter

QueryPerformanceCounter support is well documented here:
https://docs.microsoft.com/en-us/windows/desktop/SysInfo/acquiring-high-resolution-time-stamps#qpc-support-in-windows-versions

Summary:
- QueryPerformanceCounter has a lot of challenges on XP
- QueryPerformanceCounter always produces correct results as of Vista
- QueryPerformanceCounter often produces precise results as of Win7,
  except: "Windows 7 ... On systems where the TSC is not suitable for
  timekeeping, Windows automatically selects a platform counter (either
  the HPET timer or the ACPI PM timer) as the basis for QPC."
- QueryPerformanceCounter always produces precise results as of Win8

TimeTicks, via CPU::Initialize, uses the cpuid.0x80000007 invariant
TSC flag==0 as the method to choose to use QueryPerformanceCounter.

ThreadTicks uses rdtsc to convert QueryThreadCycleTime to elapsed time.
MSDN advises against doing this because of varying implementations. It
is reasonable to want precise elapsed thread time. There isn’t a
supported way to programmatically get this on Windows. Filed a feature
request with the Windows kernel team. This information can be gathered
using the precise CPU ETW view in Windows Performance Advisor. Leaving
the current behavior as-is.

Microsoft Hyper-V guest partitions see invariant TSC flag==0, because in
VM migration scenarios the TSC can become variant. Most of the time it
is invariant. Adding a special case to always treat Hyper-V as invariant
TSC. This:
- unblocks many Chromium tests from running on Hyper-V
- takes TimeTicks down the well supported QueryPerformanceCounter path
- keeps ThreadTicks on the unsupported, but mostly works, TSC elapsed
  time path


Bug:  919938 
Change-Id: Ib80b82fdd0cbb302af18d716cabe9fe27d0b4b1c
Reviewed-on: https://chromium-review.googlesource.com/c/1413055
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Yuri Wiitala <miu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#623961}
[modify] https://crrev.com/4aea59b985a99008891dd0dbcd9b6ebf6b3673fa/base/cpu.cc

Comment 3 by ri...@microsoft.com, Today (13 hours ago)

Status: Fixed (was: Assigned)

Sign in to add a comment