IP Library Granted Patent US 8,392,917
Granted Patent B2
US 8,392,917 · App. 12/414,374 · Granted Mar 5, 2013

Timer access from user mode through a shared memory page

Inventors: Shuvabrata Ganguly (Seattle, WA); Jason S. Wohlgemuth (Duvall, WA); Allen Marshall (Woodinville, WA)
Assignee: Microsoft Corporation
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 8,392,917
App. No.
12/414,374
Granted
Mar 5, 2013
Kind
B2
Abstract

A computing system in which a software component executing on a platform can reliably and efficiently obtain state information about a component supported by the platform through the use of a shared memory page. State information may be supplied by the platform, but any state translation information needed to map the state information as supplied to a format as used may be provided through the shared page. In a virtualized environment, the state translation information can be used to map the value of a virtual timer counter or other component from a value provided by a virtual processor to a normalized reference time that will yield the same result, regardless of whether the software component is migrated to or from another virtual processor. Use of a shared page avoids the inefficiency of an intercept into a virtualized environment or a system calls in native mode operation.

Claims (70)

1. A method of operating a computing device comprising a hardware platform, the hardware platform comprising at least one physical processor and a first hardware component, the first hardware component comprising a hardware timer on the physical processor, the method comprising: operating the at least one physical processor to:

execute computer-executable instructions implementing a computer operating system executing as a guest in a virtual machine; and

execute computer-executable instructions implementing a user mode component executing on the computer operating system that performs an operation based on a state of the first hardware component,

wherein operating the at least one physical processor to execute computer-executable instructions implementing a user mode component comprises performing the operation, the performing comprising:

obtaining a value of the state of the first hardware component, the value of the state indicating whether a timer type is implemented by the hardware timer; and

obtaining translation information through an interface with a kernel of the operating system; and

computing a translated value, according to the translation information, by computing a reference time according to the obtained value, wherein the computing depends on the obtained value.

2. The method of claim 1 , wherein:

the method further comprises operating the at least one physical processor to implement a hypervisor, the hypervisor emulating an emulated processor;

executing computer-executable instructions implementing a computer operating system comprises executing the computer-executable instructions on the emulated processor;

the first hardware component comprises a time stamp counter that is emulated in the emulated processor by an emulated time stamp counter;

the translation information comprises a scale factor and an offset;

obtaining a value of the state of the first hardware component comprises reading a value from the emulated time stamp counter; and

the computing a translated value comprises computing a normalized reference time by applying the scale factor and the offset to the value obtained from the time stamp counter.

3. The method of claim 1 , wherein:

the reading and the obtaining comprise reading and obtaining without issuing a system call to the kernel of the operating system.

4. The method of claim 2 , wherein applying the offset and the scale factor to the timer value obtained from the time stamp counter comprises adding the offset to the product of the timer value and the scale factor.

5. The method of claim 4 , wherein:

the performing further comprises:

obtaining a sequence number from the shared page; and

prior to reading a timer value, determining if the sequence number is invalid; and

the reading, obtaining, and calculating are performed when the sequence number is not invalid.

6. The method of claim 5 , wherein the performing further comprises:

when the sequence number is invalid, calculating the normalized reference time using an alternative method.

7. The method of claim 6 , wherein calculating the normalized reference time using an alternative method comprises comprising the normalized reference time by obtaining a value of an Advanced Configuration and an Power Interface Power Management timer.

8. The method of claim 7 , wherein:

the sequence number comprises a first sequence number obtained at a first time; and

wherein the performing further comprises:

subsequent to calculating the normalized reference time, obtaining a second sequence number from the shared page at a second time;

determining if the first sequence number is the same as the second sequence number;

when the first sequence number is the same as the second sequence number, returning the value of the calculated normalized reference time to a consumer of the operation; and

when the first sequence number is not the same as the second sequence number, then:

obtaining a third sequence number from the shared page at a third time;

prior to reading a timer value, determining if the third sequence number is invalid; and

when the third sequence number is not invalid, then performing the reading, the obtaining, and the calculating.

9. A computer system, comprising:

at least one physical processor;

storage encoded with computer-executable instructions implementing a hypervisor, the hypervisor implementing an emulated processor having an emulated time stamp counter; and

the storage encoded with computer-executable instructions implementing a computer operating system executing on the emulated processor; and

the storage encoded with computer-executable instructions implementing a user mode component executing on the computer operating system that performs a method of computing a reference time, the method comprising:

operating the at least one physical processor to execute the computer-executable instructions of the user mode component, the operating comprising:

reading a timer value from the emulated time stamp counter from the emulated processor, the timer value indicating whether a type of hardware timer corresponding to the emulated time stamp counter is implemented by the physical processor;

obtaining through an interface with the hypervisor a scale factor and an offset; and

calculating the reference time by applying the offset and the scale factor according to the timer value obtained from the time stamp counter, wherein the calculating depends on the timer value obtained from the time stamp counter.

10. The computer system of claim 9 , wherein an interface comprising a shared page provides the hypervisor with a scale factor and an offset, wherein the shared page is shared between the hypervisor and a kernel of the operating system, the shared page also being shared between the kernel of the operating system and the user mode component.

11. The computer system of claim 10 , wherein:

the reading is performed without issuing a system call to the kernel of the operating system, and without causing an intercept into the hypervisor.

12. The computer system of claim 11 , wherein applying the offset and the scale factor to the timer value obtained from the time stamp counter comprises adding the offset to the product of the timer value and the scale factor.

13. The method of claim 12 , wherein:

the performing further comprises:

obtaining a sequence number from the shared page; and

prior to reading a timer value, determining if the sequence number is invalid; and

the reading, obtaining, and calculating are performed when the sequence number is not invalid.

14. The method of claim 13 , wherein the performing further comprises:

when the sequence number is invalid, calculating the normalized reference time using an alternative method.

15. The method of claim 14 , wherein calculating the reference time using an alternative method comprises obtaining a value of the Advanced Configuration and Power Interface Power Management timer.

16. A computer-readable medium encoded with computer-executable instructions, that when executed on a computer, the computer comprising an operating system executing on a virtual machine managed by a hypervisor, the hypervisor providing an emulated processor having an emulated time stamp counter, performs a method of computing a normalized reference time in a user-level component executing on the operating system, the method comprising:

operating the at least one physical processor to execute the computer-executable instructions of the user mode component, the operating comprising:

reading a timer value from the emulated processor, the reading performed by issuing an opcode to the emulated processor and accessing a result thereof, where the timer value indicates whether the emulated time stamp counter is available to be accessed by the virtual machine, and when the timer value so indicates:

obtaining through an interface with a kernel of the operating system a scale factor and an offset; and

calculating the normalized reference time by applying the offset and the scale factor to the read timer value.

17. The computer system of claim 16 , wherein the reading and the obtaining comprise reading and obtaining without issuing a system call to the kernel of the operating system.

18. The computer system of claim 17 , wherein the interface comprises a shared page, wherein the shared page is shared between the kernel of the operating system and the user-level component.

19. The computer system of claim 18 , wherein applying the offset and the scale factor to the timer value obtained from the time stamp counter comprises adding the offset to the product of the timer value and the scale factor.

20. The method of claim 19 , wherein:

the method further comprises:

obtaining a sequence number from the shared page; and

prior to reading a timer value, determining if the sequence number is invalid; and

when the sequence number is invalid, calculating the normalized reference time using an alternative method; and

the reading, obtaining, and calculating are performed when the sequence number is not invalid.

Assignments (2)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Dec 9, 2014
From: MICROSOFT CORPORATION
To: MICROSOFT TECHNOLOGY LICENSING, LLC
Reel/Frame 034564/0001 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Apr 28, 2009
From: GANGULY, SHUVABRATA; WOHLGEMUTH, JASON S.; MARSHALL, ALLEN
To: MICROSOFT CORPORATION
Reel/Frame 022605/0727 →
Continuity (1)
Related Publication 20100251235A1 · Sep 30, 2010